diff --git a/src/liballoc/fmt.rs b/src/liballoc/fmt.rs index 13ef2f063f95f..26077f3c8d150 100644 --- a/src/liballoc/fmt.rs +++ b/src/liballoc/fmt.rs @@ -50,8 +50,8 @@ //! The internal iterator over the argument has not been advanced by the time //! the first `{}` is seen, so it prints the first argument. Then upon reaching //! the second `{}`, the iterator has advanced forward to the second argument. -//! Essentially, parameters which explicitly name their argument do not affect -//! parameters which do not name an argument in terms of positional specifiers. +//! Essentially, parameters that explicitly name their argument do not affect +//! parameters that do not name an argument in terms of positional specifiers. //! //! A format string is required to use all of its arguments, otherwise it is a //! compile-time error. You may refer to the same argument more than once in the @@ -60,7 +60,7 @@ //! ## Named parameters //! //! Rust itself does not have a Python-like equivalent of named parameters to a -//! function, but the [`format!`] macro is a syntax extension which allows it to +//! function, but the [`format!`] macro is a syntax extension that allows it to //! leverage named parameters. Named parameters are listed at the end of the //! argument list and have the syntax: //! @@ -77,7 +77,7 @@ //! ``` //! //! It is not valid to put positional parameters (those without names) after -//! arguments which have names. Like with positional parameters, it is not +//! arguments that have names. Like with positional parameters, it is not //! valid to provide named parameters that are unused by the format string. //! //! # Formatting Parameters @@ -130,7 +130,7 @@ //! //! The default [fill/alignment](#fillalignment) for non-numerics is a space and //! left-aligned. The -//! defaults for numeric formatters is also a space but with right-alignment. If +//! default for numeric formatters is also a space character but with right-alignment. If //! the `0` flag (see below) is specified for numerics, then the implicit fill character is //! `0`. //! @@ -161,7 +161,7 @@ //! `Signed` trait. This flag indicates that the correct sign (`+` or `-`) //! should always be printed. //! * `-` - Currently not used -//! * `#` - This flag is indicates that the "alternate" form of printing should +//! * `#` - This flag indicates that the "alternate" form of printing should //! be used. The alternate forms are: //! * `#?` - pretty-print the [`Debug`] formatting //! * `#x` - precedes the argument with a `0x` @@ -173,9 +173,9 @@ //! like `{:08}` would yield `00000001` for the integer `1`, while the //! same format would yield `-0000001` for the integer `-1`. Notice that //! the negative version has one fewer zero than the positive version. -//! Note that padding zeroes are always placed after the sign (if any) +//! Note that padding zeros are always placed after the sign (if any) //! and before the digits. When used together with the `#` flag, a similar -//! rule applies: padding zeroes are inserted after the prefix but before +//! rule applies: padding zeros are inserted after the prefix but before //! the digits. The prefix is included in the total width. //! //! ## Precision @@ -251,7 +251,7 @@ //! //! In some programming languages, the behavior of string formatting functions //! depends on the operating system's locale setting. The format functions -//! provided by Rust's standard library do not have any concept of locale, and +//! provided by Rust's standard library do not have any concept of locale and //! will produce the same results on all systems regardless of user //! configuration. //! @@ -470,7 +470,7 @@ //! //! ### `format_args!` //! -//! This is a curious macro which is used to safely pass around +//! This is a curious macro used to safely pass around //! an opaque object describing the format string. This object //! does not require any heap allocations to create, and it only //! references information on the stack. Under the hood, all of @@ -495,7 +495,7 @@ //! This structure can then be passed to the [`write`] and [`format`] functions //! inside this module in order to process the format string. //! The goal of this macro is to even further prevent intermediate allocations -//! when dealing formatting strings. +//! when dealing with formatting strings. //! //! For example, a logging library could use the standard formatting syntax, but //! it would internally pass around this structure until it has been determined diff --git a/src/librustc_mir/interpret/validity.rs b/src/librustc_mir/interpret/validity.rs index 9f2e79bbee31e..eb743675d91d3 100644 --- a/src/librustc_mir/interpret/validity.rs +++ b/src/librustc_mir/interpret/validity.rs @@ -321,11 +321,12 @@ impl<'rt, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> ValidityVisitor<'rt, 'mir, ' try_validation!( self.ecx.read_drop_type_from_vtable(vtable), self.path, - err_ub!(InvalidDropFn(..)) | err_ub!(DanglingIntPointer(..)) | err_ub!(InvalidFunctionPointer(..)) | err_unsup!(ReadBytesAsPointer) => - { "invalid drop function pointer in vtable" }, + { "invalid drop function pointer in vtable (not pointing to a function)" }, + err_ub!(InvalidDropFn(..)) => + { "invalid drop function pointer in vtable (function has incompatible signature)" }, ); try_validation!( self.ecx.read_size_and_align_from_vtable(vtable), @@ -400,7 +401,7 @@ impl<'rt, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> ValidityVisitor<'rt, 'mir, ' err_ub!(DanglingIntPointer(0, _)) => { "a NULL {}", kind }, err_ub!(DanglingIntPointer(i, _)) => - { "a dangling {} (address {} is unallocated)", kind, i }, + { "a dangling {} (address 0x{:x} is unallocated)", kind, i }, err_ub!(PointerOutOfBounds { .. }) => { "a dangling {} (going beyond the bounds of its allocation)", kind }, err_unsup!(ReadBytesAsPointer) => diff --git a/src/librustc_resolve/diagnostics.rs b/src/librustc_resolve/diagnostics.rs index 450293b991bde..8e82480c6305d 100644 --- a/src/librustc_resolve/diagnostics.rs +++ b/src/librustc_resolve/diagnostics.rs @@ -47,6 +47,7 @@ impl TypoSuggestion { /// A free importable items suggested in case of resolution failure. crate struct ImportSuggestion { pub did: Option, + pub descr: &'static str, pub path: Path, } @@ -652,7 +653,7 @@ impl<'a> Resolver<'a> { Res::Def(DefKind::Ctor(..), did) => this.parent(did), _ => res.opt_def_id(), }; - candidates.push(ImportSuggestion { did, path }); + candidates.push(ImportSuggestion { did, descr: res.descr(), path }); } } } @@ -1445,7 +1446,7 @@ fn find_span_immediately_after_crate_name( crate fn show_candidates( err: &mut DiagnosticBuilder<'_>, // This is `None` if all placement locations are inside expansions - span: Option, + use_placement_span: Option, candidates: &[ImportSuggestion], better: bool, found_use: bool, @@ -1453,6 +1454,7 @@ crate fn show_candidates( if candidates.is_empty() { return; } + // we want consistent results across executions, but candidates are produced // by iterating through a hash map, so make sure they are ordered: let mut path_strings: Vec<_> = @@ -1460,14 +1462,15 @@ crate fn show_candidates( path_strings.sort(); path_strings.dedup(); - let better = if better { "better " } else { "" }; - let msg_diff = match path_strings.len() { - 1 => " is found in another module, you can import it", - _ => "s are found in other modules, you can import them", + let (determiner, kind) = if candidates.len() == 1 { + ("this", candidates[0].descr) + } else { + ("one of these", "items") }; - let msg = format!("possible {}candidate{} into scope", better, msg_diff); + let instead = if better { " instead" } else { "" }; + let msg = format!("consider importing {} {}{}", determiner, kind, instead); - if let Some(span) = span { + if let Some(span) = use_placement_span { for candidate in &mut path_strings { // produce an additional newline to separate the new use statement // from the directly following item. diff --git a/src/librustc_resolve/late/diagnostics.rs b/src/librustc_resolve/late/diagnostics.rs index f6213189d9443..bd77f9e1c9c97 100644 --- a/src/librustc_resolve/late/diagnostics.rs +++ b/src/librustc_resolve/late/diagnostics.rs @@ -873,7 +873,10 @@ impl<'a> LateResolutionVisitor<'a, '_, '_> { let module_def_id = module.def_id().unwrap(); if module_def_id == def_id { let path = Path { span: name_binding.span, segments: path_segments }; - result = Some((module, ImportSuggestion { did: Some(def_id), path })); + result = Some(( + module, + ImportSuggestion { did: Some(def_id), descr: "module", path }, + )); } else { // add the module to the lookup if seen_modules.insert(module_def_id) { diff --git a/src/test/auxiliary/rust_test_helpers.c b/src/test/auxiliary/rust_test_helpers.c index 897c940149b0a..92b7dd4b7c516 100644 --- a/src/test/auxiliary/rust_test_helpers.c +++ b/src/test/auxiliary/rust_test_helpers.c @@ -368,6 +368,7 @@ rust_dbg_unpack_option_u64(struct U8TaggedEnumOptionU64 o, uint64_t *into) { return 0; default: assert(0 && "unexpected tag"); + return 0; } } @@ -411,5 +412,6 @@ rust_dbg_unpack_option_u64u64(struct U8TaggedEnumOptionU64U64 o, uint64_t *a, ui return 0; default: assert(0 && "unexpected tag"); + return 0; } } diff --git a/src/test/codegen/ffi-out-of-bounds-loads.rs b/src/test/codegen/ffi-out-of-bounds-loads.rs new file mode 100644 index 0000000000000..a58d75389f5e2 --- /dev/null +++ b/src/test/codegen/ffi-out-of-bounds-loads.rs @@ -0,0 +1,22 @@ +// compile-flags: -C no-prepopulate-passes +// Regression test for #29988 + +#[repr(C)] +struct S { + f1: i32, + f2: i32, + f3: i32, +} + +extern { + fn foo(s: S); +} + +fn main() { + let s = S { f1: 1, f2: 2, f3: 3 }; + unsafe { + // CHECK: load { i64, i32 }, { i64, i32 }* {{.*}}, align 4 + // CHECK: call void @foo({ i64, i32 } {{.*}}) + foo(s); + } +} diff --git a/src/test/ui/class-missing-self.stderr b/src/test/ui/class-missing-self.stderr index 681d0ffea8be8..d501200d73cec 100644 --- a/src/test/ui/class-missing-self.stderr +++ b/src/test/ui/class-missing-self.stderr @@ -10,7 +10,7 @@ error[E0425]: cannot find function `sleep` in this scope LL | sleep(); | ^^^^^ not found in this scope | -help: possible candidate is found in another module, you can import it into scope +help: consider importing this function | LL | use std::thread::sleep; | diff --git a/src/test/ui/consts/const-eval/ub-wide-ptr.stderr b/src/test/ui/consts/const-eval/ub-wide-ptr.stderr index 94ca60596d61b..063ea81036b69 100644 --- a/src/test/ui/consts/const-eval/ub-wide-ptr.stderr +++ b/src/test/ui/consts/const-eval/ub-wide-ptr.stderr @@ -170,7 +170,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-wide-ptr.rs:109:1 | LL | const TRAIT_OBJ_BAD_DROP_FN_NULL: &dyn Trait = unsafe { mem::transmute((&92u8, &[0usize; 8])) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered invalid drop function pointer in vtable + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered invalid drop function pointer in vtable (not pointing to a function) | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. @@ -178,7 +178,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-wide-ptr.rs:111:1 | LL | const TRAIT_OBJ_BAD_DROP_FN_INT: &dyn Trait = unsafe { mem::transmute((&92u8, &[1usize; 8])) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered invalid drop function pointer in vtable + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered invalid drop function pointer in vtable (not pointing to a function) | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. @@ -186,7 +186,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-wide-ptr.rs:113:1 | LL | const TRAIT_OBJ_BAD_DROP_FN_NOT_FN_PTR: &dyn Trait = unsafe { mem::transmute((&92u8, &[&42u8; 8])) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered invalid drop function pointer in vtable + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered invalid drop function pointer in vtable (not pointing to a function) | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. diff --git a/src/test/ui/crate-in-paths.stderr b/src/test/ui/crate-in-paths.stderr index 38d222f980d2d..c3aa135f77d5b 100644 --- a/src/test/ui/crate-in-paths.stderr +++ b/src/test/ui/crate-in-paths.stderr @@ -4,7 +4,7 @@ error[E0425]: cannot find value `Foo` in this scope LL | Foo; | ^^^ not found in this scope | -help: possible candidate is found in another module, you can import it into scope +help: consider importing this unit struct | LL | use crate::bar::Foo; | diff --git a/src/test/ui/did_you_mean/issue-56028-there-is-an-enum-variant.stderr b/src/test/ui/did_you_mean/issue-56028-there-is-an-enum-variant.stderr index 792b36e00bbfe..9429a0b576532 100644 --- a/src/test/ui/did_you_mean/issue-56028-there-is-an-enum-variant.stderr +++ b/src/test/ui/did_you_mean/issue-56028-there-is-an-enum-variant.stderr @@ -22,7 +22,7 @@ error[E0425]: cannot find value `Set` in this scope LL | fn setup() -> Set { Set } | ^^^ not found in this scope | -help: possible candidates are found in other modules, you can import them into scope +help: consider importing one of these items | LL | use AffixHeart::Set; | diff --git a/src/test/ui/enum/issue-67945-1.rs b/src/test/ui/enum/issue-67945-1.rs new file mode 100644 index 0000000000000..7977bddae7bcb --- /dev/null +++ b/src/test/ui/enum/issue-67945-1.rs @@ -0,0 +1,8 @@ +enum Bug { + Var = { + let x: S = 0; //~ ERROR: mismatched types + 0 + }, +} + +fn main() {} diff --git a/src/test/ui/enum/issue-67945-1.stderr b/src/test/ui/enum/issue-67945-1.stderr new file mode 100644 index 0000000000000..6583fe13d0c63 --- /dev/null +++ b/src/test/ui/enum/issue-67945-1.stderr @@ -0,0 +1,17 @@ +error[E0308]: mismatched types + --> $DIR/issue-67945-1.rs:3:20 + | +LL | enum Bug { + | - this type parameter +LL | Var = { +LL | let x: S = 0; + | - ^ expected type parameter `S`, found integer + | | + | expected due to this + | + = note: expected type parameter `S` + found type `{integer}` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/enum/issue-67945-2.rs b/src/test/ui/enum/issue-67945-2.rs new file mode 100644 index 0000000000000..16bd8530ab38c --- /dev/null +++ b/src/test/ui/enum/issue-67945-2.rs @@ -0,0 +1,9 @@ +#![feature(type_ascription)] + +enum Bug { + Var = 0: S, + //~^ ERROR: mismatched types + //~| ERROR: mismatched types +} + +fn main() {} diff --git a/src/test/ui/enum/issue-67945-2.stderr b/src/test/ui/enum/issue-67945-2.stderr new file mode 100644 index 0000000000000..c40506d59edd9 --- /dev/null +++ b/src/test/ui/enum/issue-67945-2.stderr @@ -0,0 +1,25 @@ +error[E0308]: mismatched types + --> $DIR/issue-67945-2.rs:4:11 + | +LL | enum Bug { + | - this type parameter +LL | Var = 0: S, + | ^ expected type parameter `S`, found integer + | + = note: expected type parameter `S` + found type `{integer}` + +error[E0308]: mismatched types + --> $DIR/issue-67945-2.rs:4:11 + | +LL | enum Bug { + | - this type parameter +LL | Var = 0: S, + | ^^^^ expected `isize`, found type parameter `S` + | + = note: expected type `isize` + found type parameter `S` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/glob-resolve1.stderr b/src/test/ui/glob-resolve1.stderr index efbd53fd223a4..995da6cc1f975 100644 --- a/src/test/ui/glob-resolve1.stderr +++ b/src/test/ui/glob-resolve1.stderr @@ -4,7 +4,7 @@ error[E0425]: cannot find function `fpriv` in this scope LL | fpriv(); | ^^^^^ not found in this scope | -help: possible candidate is found in another module, you can import it into scope +help: consider importing this function | LL | use bar::fpriv; | @@ -15,7 +15,7 @@ error[E0425]: cannot find function `epriv` in this scope LL | epriv(); | ^^^^^ not found in this scope | -help: possible candidate is found in another module, you can import it into scope +help: consider importing this function | LL | use bar::epriv; | @@ -32,7 +32,7 @@ error[E0425]: cannot find value `C` in this scope LL | C; | ^ not found in this scope | -help: possible candidate is found in another module, you can import it into scope +help: consider importing this unit struct | LL | use bar::C; | @@ -56,7 +56,7 @@ help: an enum with a similar name exists | LL | foo::(); | ^ -help: possible candidate is found in another module, you can import it into scope +help: consider importing this enum | LL | use bar::A; | @@ -74,7 +74,7 @@ help: an enum with a similar name exists | LL | foo::(); | ^ -help: possible candidate is found in another module, you can import it into scope +help: consider importing this struct | LL | use bar::C; | @@ -92,7 +92,7 @@ help: an enum with a similar name exists | LL | foo::(); | ^ -help: possible candidate is found in another module, you can import it into scope +help: consider importing this type alias | LL | use bar::D; | diff --git a/src/test/ui/hygiene/globs.stderr b/src/test/ui/hygiene/globs.stderr index 153ad8cbecfcd..8f6b7aca8fda8 100644 --- a/src/test/ui/hygiene/globs.stderr +++ b/src/test/ui/hygiene/globs.stderr @@ -4,7 +4,7 @@ error[E0425]: cannot find function `f` in this scope LL | f(); | ^ not found in this scope | -help: possible candidate is found in another module, you can import it into scope +help: consider importing one of these items | LL | use foo::f; | @@ -23,7 +23,7 @@ LL | | } | |_____- in this macro invocation | = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) -help: possible candidates are found in other modules, you can import them into scope +help: consider importing one of these items | LL | use bar::g; | @@ -41,7 +41,7 @@ LL | n!(f); LL | n!(f); | ^ not found in this scope | - = note: possible candidate is found in another module, you can import it into scope: + = note: consider importing one of these items: foo::f = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) @@ -54,7 +54,7 @@ LL | n!(f); LL | f | ^ not found in this scope | - = note: possible candidate is found in another module, you can import it into scope: + = note: consider importing one of these items: foo::f = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/src/test/ui/impl-trait/universal_wrong_bounds.stderr b/src/test/ui/impl-trait/universal_wrong_bounds.stderr index 32b638dc465c5..3b1a5e5f4ad00 100644 --- a/src/test/ui/impl-trait/universal_wrong_bounds.stderr +++ b/src/test/ui/impl-trait/universal_wrong_bounds.stderr @@ -4,7 +4,7 @@ error[E0404]: expected trait, found derive macro `Debug` LL | fn wants_debug(g: impl Debug) { } | ^^^^^ not a trait | -help: possible better candidate is found in another module, you can import it into scope +help: consider importing this trait instead | LL | use std::fmt::Debug; | @@ -15,7 +15,7 @@ error[E0404]: expected trait, found derive macro `Debug` LL | fn wants_display(g: impl Debug) { } | ^^^^^ not a trait | -help: possible better candidate is found in another module, you can import it into scope +help: consider importing this trait instead | LL | use std::fmt::Debug; | diff --git a/src/test/ui/issues/issue-17546.stderr b/src/test/ui/issues/issue-17546.stderr index 1236bbcdbf6ee..8bf40790f0b24 100644 --- a/src/test/ui/issues/issue-17546.stderr +++ b/src/test/ui/issues/issue-17546.stderr @@ -24,7 +24,7 @@ error[E0573]: expected type, found variant `Result` LL | fn new() -> Result { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not a type | -help: possible better candidates are found in other modules, you can import them into scope +help: consider importing one of these items instead | LL | use std::fmt::Result; | @@ -42,7 +42,7 @@ error[E0573]: expected type, found variant `Result` LL | fn new() -> Result { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not a type | -help: possible better candidates are found in other modules, you can import them into scope +help: consider importing one of these items instead | LL | use std::fmt::Result; | diff --git a/src/test/ui/issues/issue-35675.stderr b/src/test/ui/issues/issue-35675.stderr index a9a27da55b1a1..8637e574c5ecb 100644 --- a/src/test/ui/issues/issue-35675.stderr +++ b/src/test/ui/issues/issue-35675.stderr @@ -15,7 +15,7 @@ error[E0425]: cannot find function, tuple struct or tuple variant `Apple` in thi LL | Apple(5) | ^^^^^ not found in this scope | -help: possible candidate is found in another module, you can import it into scope +help: consider importing this tuple variant | LL | use Fruit::Apple; | @@ -35,7 +35,7 @@ error[E0425]: cannot find function, tuple struct or tuple variant `Apple` in thi LL | Apple(5) | ^^^^^ not found in this scope | -help: possible candidate is found in another module, you can import it into scope +help: consider importing this tuple variant | LL | use Fruit::Apple; | diff --git a/src/test/ui/issues/issue-37534.stderr b/src/test/ui/issues/issue-37534.stderr index b82e7b38914ac..5d008cf24dc90 100644 --- a/src/test/ui/issues/issue-37534.stderr +++ b/src/test/ui/issues/issue-37534.stderr @@ -4,7 +4,7 @@ error[E0404]: expected trait, found derive macro `Hash` LL | struct Foo { } | ^^^^ not a trait | -help: possible better candidate is found in another module, you can import it into scope +help: consider importing this trait instead | LL | use std::hash::Hash; | diff --git a/src/test/ui/issues/issue-38293.stderr b/src/test/ui/issues/issue-38293.stderr index cc3c72b496f5f..d2450ab125062 100644 --- a/src/test/ui/issues/issue-38293.stderr +++ b/src/test/ui/issues/issue-38293.stderr @@ -10,7 +10,7 @@ error[E0423]: expected function, found module `baz` LL | baz(); | ^^^ not a function | -help: possible better candidate is found in another module, you can import it into scope +help: consider importing this function instead | LL | use bar::baz; | diff --git a/src/test/ui/issues/issue-42944.stderr b/src/test/ui/issues/issue-42944.stderr index c71194f41c114..e7e251e39c04f 100644 --- a/src/test/ui/issues/issue-42944.stderr +++ b/src/test/ui/issues/issue-42944.stderr @@ -10,7 +10,7 @@ error[E0425]: cannot find function, tuple struct or tuple variant `B` in this sc LL | B(()); | ^ not found in this scope | -help: possible candidate is found in another module, you can import it into scope +help: consider importing this tuple struct | LL | use foo::B; | diff --git a/src/test/ui/issues/issue-4366-2.stderr b/src/test/ui/issues/issue-4366-2.stderr index 60a1155c614f6..ecee595d4ab6a 100644 --- a/src/test/ui/issues/issue-4366-2.stderr +++ b/src/test/ui/issues/issue-4366-2.stderr @@ -4,7 +4,7 @@ error[E0412]: cannot find type `Bar` in this scope LL | fn sub() -> Bar { 1 } | ^^^ not found in this scope | -help: possible candidate is found in another module, you can import it into scope +help: consider importing this type alias | LL | use a::b::Bar; | @@ -15,7 +15,7 @@ error[E0423]: expected function, found module `foo` LL | foo(); | ^^^ not a function | -help: possible better candidates are found in other modules, you can import them into scope +help: consider importing one of these items instead | LL | use foo::foo; | diff --git a/src/test/ui/issues/issue-4366.stderr b/src/test/ui/issues/issue-4366.stderr index d931d51911756..a094180572daa 100644 --- a/src/test/ui/issues/issue-4366.stderr +++ b/src/test/ui/issues/issue-4366.stderr @@ -4,7 +4,7 @@ error[E0425]: cannot find function `foo` in this scope LL | fn sub() -> isize { foo(); 1 } | ^^^ not found in this scope | -help: possible candidates are found in other modules, you can import them into scope +help: consider importing one of these items | LL | use foo::foo; | diff --git a/src/test/ui/issues/issue-50599.stderr b/src/test/ui/issues/issue-50599.stderr index 378c57011ac50..7ec567a06f09d 100644 --- a/src/test/ui/issues/issue-50599.stderr +++ b/src/test/ui/issues/issue-50599.stderr @@ -4,7 +4,7 @@ error[E0425]: cannot find value `LOG10_2` in module `std::f64` LL | const M: usize = (f64::from(N) * std::f64::LOG10_2) as usize; | ^^^^^^^ not found in `std::f64` | -help: possible candidates are found in other modules, you can import them into scope +help: consider importing one of these items | LL | use std::f32::consts::LOG10_2; | diff --git a/src/test/ui/lexical-scopes.stderr b/src/test/ui/lexical-scopes.stderr index 6bb0877e9b9ba..dce7054517030 100644 --- a/src/test/ui/lexical-scopes.stderr +++ b/src/test/ui/lexical-scopes.stderr @@ -4,7 +4,7 @@ error[E0574]: expected struct, variant or union type, found type parameter `T` LL | let t = T { i: 0 }; | ^ not a struct, variant or union type | -help: possible better candidate is found in another module, you can import it into scope +help: consider importing this struct instead | LL | use T; | diff --git a/src/test/ui/lifetimes/issue-34979.rs b/src/test/ui/lifetimes/issue-34979.rs new file mode 100644 index 0000000000000..252486dd92192 --- /dev/null +++ b/src/test/ui/lifetimes/issue-34979.rs @@ -0,0 +1,9 @@ +trait Foo {} +impl<'a, T> Foo for &'a T {} + +struct Ctx<'a>(&'a ()) +where + &'a (): Foo, //~ ERROR: type annotations needed + &'static (): Foo; + +fn main() {} diff --git a/src/test/ui/lifetimes/issue-34979.stderr b/src/test/ui/lifetimes/issue-34979.stderr new file mode 100644 index 0000000000000..04ad0d1276647 --- /dev/null +++ b/src/test/ui/lifetimes/issue-34979.stderr @@ -0,0 +1,14 @@ +error[E0283]: type annotations needed + --> $DIR/issue-34979.rs:6:13 + | +LL | trait Foo {} + | --------- required by this bound in `Foo` +... +LL | &'a (): Foo, + | ^^^ cannot infer type for reference `&'a ()` + | + = note: cannot satisfy `&'a (): Foo` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0283`. diff --git a/src/test/ui/lint/use_suggestion_json.stderr b/src/test/ui/lint/use_suggestion_json.stderr index 1d0b2a554f19a..d0d91bb61f457 100644 --- a/src/test/ui/lint/use_suggestion_json.stderr +++ b/src/test/ui/lint/use_suggestion_json.stderr @@ -94,7 +94,7 @@ mod foo { ], "children": [ { - "message": "possible candidates are found in other modules, you can import them into scope", + "message": "consider importing one of these items", "code": null, "level": "help", "spans": [ @@ -385,7 +385,7 @@ mod foo { \u001b[0m\u001b[1m\u001b[38;5;12mLL\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m let x: Iter;\u001b[0m \u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;9m^^^^\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;9mnot found in this scope\u001b[0m \u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m -\u001b[0m\u001b[1m\u001b[38;5;14mhelp\u001b[0m\u001b[0m: possible candidates are found in other modules, you can import them into scope\u001b[0m +\u001b[0m\u001b[1m\u001b[38;5;14mhelp\u001b[0m\u001b[0m: consider importing one of these items\u001b[0m \u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m \u001b[0m\u001b[1m\u001b[38;5;12mLL\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0muse std::collections::binary_heap::Iter;\u001b[0m \u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m diff --git a/src/test/ui/macros/macro-outer-attributes.stderr b/src/test/ui/macros/macro-outer-attributes.stderr index 86a6baca05324..8e064d980afab 100644 --- a/src/test/ui/macros/macro-outer-attributes.stderr +++ b/src/test/ui/macros/macro-outer-attributes.stderr @@ -4,7 +4,7 @@ error[E0425]: cannot find function `bar` in module `a` LL | a::bar(); | ^^^ not found in `a` | -help: possible candidate is found in another module, you can import it into scope +help: consider importing this function | LL | use b::bar; | diff --git a/src/test/ui/namespace/namespace-mix.stderr b/src/test/ui/namespace/namespace-mix.stderr index f82c83fd5b0ba..c80055f00d7d9 100644 --- a/src/test/ui/namespace/namespace-mix.stderr +++ b/src/test/ui/namespace/namespace-mix.stderr @@ -12,7 +12,7 @@ help: a tuple struct with a similar name exists | LL | check(m1::TS); | ^^ -help: possible better candidates are found in other modules, you can import them into scope +help: consider importing one of these items instead | LL | use m2::S; | @@ -35,7 +35,7 @@ help: a tuple struct with a similar name exists | LL | check(xm1::TS); | ^^ -help: possible better candidates are found in other modules, you can import them into scope +help: consider importing one of these items instead | LL | use m2::S; | @@ -57,7 +57,7 @@ help: a tuple variant with a similar name exists | LL | check(m7::TV); | ^^ -help: possible better candidates are found in other modules, you can import them into scope +help: consider importing one of these items instead | LL | use m8::V; | @@ -79,7 +79,7 @@ help: a tuple variant with a similar name exists | LL | check(xm7::TV); | ^^ -help: possible better candidates are found in other modules, you can import them into scope +help: consider importing one of these items instead | LL | use m8::V; | diff --git a/src/test/ui/no-implicit-prelude-nested.stderr b/src/test/ui/no-implicit-prelude-nested.stderr index e57d8af5f99b9..8a26366d751d3 100644 --- a/src/test/ui/no-implicit-prelude-nested.stderr +++ b/src/test/ui/no-implicit-prelude-nested.stderr @@ -4,7 +4,7 @@ error[E0405]: cannot find trait `Add` in this scope LL | impl Add for Test {} | ^^^ not found in this scope | -help: possible candidate is found in another module, you can import it into scope +help: consider importing this trait | LL | use std::ops::Add; | @@ -15,7 +15,7 @@ error[E0404]: expected trait, found derive macro `Clone` LL | impl Clone for Test {} | ^^^^^ not a trait | -help: possible better candidates are found in other modules, you can import them into scope +help: consider importing one of these items instead | LL | use std::clone::Clone; | @@ -28,7 +28,7 @@ error[E0405]: cannot find trait `Iterator` in this scope LL | impl Iterator for Test {} | ^^^^^^^^ not found in this scope | -help: possible candidates are found in other modules, you can import them into scope +help: consider importing one of these items | LL | use std::iter::Iterator; | @@ -41,7 +41,7 @@ error[E0405]: cannot find trait `ToString` in this scope LL | impl ToString for Test {} | ^^^^^^^^ not found in this scope | -help: possible candidates are found in other modules, you can import them into scope +help: consider importing one of these items | LL | use std::prelude::v1::ToString; | @@ -60,7 +60,7 @@ error[E0425]: cannot find function `drop` in this scope LL | drop(2) | ^^^^ not found in this scope | -help: possible candidates are found in other modules, you can import them into scope +help: consider importing one of these items | LL | use std::mem::drop; | @@ -73,7 +73,7 @@ error[E0405]: cannot find trait `Add` in this scope LL | impl Add for Test {} | ^^^ not found in this scope | -help: possible candidate is found in another module, you can import it into scope +help: consider importing this trait | LL | use std::ops::Add; | @@ -84,7 +84,7 @@ error[E0404]: expected trait, found derive macro `Clone` LL | impl Clone for Test {} | ^^^^^ not a trait | -help: possible better candidates are found in other modules, you can import them into scope +help: consider importing one of these items instead | LL | use std::clone::Clone; | @@ -97,7 +97,7 @@ error[E0405]: cannot find trait `Iterator` in this scope LL | impl Iterator for Test {} | ^^^^^^^^ not found in this scope | -help: possible candidates are found in other modules, you can import them into scope +help: consider importing one of these items | LL | use std::iter::Iterator; | @@ -110,7 +110,7 @@ error[E0405]: cannot find trait `ToString` in this scope LL | impl ToString for Test {} | ^^^^^^^^ not found in this scope | -help: possible candidates are found in other modules, you can import them into scope +help: consider importing one of these items | LL | use std::prelude::v1::ToString; | @@ -129,7 +129,7 @@ error[E0425]: cannot find function `drop` in this scope LL | drop(2) | ^^^^ not found in this scope | -help: possible candidates are found in other modules, you can import them into scope +help: consider importing one of these items | LL | use std::mem::drop; | @@ -142,7 +142,7 @@ error[E0405]: cannot find trait `Add` in this scope LL | impl Add for Test {} | ^^^ not found in this scope | -help: possible candidate is found in another module, you can import it into scope +help: consider importing this trait | LL | use std::ops::Add; | @@ -153,7 +153,7 @@ error[E0404]: expected trait, found derive macro `Clone` LL | impl Clone for Test {} | ^^^^^ not a trait | -help: possible better candidates are found in other modules, you can import them into scope +help: consider importing one of these items instead | LL | use std::clone::Clone; | @@ -166,7 +166,7 @@ error[E0405]: cannot find trait `Iterator` in this scope LL | impl Iterator for Test {} | ^^^^^^^^ not found in this scope | -help: possible candidates are found in other modules, you can import them into scope +help: consider importing one of these items | LL | use std::iter::Iterator; | @@ -179,7 +179,7 @@ error[E0405]: cannot find trait `ToString` in this scope LL | impl ToString for Test {} | ^^^^^^^^ not found in this scope | -help: possible candidates are found in other modules, you can import them into scope +help: consider importing one of these items | LL | use std::prelude::v1::ToString; | @@ -198,7 +198,7 @@ error[E0425]: cannot find function `drop` in this scope LL | drop(2) | ^^^^ not found in this scope | -help: possible candidates are found in other modules, you can import them into scope +help: consider importing one of these items | LL | use std::mem::drop; | diff --git a/src/test/ui/no-implicit-prelude.stderr b/src/test/ui/no-implicit-prelude.stderr index 8b99529f4dd7c..9cda4f64c79d0 100644 --- a/src/test/ui/no-implicit-prelude.stderr +++ b/src/test/ui/no-implicit-prelude.stderr @@ -4,7 +4,7 @@ error[E0405]: cannot find trait `Add` in this scope LL | impl Add for Test {} | ^^^ not found in this scope | -help: possible candidate is found in another module, you can import it into scope +help: consider importing this trait | LL | use std::ops::Add; | @@ -15,7 +15,7 @@ error[E0404]: expected trait, found derive macro `Clone` LL | impl Clone for Test {} | ^^^^^ not a trait | -help: possible better candidates are found in other modules, you can import them into scope +help: consider importing one of these items instead | LL | use std::clone::Clone; | @@ -28,7 +28,7 @@ error[E0405]: cannot find trait `Iterator` in this scope LL | impl Iterator for Test {} | ^^^^^^^^ not found in this scope | -help: possible candidates are found in other modules, you can import them into scope +help: consider importing one of these items | LL | use std::iter::Iterator; | @@ -41,7 +41,7 @@ error[E0405]: cannot find trait `ToString` in this scope LL | impl ToString for Test {} | ^^^^^^^^ not found in this scope | -help: possible candidates are found in other modules, you can import them into scope +help: consider importing one of these items | LL | use std::prelude::v1::ToString; | @@ -60,7 +60,7 @@ error[E0425]: cannot find function `drop` in this scope LL | drop(2) | ^^^^ not found in this scope | -help: possible candidates are found in other modules, you can import them into scope +help: consider importing one of these items | LL | use std::mem::drop; | diff --git a/src/test/ui/parser/circular_modules_main.stderr b/src/test/ui/parser/circular_modules_main.stderr index 90f81c64835b7..5d4db8c31a2c3 100644 --- a/src/test/ui/parser/circular_modules_main.stderr +++ b/src/test/ui/parser/circular_modules_main.stderr @@ -10,7 +10,7 @@ error[E0425]: cannot find function `say_hello` in module `circular_modules_hello LL | circular_modules_hello::say_hello(); | ^^^^^^^^^ not found in `circular_modules_hello` | -help: possible candidate is found in another module, you can import it into scope +help: consider importing this function | LL | use circular_modules_hello::say_hello; | diff --git a/src/test/ui/privacy/privacy-ns1.stderr b/src/test/ui/privacy/privacy-ns1.stderr index 45ca00f55ab59..4d2af735fa6b9 100644 --- a/src/test/ui/privacy/privacy-ns1.stderr +++ b/src/test/ui/privacy/privacy-ns1.stderr @@ -11,7 +11,7 @@ help: a unit struct with a similar name exists | LL | Baz(); | ^^^ -help: possible better candidates are found in other modules, you can import them into scope +help: consider importing one of these items instead | LL | use foo1::Bar; | @@ -33,7 +33,7 @@ help: a unit struct with a similar name exists | LL | Baz(); | ^^^ -help: possible candidates are found in other modules, you can import them into scope +help: consider importing one of these items | LL | use foo1::Bar; | @@ -55,7 +55,7 @@ help: a struct with a similar name exists | LL | let _x: Box; | ^^^ -help: possible candidates are found in other modules, you can import them into scope +help: consider importing one of these items | LL | use foo1::Bar; | diff --git a/src/test/ui/privacy/privacy-ns2.stderr b/src/test/ui/privacy/privacy-ns2.stderr index 0c826147a1ca7..f1aa523742ae4 100644 --- a/src/test/ui/privacy/privacy-ns2.stderr +++ b/src/test/ui/privacy/privacy-ns2.stderr @@ -4,7 +4,7 @@ error[E0423]: expected function, tuple struct or tuple variant, found trait `Bar LL | Bar(); | ^^^ not a function, tuple struct or tuple variant | -help: possible better candidates are found in other modules, you can import them into scope +help: consider importing one of these items instead | LL | use foo1::Bar; | @@ -26,7 +26,7 @@ help: a unit struct with a similar name exists | LL | Baz(); | ^^^ -help: possible better candidates are found in other modules, you can import them into scope +help: consider importing one of these items instead | LL | use foo1::Bar; | @@ -45,7 +45,7 @@ help: use `=` if you meant to assign | LL | let _x = Bar(); | ^ -help: possible better candidates are found in other modules, you can import them into scope +help: consider importing one of these items instead | LL | use foo1::Bar; | diff --git a/src/test/ui/proc-macro/attributes-on-modules-fail.stderr b/src/test/ui/proc-macro/attributes-on-modules-fail.stderr index f0ab107e15178..b37f1bd393c6f 100644 --- a/src/test/ui/proc-macro/attributes-on-modules-fail.stderr +++ b/src/test/ui/proc-macro/attributes-on-modules-fail.stderr @@ -50,7 +50,7 @@ help: a type alias with a similar name exists | LL | type A = A; | ^ -help: possible candidate is found in another module, you can import it into scope +help: consider importing this struct | LL | use Y; | @@ -65,7 +65,7 @@ help: a type alias with a similar name exists | LL | type A = A; | ^ -help: possible candidate is found in another module, you can import it into scope +help: consider importing this struct | LL | use m::X; | diff --git a/src/test/ui/proc-macro/generate-mod.stderr b/src/test/ui/proc-macro/generate-mod.stderr index 5a329639e8eee..9b946b5e2449e 100644 --- a/src/test/ui/proc-macro/generate-mod.stderr +++ b/src/test/ui/proc-macro/generate-mod.stderr @@ -4,7 +4,7 @@ error[E0412]: cannot find type `FromOutside` in this scope LL | generate_mod::check!(); | ^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope | - = note: possible candidate is found in another module, you can import it into scope: + = note: consider importing this struct: FromOutside = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) @@ -14,7 +14,7 @@ error[E0412]: cannot find type `Outer` in this scope LL | generate_mod::check!(); | ^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope | - = note: possible candidate is found in another module, you can import it into scope: + = note: consider importing this struct: Outer = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) @@ -24,7 +24,7 @@ error[E0412]: cannot find type `FromOutside` in this scope LL | #[generate_mod::check_attr] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope | - = note: possible candidate is found in another module, you can import it into scope: + = note: consider importing this struct: FromOutside = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info) @@ -34,7 +34,7 @@ error[E0412]: cannot find type `OuterAttr` in this scope LL | #[generate_mod::check_attr] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope | - = note: possible candidate is found in another module, you can import it into scope: + = note: consider importing this struct: OuterAttr = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/src/test/ui/proc-macro/mixed-site-span.stderr b/src/test/ui/proc-macro/mixed-site-span.stderr index 30a4cd7c116a6..81d2113c3b2df 100644 --- a/src/test/ui/proc-macro/mixed-site-span.stderr +++ b/src/test/ui/proc-macro/mixed-site-span.stderr @@ -27,7 +27,7 @@ LL | pass_dollar_crate!(); | ^^^^^^^^^^^^^^^^^^^^^ not found in `$crate` | = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) -help: possible candidate is found in another module, you can import it into scope +help: consider importing this struct | LL | use ItemUse; | diff --git a/src/test/ui/resolve/enums-are-namespaced-xc.stderr b/src/test/ui/resolve/enums-are-namespaced-xc.stderr index 61816709ecc5d..621686dd292d6 100644 --- a/src/test/ui/resolve/enums-are-namespaced-xc.stderr +++ b/src/test/ui/resolve/enums-are-namespaced-xc.stderr @@ -4,7 +4,7 @@ error[E0425]: cannot find value `A` in crate `namespaced_enums` LL | let _ = namespaced_enums::A; | ^ not found in `namespaced_enums` | -help: possible candidate is found in another module, you can import it into scope +help: consider importing this unit variant | LL | use namespaced_enums::Foo::A; | @@ -15,7 +15,7 @@ error[E0425]: cannot find function, tuple struct or tuple variant `B` in crate ` LL | let _ = namespaced_enums::B(10); | ^ not found in `namespaced_enums` | -help: possible candidate is found in another module, you can import it into scope +help: consider importing this tuple variant | LL | use namespaced_enums::Foo::B; | @@ -26,7 +26,7 @@ error[E0422]: cannot find struct, variant or union type `C` in crate `namespaced LL | let _ = namespaced_enums::C { a: 10 }; | ^ not found in `namespaced_enums` | -help: possible candidate is found in another module, you can import it into scope +help: consider importing this variant | LL | use namespaced_enums::Foo::C; | diff --git a/src/test/ui/resolve/issue-16058.stderr b/src/test/ui/resolve/issue-16058.stderr index 913009ce51c1a..c47d22cef5f6c 100644 --- a/src/test/ui/resolve/issue-16058.stderr +++ b/src/test/ui/resolve/issue-16058.stderr @@ -4,7 +4,7 @@ error[E0574]: expected struct, variant or union type, found enum `Result` LL | Result { | ^^^^^^ not a struct, variant or union type | -help: possible better candidates are found in other modules, you can import them into scope +help: consider importing one of these items instead | LL | use std::fmt::Result; | diff --git a/src/test/ui/resolve/issue-17518.stderr b/src/test/ui/resolve/issue-17518.stderr index 6098d4f490155..034d0d01bfb80 100644 --- a/src/test/ui/resolve/issue-17518.stderr +++ b/src/test/ui/resolve/issue-17518.stderr @@ -4,7 +4,7 @@ error[E0422]: cannot find struct, variant or union type `E` in this scope LL | E { name: "foobar" }; | ^ not found in this scope | -help: possible candidate is found in another module, you can import it into scope +help: consider importing this variant | LL | use SomeEnum::E; | diff --git a/src/test/ui/resolve/issue-21221-1.stderr b/src/test/ui/resolve/issue-21221-1.stderr index 27fd612faca9c..d3e1953435359 100644 --- a/src/test/ui/resolve/issue-21221-1.stderr +++ b/src/test/ui/resolve/issue-21221-1.stderr @@ -4,7 +4,7 @@ error[E0405]: cannot find trait `Mul` in this scope LL | impl Mul for Foo { | ^^^ not found in this scope | -help: possible candidates are found in other modules, you can import them into scope +help: consider importing one of these items | LL | use mul1::Mul; | @@ -19,7 +19,7 @@ error[E0412]: cannot find type `Mul` in this scope LL | fn getMul() -> Mul { | ^^^ not found in this scope | -help: possible candidates are found in other modules, you can import them into scope +help: consider importing one of these items | LL | use mul1::Mul; | @@ -43,7 +43,7 @@ error[E0405]: cannot find trait `Div` in this scope LL | impl Div for Foo { | ^^^ not found in this scope | -help: possible candidate is found in another module, you can import it into scope +help: consider importing this trait | LL | use std::ops::Div; | diff --git a/src/test/ui/resolve/issue-21221-2.stderr b/src/test/ui/resolve/issue-21221-2.stderr index b360fda6f9d7c..f9263d2af5026 100644 --- a/src/test/ui/resolve/issue-21221-2.stderr +++ b/src/test/ui/resolve/issue-21221-2.stderr @@ -4,7 +4,7 @@ error[E0405]: cannot find trait `T` in this scope LL | impl T for Foo { } | ^ not found in this scope | -help: possible candidate is found in another module, you can import it into scope +help: consider importing this trait | LL | use foo::bar::T; | diff --git a/src/test/ui/resolve/issue-21221-3.stderr b/src/test/ui/resolve/issue-21221-3.stderr index f2c94d467e25e..f12e5b09bacd0 100644 --- a/src/test/ui/resolve/issue-21221-3.stderr +++ b/src/test/ui/resolve/issue-21221-3.stderr @@ -4,7 +4,7 @@ error[E0405]: cannot find trait `OuterTrait` in this scope LL | impl OuterTrait for Foo {} | ^^^^^^^^^^ not found in this scope | -help: possible candidate is found in another module, you can import it into scope +help: consider importing this trait | LL | use issue_21221_3::outer::OuterTrait; | diff --git a/src/test/ui/resolve/issue-21221-4.stderr b/src/test/ui/resolve/issue-21221-4.stderr index 0b1527f91bd00..fc15444d0c0fb 100644 --- a/src/test/ui/resolve/issue-21221-4.stderr +++ b/src/test/ui/resolve/issue-21221-4.stderr @@ -4,7 +4,7 @@ error[E0405]: cannot find trait `T` in this scope LL | impl T for Foo {} | ^ not found in this scope | -help: possible candidate is found in another module, you can import it into scope +help: consider importing this trait | LL | use issue_21221_4::T; | diff --git a/src/test/ui/resolve/issue-3907.stderr b/src/test/ui/resolve/issue-3907.stderr index 16436a9accc85..4d0b0af58a320 100644 --- a/src/test/ui/resolve/issue-3907.stderr +++ b/src/test/ui/resolve/issue-3907.stderr @@ -9,7 +9,7 @@ help: you might have meant to use `#![feature(trait_alias)]` instead of a `type` | LL | type Foo = dyn issue_3907::Foo; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -help: possible better candidate is found in another module, you can import it into scope +help: consider importing this trait instead | LL | use issue_3907::Foo; | diff --git a/src/test/ui/resolve/privacy-enum-ctor.stderr b/src/test/ui/resolve/privacy-enum-ctor.stderr index 30ac783ea2f7e..d9b1b9c59558a 100644 --- a/src/test/ui/resolve/privacy-enum-ctor.stderr +++ b/src/test/ui/resolve/privacy-enum-ctor.stderr @@ -67,7 +67,7 @@ LL | let _: E = E::Struct; | ^^^^^^^^^ LL | let _: E = E::Unit; | ^^^^^^^ -help: possible better candidates are found in other modules, you can import them into scope +help: consider importing one of these items instead | LL | use std::f32::consts::E; | @@ -99,7 +99,7 @@ LL | let _: E = E::Struct; | ^^^^^^^^^ LL | let _: E = E::Unit; | ^^^^^^^ -help: possible better candidates are found in other modules, you can import them into scope +help: consider importing one of these items instead | LL | use std::f32::consts::E; | @@ -130,7 +130,7 @@ help: an enum with a similar name exists | LL | let _: E = m::n::Z; | ^ -help: possible candidate is found in another module, you can import it into scope +help: consider importing this enum | LL | use m::n::Z; | @@ -163,7 +163,7 @@ help: an enum with a similar name exists | LL | let _: E = m::n::Z::Fn; | ^ -help: possible candidate is found in another module, you can import it into scope +help: consider importing this enum | LL | use m::n::Z; | @@ -181,7 +181,7 @@ help: an enum with a similar name exists | LL | let _: E = m::n::Z::Struct; | ^ -help: possible candidate is found in another module, you can import it into scope +help: consider importing this enum | LL | use m::n::Z; | @@ -210,7 +210,7 @@ help: an enum with a similar name exists | LL | let _: E = m::n::Z::Unit {}; | ^ -help: possible candidate is found in another module, you can import it into scope +help: consider importing this enum | LL | use m::n::Z; | diff --git a/src/test/ui/resolve/privacy-struct-ctor.stderr b/src/test/ui/resolve/privacy-struct-ctor.stderr index baf7dd84eb09d..e0305b129a881 100644 --- a/src/test/ui/resolve/privacy-struct-ctor.stderr +++ b/src/test/ui/resolve/privacy-struct-ctor.stderr @@ -33,7 +33,7 @@ error[E0423]: expected value, found struct `xcrate::S` LL | xcrate::S; | ^^^^^^^^^ constructor is not visible here due to private fields | -help: possible better candidate is found in another module, you can import it into scope +help: consider importing this tuple struct instead | LL | use m::S; | diff --git a/src/test/ui/resolve/resolve-primitive-fallback.stderr b/src/test/ui/resolve/resolve-primitive-fallback.stderr index 9d381a8a94e3f..8611306e82d03 100644 --- a/src/test/ui/resolve/resolve-primitive-fallback.stderr +++ b/src/test/ui/resolve/resolve-primitive-fallback.stderr @@ -10,7 +10,7 @@ error[E0412]: cannot find type `u8` in the crate root LL | let _: ::u8; | ^^ not found in the crate root | -help: possible candidate is found in another module, you can import it into scope +help: consider importing this builtin type | LL | use std::primitive::u8; | diff --git a/src/test/ui/resolve/use_suggestion_placement.stderr b/src/test/ui/resolve/use_suggestion_placement.stderr index ef451ea847a37..9c337f515adbc 100644 --- a/src/test/ui/resolve/use_suggestion_placement.stderr +++ b/src/test/ui/resolve/use_suggestion_placement.stderr @@ -4,7 +4,7 @@ error[E0412]: cannot find type `Path` in this scope LL | type Bar = Path; | ^^^^ not found in this scope | -help: possible candidate is found in another module, you can import it into scope +help: consider importing this struct | LL | use std::path::Path; | @@ -15,7 +15,7 @@ error[E0425]: cannot find value `A` in this scope LL | let _ = A; | ^ not found in this scope | -help: possible candidate is found in another module, you can import it into scope +help: consider importing this constant | LL | use m::A; | @@ -26,7 +26,7 @@ error[E0412]: cannot find type `HashMap` in this scope LL | type Dict = HashMap; | ^^^^^^^ not found in this scope | -help: possible candidates are found in other modules, you can import them into scope +help: consider importing one of these items | LL | use std::collections::HashMap; | diff --git a/src/test/ui/rust-2018/issue-52202-use-suggestions.stderr b/src/test/ui/rust-2018/issue-52202-use-suggestions.stderr index c712fd048f191..38cd9713d1a13 100644 --- a/src/test/ui/rust-2018/issue-52202-use-suggestions.stderr +++ b/src/test/ui/rust-2018/issue-52202-use-suggestions.stderr @@ -4,7 +4,7 @@ error[E0422]: cannot find struct, variant or union type `Drain` in this scope LL | let _d = Drain {}; | ^^^^^ not found in this scope | -help: possible candidates are found in other modules, you can import them into scope +help: consider importing one of these items | LL | use crate::plumbing::Drain; | diff --git a/src/test/ui/self/self_type_keyword.stderr b/src/test/ui/self/self_type_keyword.stderr index fa603276c8eb5..7997cdc2957b4 100644 --- a/src/test/ui/self/self_type_keyword.stderr +++ b/src/test/ui/self/self_type_keyword.stderr @@ -66,7 +66,7 @@ error[E0531]: cannot find unit struct, unit variant or constant `Self` in this s LL | mut Self => (), | ^^^^ not found in this scope | -help: possible candidate is found in another module, you can import it into scope +help: consider importing this unit struct | LL | use foo::Self; | diff --git a/src/test/ui/span/issue-35987.stderr b/src/test/ui/span/issue-35987.stderr index 3245d8655e87d..2bc3ff4c3b619 100644 --- a/src/test/ui/span/issue-35987.stderr +++ b/src/test/ui/span/issue-35987.stderr @@ -4,7 +4,7 @@ error[E0404]: expected trait, found type parameter `Add` LL | impl Add for Foo { | ^^^ not a trait | -help: possible better candidate is found in another module, you can import it into scope +help: consider importing this trait instead | LL | use std::ops::Add; | diff --git a/src/test/ui/suggestions/no-extern-crate-in-type.stderr b/src/test/ui/suggestions/no-extern-crate-in-type.stderr index 22aad3b0a9f58..876eef2b6249a 100644 --- a/src/test/ui/suggestions/no-extern-crate-in-type.stderr +++ b/src/test/ui/suggestions/no-extern-crate-in-type.stderr @@ -4,7 +4,7 @@ error[E0412]: cannot find type `Foo` in this scope LL | type Output = Option; | ^^^ not found in this scope | -help: possible candidate is found in another module, you can import it into scope +help: consider importing this struct | LL | use foo::Foo; | diff --git a/src/test/ui/suggestions/raw-name-use-suggestion.stderr b/src/test/ui/suggestions/raw-name-use-suggestion.stderr index 62b76318e09b5..7447cf87ce168 100644 --- a/src/test/ui/suggestions/raw-name-use-suggestion.stderr +++ b/src/test/ui/suggestions/raw-name-use-suggestion.stderr @@ -26,7 +26,7 @@ error[E0425]: cannot find function `r#break` in this scope LL | r#break(); | ^^^^^^^ not found in this scope | -help: possible candidate is found in another module, you can import it into scope +help: consider importing this function | LL | use foo::r#break; | diff --git a/src/test/ui/use/use-super-global-path.stderr b/src/test/ui/use/use-super-global-path.stderr index 7f98ac7cd0fef..edde26c1fc15d 100644 --- a/src/test/ui/use/use-super-global-path.stderr +++ b/src/test/ui/use/use-super-global-path.stderr @@ -22,7 +22,7 @@ error[E0425]: cannot find function `main` in this scope LL | main(); | ^^^^ not found in this scope | -help: possible candidate is found in another module, you can import it into scope +help: consider importing this function | LL | use main; |