diff options
| author | Esteban Kuber <esteban@kuber.com.ar> | 2022-05-03 02:07:47 +0000 |
|---|---|---|
| committer | Esteban Kuber <esteban@kuber.com.ar> | 2022-05-03 02:07:47 +0000 |
| commit | 4934a9e6430b3fcb98f77205f8a625c7ffebd628 (patch) | |
| tree | ab443e88b33dbc08a833687049cf89ff886cd415 | |
| parent | 57967269e9946945dedd360e8e8654f5dd76ebd1 (diff) | |
| download | rust-4934a9e6430b3fcb98f77205f8a625c7ffebd628.tar.gz rust-4934a9e6430b3fcb98f77205f8a625c7ffebd628.zip | |
Tweak wording
| -rw-r--r-- | compiler/rustc_resolve/src/diagnostics.rs | 9 | ||||
| -rw-r--r-- | src/test/ui/macros/macro-outer-attributes.stderr | 4 | ||||
| -rw-r--r-- | src/test/ui/namespace/namespace-mix.stderr | 16 | ||||
| -rw-r--r-- | src/test/ui/parser/circular_modules_main.stderr | 4 | ||||
| -rw-r--r-- | src/test/ui/resolve/enums-are-namespaced-xc.stderr | 12 | ||||
| -rw-r--r-- | src/test/ui/resolve/issue-50599.stderr | 4 | ||||
| -rw-r--r-- | src/test/ui/resolve/missing-in-namespace.stderr | 4 | ||||
| -rw-r--r-- | src/test/ui/resolve/privacy-enum-ctor.stderr | 4 | ||||
| -rw-r--r-- | src/test/ui/resolve/resolve-primitive-fallback.stderr | 4 | ||||
| -rw-r--r-- | src/test/ui/trait-bounds/shadowed-path-in-trait-bound-suggestion.stderr | 4 |
10 files changed, 32 insertions, 33 deletions
diff --git a/compiler/rustc_resolve/src/diagnostics.rs b/compiler/rustc_resolve/src/diagnostics.rs index f75ea583d85..5d80f49626a 100644 --- a/compiler/rustc_resolve/src/diagnostics.rs +++ b/compiler/rustc_resolve/src/diagnostics.rs @@ -2484,15 +2484,14 @@ fn show_candidates( ("one of these", "items", String::new()) }; - let tail = if path.len() > 1 { "..." } else { "" }; let instead = if let Instead::Yes = instead { " instead" } else { "" }; let mut msg = if let IsPattern::Yes = is_pattern { format!( - "if you meant to match on {}{}{}, use the full path in the pattern{}", - kind, instead, name, tail + "if you meant to match on {}{}{}, use the full path in the pattern", + kind, instead, name ) } else { - format!("consider importing {} {}{}{}", determiner, kind, instead, tail) + format!("consider importing {} {}{}", determiner, kind, instead) }; for note in accessible_path_strings.iter().flat_map(|cand| cand.3.as_ref()) { @@ -2523,7 +2522,7 @@ fn show_candidates( if let [first, .., last] = &path[..] { err.span_suggestion_verbose( first.ident.span.until(last.ident.span), - "...and refer to it directly", + &format!("if you import `{}`, refer to it directly", last.ident), String::new(), Applicability::Unspecified, ); diff --git a/src/test/ui/macros/macro-outer-attributes.stderr b/src/test/ui/macros/macro-outer-attributes.stderr index a9fb79b7b27..91073d3698d 100644 --- a/src/test/ui/macros/macro-outer-attributes.stderr +++ b/src/test/ui/macros/macro-outer-attributes.stderr @@ -4,11 +4,11 @@ error[E0425]: cannot find function `bar` in module `a` LL | a::bar(); | ^^^ not found in `a` | -help: consider importing this function... +help: consider importing this function | LL | use b::bar; | -help: ...and refer to it directly +help: if you import `bar`, refer to it directly | LL - a::bar(); LL + bar(); diff --git a/src/test/ui/namespace/namespace-mix.stderr b/src/test/ui/namespace/namespace-mix.stderr index dd9c969fc82..037a858d7e1 100644 --- a/src/test/ui/namespace/namespace-mix.stderr +++ b/src/test/ui/namespace/namespace-mix.stderr @@ -12,13 +12,13 @@ help: a tuple struct with a similar name exists | LL | check(m1::TS); | ~~ -help: consider importing one of these items instead... +help: consider importing one of these items instead | LL | use m2::S; | LL | use xm2::S; | -help: ...and refer to it directly +help: if you import `S`, refer to it directly | LL - check(m1::S); LL + check(S); @@ -40,13 +40,13 @@ help: a tuple struct with a similar name exists | LL | check(xm1::TS); | ~~ -help: consider importing one of these items instead... +help: consider importing one of these items instead | LL | use m2::S; | LL | use xm2::S; | -help: ...and refer to it directly +help: if you import `S`, refer to it directly | LL - check(xm1::S); LL + check(S); @@ -71,13 +71,13 @@ help: a tuple variant with a similar name exists | LL | check(m7::TV); | ~~ -help: consider importing one of these items instead... +help: consider importing one of these items instead | LL | use m8::V; | LL | use xm8::V; | -help: ...and refer to it directly +help: if you import `V`, refer to it directly | LL - check(m7::V); LL + check(V); @@ -104,13 +104,13 @@ help: a tuple variant with a similar name exists | LL | check(xm7::TV); | ~~ -help: consider importing one of these items instead... +help: consider importing one of these items instead | LL | use m8::V; | LL | use xm8::V; | -help: ...and refer to it directly +help: if you import `V`, refer to it directly | LL - check(xm7::V); LL + check(V); diff --git a/src/test/ui/parser/circular_modules_main.stderr b/src/test/ui/parser/circular_modules_main.stderr index f6f3babc2d5..c5434c72b38 100644 --- a/src/test/ui/parser/circular_modules_main.stderr +++ b/src/test/ui/parser/circular_modules_main.stderr @@ -10,11 +10,11 @@ error[E0425]: cannot find function `hi_str` in module `circular_modules_main` LL | println!("{}", circular_modules_main::hi_str()); | ^^^^^^ not found in `circular_modules_main` | -help: consider importing this function... +help: consider importing this function | LL | use hi_str; | -help: ...and refer to it directly +help: if you import `hi_str`, refer to it directly | LL - println!("{}", circular_modules_main::hi_str()); LL + println!("{}", hi_str()); diff --git a/src/test/ui/resolve/enums-are-namespaced-xc.stderr b/src/test/ui/resolve/enums-are-namespaced-xc.stderr index f501683ebc9..1d26a2c0058 100644 --- a/src/test/ui/resolve/enums-are-namespaced-xc.stderr +++ b/src/test/ui/resolve/enums-are-namespaced-xc.stderr @@ -4,11 +4,11 @@ error[E0425]: cannot find value `A` in crate `namespaced_enums` LL | let _ = namespaced_enums::A; | ^ not found in `namespaced_enums` | -help: consider importing this unit variant... +help: consider importing this unit variant | LL | use namespaced_enums::Foo::A; | -help: ...and refer to it directly +help: if you import `A`, refer to it directly | LL - let _ = namespaced_enums::A; LL + let _ = A; @@ -20,11 +20,11 @@ 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: consider importing this tuple variant... +help: consider importing this tuple variant | LL | use namespaced_enums::Foo::B; | -help: ...and refer to it directly +help: if you import `B`, refer to it directly | LL - let _ = namespaced_enums::B(10); LL + let _ = B(10); @@ -36,11 +36,11 @@ 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: consider importing this variant... +help: consider importing this variant | LL | use namespaced_enums::Foo::C; | -help: ...and refer to it directly +help: if you import `C`, refer to it directly | LL - let _ = namespaced_enums::C { a: 10 }; LL + let _ = C { a: 10 }; diff --git a/src/test/ui/resolve/issue-50599.stderr b/src/test/ui/resolve/issue-50599.stderr index ef0b30d98d8..4cc035cb11e 100644 --- a/src/test/ui/resolve/issue-50599.stderr +++ b/src/test/ui/resolve/issue-50599.stderr @@ -4,13 +4,13 @@ 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: consider importing one of these items... +help: consider importing one of these items | LL | use std::f32::consts::LOG10_2; | LL | use std::f64::consts::LOG10_2; | -help: ...and refer to it directly +help: if you import `LOG10_2`, refer to it directly | LL - const M: usize = (f64::from(N) * std::f64::LOG10_2) as usize; LL + const M: usize = (f64::from(N) * LOG10_2) as usize; diff --git a/src/test/ui/resolve/missing-in-namespace.stderr b/src/test/ui/resolve/missing-in-namespace.stderr index 265f370494a..338a5423aa4 100644 --- a/src/test/ui/resolve/missing-in-namespace.stderr +++ b/src/test/ui/resolve/missing-in-namespace.stderr @@ -4,11 +4,11 @@ error[E0433]: failed to resolve: could not find `hahmap` in `std` LL | let _map = std::hahmap::HashMap::new(); | ^^^^^^^ not found in `std::hahmap` | -help: consider importing this struct... +help: consider importing this struct | LL | use std::collections::HashMap; | -help: ...and refer to it directly +help: if you import `HashMap`, refer to it directly | LL - let _map = std::hahmap::HashMap::new(); LL + let _map = HashMap::new(); diff --git a/src/test/ui/resolve/privacy-enum-ctor.stderr b/src/test/ui/resolve/privacy-enum-ctor.stderr index 4ac18c0e795..ed89170fd8a 100644 --- a/src/test/ui/resolve/privacy-enum-ctor.stderr +++ b/src/test/ui/resolve/privacy-enum-ctor.stderr @@ -99,13 +99,13 @@ help: a function with a similar name exists | LL | let _: E = m::f; | ~ -help: consider importing one of these items instead... +help: consider importing one of these items instead | LL | use std::f32::consts::E; | LL | use std::f64::consts::E; | -help: ...and refer to it directly +help: if you import `E`, refer to it directly | LL - let _: E = m::E; LL + let _: E = E; diff --git a/src/test/ui/resolve/resolve-primitive-fallback.stderr b/src/test/ui/resolve/resolve-primitive-fallback.stderr index 3db3706ecf5..fcbc28475f9 100644 --- a/src/test/ui/resolve/resolve-primitive-fallback.stderr +++ b/src/test/ui/resolve/resolve-primitive-fallback.stderr @@ -10,11 +10,11 @@ error[E0412]: cannot find type `u8` in the crate root LL | let _: ::u8; | ^^ not found in the crate root | -help: consider importing this builtin type... +help: consider importing this builtin type | LL | use std::primitive::u8; | -help: ...and refer to it directly +help: if you import `u8`, refer to it directly | LL - let _: ::u8; LL + let _: u8; diff --git a/src/test/ui/trait-bounds/shadowed-path-in-trait-bound-suggestion.stderr b/src/test/ui/trait-bounds/shadowed-path-in-trait-bound-suggestion.stderr index 413a0c8d60e..a8b275f9803 100644 --- a/src/test/ui/trait-bounds/shadowed-path-in-trait-bound-suggestion.stderr +++ b/src/test/ui/trait-bounds/shadowed-path-in-trait-bound-suggestion.stderr @@ -4,11 +4,11 @@ error[E0405]: cannot find trait `Trait` in `A` LL | pub struct A<H: A::Trait>(pub H); | ^^^^^ not found in `A` | -help: consider importing this trait... +help: consider importing this trait | LL | use A::Trait; | -help: ...and refer to it directly +help: if you import `Trait`, refer to it directly | LL - pub struct A<H: A::Trait>(pub H); LL + pub struct A<H: Trait>(pub H); |
