Skip to content

Commit 4934a9e

Browse files
committed
Tweak wording
1 parent 5796726 commit 4934a9e

10 files changed

+32
-33
lines changed

compiler/rustc_resolve/src/diagnostics.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -2484,15 +2484,14 @@ fn show_candidates(
24842484
("one of these", "items", String::new())
24852485
};
24862486

2487-
let tail = if path.len() > 1 { "..." } else { "" };
24882487
let instead = if let Instead::Yes = instead { " instead" } else { "" };
24892488
let mut msg = if let IsPattern::Yes = is_pattern {
24902489
format!(
2491-
"if you meant to match on {}{}{}, use the full path in the pattern{}",
2492-
kind, instead, name, tail
2490+
"if you meant to match on {}{}{}, use the full path in the pattern",
2491+
kind, instead, name
24932492
)
24942493
} else {
2495-
format!("consider importing {} {}{}{}", determiner, kind, instead, tail)
2494+
format!("consider importing {} {}{}", determiner, kind, instead)
24962495
};
24972496

24982497
for note in accessible_path_strings.iter().flat_map(|cand| cand.3.as_ref()) {
@@ -2523,7 +2522,7 @@ fn show_candidates(
25232522
if let [first, .., last] = &path[..] {
25242523
err.span_suggestion_verbose(
25252524
first.ident.span.until(last.ident.span),
2526-
"...and refer to it directly",
2525+
&format!("if you import `{}`, refer to it directly", last.ident),
25272526
String::new(),
25282527
Applicability::Unspecified,
25292528
);

src/test/ui/macros/macro-outer-attributes.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ error[E0425]: cannot find function `bar` in module `a`
44
LL | a::bar();
55
| ^^^ not found in `a`
66
|
7-
help: consider importing this function...
7+
help: consider importing this function
88
|
99
LL | use b::bar;
1010
|
11-
help: ...and refer to it directly
11+
help: if you import `bar`, refer to it directly
1212
|
1313
LL - a::bar();
1414
LL + bar();

src/test/ui/namespace/namespace-mix.stderr

+8-8
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ help: a tuple struct with a similar name exists
1212
|
1313
LL | check(m1::TS);
1414
| ~~
15-
help: consider importing one of these items instead...
15+
help: consider importing one of these items instead
1616
|
1717
LL | use m2::S;
1818
|
1919
LL | use xm2::S;
2020
|
21-
help: ...and refer to it directly
21+
help: if you import `S`, refer to it directly
2222
|
2323
LL - check(m1::S);
2424
LL + check(S);
@@ -40,13 +40,13 @@ help: a tuple struct with a similar name exists
4040
|
4141
LL | check(xm1::TS);
4242
| ~~
43-
help: consider importing one of these items instead...
43+
help: consider importing one of these items instead
4444
|
4545
LL | use m2::S;
4646
|
4747
LL | use xm2::S;
4848
|
49-
help: ...and refer to it directly
49+
help: if you import `S`, refer to it directly
5050
|
5151
LL - check(xm1::S);
5252
LL + check(S);
@@ -71,13 +71,13 @@ help: a tuple variant with a similar name exists
7171
|
7272
LL | check(m7::TV);
7373
| ~~
74-
help: consider importing one of these items instead...
74+
help: consider importing one of these items instead
7575
|
7676
LL | use m8::V;
7777
|
7878
LL | use xm8::V;
7979
|
80-
help: ...and refer to it directly
80+
help: if you import `V`, refer to it directly
8181
|
8282
LL - check(m7::V);
8383
LL + check(V);
@@ -104,13 +104,13 @@ help: a tuple variant with a similar name exists
104104
|
105105
LL | check(xm7::TV);
106106
| ~~
107-
help: consider importing one of these items instead...
107+
help: consider importing one of these items instead
108108
|
109109
LL | use m8::V;
110110
|
111111
LL | use xm8::V;
112112
|
113-
help: ...and refer to it directly
113+
help: if you import `V`, refer to it directly
114114
|
115115
LL - check(xm7::V);
116116
LL + check(V);

src/test/ui/parser/circular_modules_main.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ error[E0425]: cannot find function `hi_str` in module `circular_modules_main`
1010
LL | println!("{}", circular_modules_main::hi_str());
1111
| ^^^^^^ not found in `circular_modules_main`
1212
|
13-
help: consider importing this function...
13+
help: consider importing this function
1414
|
1515
LL | use hi_str;
1616
|
17-
help: ...and refer to it directly
17+
help: if you import `hi_str`, refer to it directly
1818
|
1919
LL - println!("{}", circular_modules_main::hi_str());
2020
LL + println!("{}", hi_str());

src/test/ui/resolve/enums-are-namespaced-xc.stderr

+6-6
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ error[E0425]: cannot find value `A` in crate `namespaced_enums`
44
LL | let _ = namespaced_enums::A;
55
| ^ not found in `namespaced_enums`
66
|
7-
help: consider importing this unit variant...
7+
help: consider importing this unit variant
88
|
99
LL | use namespaced_enums::Foo::A;
1010
|
11-
help: ...and refer to it directly
11+
help: if you import `A`, refer to it directly
1212
|
1313
LL - let _ = namespaced_enums::A;
1414
LL + let _ = A;
@@ -20,11 +20,11 @@ error[E0425]: cannot find function, tuple struct or tuple variant `B` in crate `
2020
LL | let _ = namespaced_enums::B(10);
2121
| ^ not found in `namespaced_enums`
2222
|
23-
help: consider importing this tuple variant...
23+
help: consider importing this tuple variant
2424
|
2525
LL | use namespaced_enums::Foo::B;
2626
|
27-
help: ...and refer to it directly
27+
help: if you import `B`, refer to it directly
2828
|
2929
LL - let _ = namespaced_enums::B(10);
3030
LL + let _ = B(10);
@@ -36,11 +36,11 @@ error[E0422]: cannot find struct, variant or union type `C` in crate `namespaced
3636
LL | let _ = namespaced_enums::C { a: 10 };
3737
| ^ not found in `namespaced_enums`
3838
|
39-
help: consider importing this variant...
39+
help: consider importing this variant
4040
|
4141
LL | use namespaced_enums::Foo::C;
4242
|
43-
help: ...and refer to it directly
43+
help: if you import `C`, refer to it directly
4444
|
4545
LL - let _ = namespaced_enums::C { a: 10 };
4646
LL + let _ = C { a: 10 };

src/test/ui/resolve/issue-50599.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ error[E0425]: cannot find value `LOG10_2` in module `std::f64`
44
LL | const M: usize = (f64::from(N) * std::f64::LOG10_2) as usize;
55
| ^^^^^^^ not found in `std::f64`
66
|
7-
help: consider importing one of these items...
7+
help: consider importing one of these items
88
|
99
LL | use std::f32::consts::LOG10_2;
1010
|
1111
LL | use std::f64::consts::LOG10_2;
1212
|
13-
help: ...and refer to it directly
13+
help: if you import `LOG10_2`, refer to it directly
1414
|
1515
LL - const M: usize = (f64::from(N) * std::f64::LOG10_2) as usize;
1616
LL + const M: usize = (f64::from(N) * LOG10_2) as usize;

src/test/ui/resolve/missing-in-namespace.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ error[E0433]: failed to resolve: could not find `hahmap` in `std`
44
LL | let _map = std::hahmap::HashMap::new();
55
| ^^^^^^^ not found in `std::hahmap`
66
|
7-
help: consider importing this struct...
7+
help: consider importing this struct
88
|
99
LL | use std::collections::HashMap;
1010
|
11-
help: ...and refer to it directly
11+
help: if you import `HashMap`, refer to it directly
1212
|
1313
LL - let _map = std::hahmap::HashMap::new();
1414
LL + let _map = HashMap::new();

src/test/ui/resolve/privacy-enum-ctor.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,13 @@ help: a function with a similar name exists
9999
|
100100
LL | let _: E = m::f;
101101
| ~
102-
help: consider importing one of these items instead...
102+
help: consider importing one of these items instead
103103
|
104104
LL | use std::f32::consts::E;
105105
|
106106
LL | use std::f64::consts::E;
107107
|
108-
help: ...and refer to it directly
108+
help: if you import `E`, refer to it directly
109109
|
110110
LL - let _: E = m::E;
111111
LL + let _: E = E;

src/test/ui/resolve/resolve-primitive-fallback.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ error[E0412]: cannot find type `u8` in the crate root
1010
LL | let _: ::u8;
1111
| ^^ not found in the crate root
1212
|
13-
help: consider importing this builtin type...
13+
help: consider importing this builtin type
1414
|
1515
LL | use std::primitive::u8;
1616
|
17-
help: ...and refer to it directly
17+
help: if you import `u8`, refer to it directly
1818
|
1919
LL - let _: ::u8;
2020
LL + let _: u8;

src/test/ui/trait-bounds/shadowed-path-in-trait-bound-suggestion.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ error[E0405]: cannot find trait `Trait` in `A`
44
LL | pub struct A<H: A::Trait>(pub H);
55
| ^^^^^ not found in `A`
66
|
7-
help: consider importing this trait...
7+
help: consider importing this trait
88
|
99
LL | use A::Trait;
1010
|
11-
help: ...and refer to it directly
11+
help: if you import `Trait`, refer to it directly
1212
|
1313
LL - pub struct A<H: A::Trait>(pub H);
1414
LL + pub struct A<H: Trait>(pub H);

0 commit comments

Comments
 (0)