Skip to content

Commit 13b61b5

Browse files
author
Alexander Regueiro
committed
Fixed grammar in one diagnostic and blessed tests.
1 parent 8a4af2f commit 13b61b5

16 files changed

+43
-39
lines changed

src/librustc_typeck/check/method/suggest.rs

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -631,26 +631,30 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
631631
}
632632
}
633633

634-
fn suggest_valid_traits(&self,
635-
err: &mut DiagnosticBuilder<'_>,
636-
valid_out_of_scope_traits: Vec<DefId>) -> bool {
634+
fn suggest_valid_traits(
635+
&self,
636+
err: &mut DiagnosticBuilder<'_>,
637+
valid_out_of_scope_traits: Vec<DefId>,
638+
) -> bool {
637639
if !valid_out_of_scope_traits.is_empty() {
638640
let mut candidates = valid_out_of_scope_traits;
639641
candidates.sort();
640642
candidates.dedup();
641643
err.help("items from traits can only be used if the trait is in scope");
642-
let msg = format!("the following {traits_are} implemented but not in scope, \
643-
perhaps add a `use` for {one_of_them}:",
644-
traits_are = if candidates.len() == 1 {
645-
"trait is"
646-
} else {
647-
"traits are"
648-
},
649-
one_of_them = if candidates.len() == 1 {
650-
"it"
651-
} else {
652-
"one of them"
653-
});
644+
let msg = format!(
645+
"the following {traits_are} implemented but not in scope; \
646+
perhaps add a `use` for {one_of_them}:",
647+
traits_are = if candidates.len() == 1 {
648+
"trait is"
649+
} else {
650+
"traits are"
651+
},
652+
one_of_them = if candidates.len() == 1 {
653+
"it"
654+
} else {
655+
"one of them"
656+
},
657+
);
654658

655659
self.suggest_use_candidates(err, msg, candidates);
656660
true

src/test/ui/coherence/coherence_inherent.old.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | s.the_fn();
55
| ^^^^^^ method not found in `&Lib::TheStruct`
66
|
77
= help: items from traits can only be used if the trait is in scope
8-
= note: the following trait is implemented but not in scope, perhaps add a `use` for it:
8+
= note: the following trait is implemented but not in scope; perhaps add a `use` for it:
99
`use Lib::TheTrait;`
1010

1111
error: aborting due to previous error

src/test/ui/coherence/coherence_inherent.re.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | s.the_fn();
55
| ^^^^^^ method not found in `&Lib::TheStruct`
66
|
77
= help: items from traits can only be used if the trait is in scope
8-
= note: the following trait is implemented but not in scope, perhaps add a `use` for it:
8+
= note: the following trait is implemented but not in scope; perhaps add a `use` for it:
99
`use Lib::TheTrait;`
1010

1111
error: aborting due to previous error

src/test/ui/coherence/coherence_inherent_cc.old.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | s.the_fn();
55
| ^^^^^^ method not found in `&coherence_inherent_cc_lib::TheStruct`
66
|
77
= help: items from traits can only be used if the trait is in scope
8-
= note: the following trait is implemented but not in scope, perhaps add a `use` for it:
8+
= note: the following trait is implemented but not in scope; perhaps add a `use` for it:
99
`use coherence_inherent_cc_lib::TheTrait;`
1010

1111
error: aborting due to previous error

src/test/ui/coherence/coherence_inherent_cc.re.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | s.the_fn();
55
| ^^^^^^ method not found in `&coherence_inherent_cc_lib::TheStruct`
66
|
77
= help: items from traits can only be used if the trait is in scope
8-
= note: the following trait is implemented but not in scope, perhaps add a `use` for it:
8+
= note: the following trait is implemented but not in scope; perhaps add a `use` for it:
99
`use coherence_inherent_cc_lib::TheTrait;`
1010

1111
error: aborting due to previous error

src/test/ui/hygiene/no_implicit_prelude.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ LL | ().clone()
2525
| ^^^^^ method not found in `()`
2626
|
2727
= help: items from traits can only be used if the trait is in scope
28-
= note: the following trait is implemented but not in scope, perhaps add a `use` for it:
28+
= note: the following trait is implemented but not in scope; perhaps add a `use` for it:
2929
`use std::clone::Clone;`
3030

3131
error: aborting due to 3 previous errors

src/test/ui/hygiene/trait_items.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ LL | pub macro m() { ().f() }
88
| ^ method not found in `()`
99
|
1010
= help: items from traits can only be used if the trait is in scope
11-
= note: the following trait is implemented but not in scope, perhaps add a `use` for it:
11+
= note: the following trait is implemented but not in scope; perhaps add a `use` for it:
1212
`use foo::T;`
1313

1414
error: aborting due to previous error

src/test/ui/impl-trait/no-method-suggested-traits.stderr

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | 1u32.method();
55
| ^^^^^^ method not found in `u32`
66
|
77
= help: items from traits can only be used if the trait is in scope
8-
help: the following traits are implemented but not in scope, perhaps add a `use` for one of them:
8+
help: the following traits are implemented but not in scope; perhaps add a `use` for one of them:
99
|
1010
LL | use foo::Bar;
1111
|
@@ -23,7 +23,7 @@ LL | std::rc::Rc::new(&mut Box::new(&1u32)).method();
2323
| ^^^^^^ method not found in `std::rc::Rc<&mut std::boxed::Box<&u32>>`
2424
|
2525
= help: items from traits can only be used if the trait is in scope
26-
help: the following traits are implemented but not in scope, perhaps add a `use` for one of them:
26+
help: the following traits are implemented but not in scope; perhaps add a `use` for one of them:
2727
|
2828
LL | use foo::Bar;
2929
|
@@ -41,7 +41,7 @@ LL | 'a'.method();
4141
| ^^^^^^ method not found in `char`
4242
|
4343
= help: items from traits can only be used if the trait is in scope
44-
help: the following trait is implemented but not in scope, perhaps add a `use` for it:
44+
help: the following trait is implemented but not in scope; perhaps add a `use` for it:
4545
|
4646
LL | use foo::Bar;
4747
|
@@ -61,7 +61,7 @@ LL | std::rc::Rc::new(&mut Box::new(&'a')).method();
6161
| ^^^^^^ method not found in `std::rc::Rc<&mut std::boxed::Box<&char>>`
6262
|
6363
= help: items from traits can only be used if the trait is in scope
64-
help: the following trait is implemented but not in scope, perhaps add a `use` for it:
64+
help: the following trait is implemented but not in scope; perhaps add a `use` for it:
6565
|
6666
LL | use foo::Bar;
6767
|
@@ -73,7 +73,7 @@ LL | 1i32.method();
7373
| ^^^^^^ method not found in `i32`
7474
|
7575
= help: items from traits can only be used if the trait is in scope
76-
help: the following trait is implemented but not in scope, perhaps add a `use` for it:
76+
help: the following trait is implemented but not in scope; perhaps add a `use` for it:
7777
|
7878
LL | use no_method_suggested_traits::foo::PubPub;
7979
|
@@ -85,7 +85,7 @@ LL | std::rc::Rc::new(&mut Box::new(&1i32)).method();
8585
| ^^^^^^ method not found in `std::rc::Rc<&mut std::boxed::Box<&i32>>`
8686
|
8787
= help: items from traits can only be used if the trait is in scope
88-
help: the following trait is implemented but not in scope, perhaps add a `use` for it:
88+
help: the following trait is implemented but not in scope; perhaps add a `use` for it:
8989
|
9090
LL | use no_method_suggested_traits::foo::PubPub;
9191
|

src/test/ui/issues/issue-10465.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | b.foo();
55
| ^^^ method not found in `&b::B`
66
|
77
= help: items from traits can only be used if the trait is in scope
8-
= note: the following trait is implemented but not in scope, perhaps add a `use` for it:
8+
= note: the following trait is implemented but not in scope; perhaps add a `use` for it:
99
`use a::A;`
1010

1111
error: aborting due to previous error

src/test/ui/issues/issue-39175.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | Command::new("echo").arg("hello").exec();
55
| ^^^^ method not found in `&mut std::process::Command`
66
|
77
= help: items from traits can only be used if the trait is in scope
8-
help: the following trait is implemented but not in scope, perhaps add a `use` for it:
8+
help: the following trait is implemented but not in scope; perhaps add a `use` for it:
99
|
1010
LL | use std::os::unix::process::CommandExt;
1111
|

src/test/ui/issues/issue-43189.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | ().a();
55
| ^ method not found in `()`
66
|
77
= help: items from traits can only be used if the trait is in scope
8-
help: the following trait is implemented but not in scope, perhaps add a `use` for it:
8+
help: the following trait is implemented but not in scope; perhaps add a `use` for it:
99
|
1010
LL | use xcrate_issue_43189_b::xcrate_issue_43189_a::A;
1111
|

src/test/ui/rust-2018/trait-import-suggestions.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | x.foobar();
55
| ^^^^^^ method not found in `u32`
66
|
77
= help: items from traits can only be used if the trait is in scope
8-
= note: the following trait is implemented but not in scope, perhaps add a `use` for it:
8+
= note: the following trait is implemented but not in scope; perhaps add a `use` for it:
99
`use crate::foo::foobar::Foobar;`
1010

1111
error[E0599]: no method named `bar` found for type `u32` in the current scope
@@ -15,7 +15,7 @@ LL | x.bar();
1515
| ^^^ method not found in `u32`
1616
|
1717
= help: items from traits can only be used if the trait is in scope
18-
help: the following trait is implemented but not in scope, perhaps add a `use` for it:
18+
help: the following trait is implemented but not in scope; perhaps add a `use` for it:
1919
|
2020
LL | use crate::foo::Bar;
2121
|
@@ -33,7 +33,7 @@ LL | let y = u32::from_str("33");
3333
| ^^^^^^^^ function or associated item not found in `u32`
3434
|
3535
= help: items from traits can only be used if the trait is in scope
36-
help: the following trait is implemented but not in scope, perhaps add a `use` for it:
36+
help: the following trait is implemented but not in scope; perhaps add a `use` for it:
3737
|
3838
LL | use std::str::FromStr;
3939
|

src/test/ui/shadowed/shadowed-trait-methods.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | ().f()
55
| ^ method not found in `()`
66
|
77
= help: items from traits can only be used if the trait is in scope
8-
help: the following trait is implemented but not in scope, perhaps add a `use` for it:
8+
help: the following trait is implemented but not in scope; perhaps add a `use` for it:
99
|
1010
LL | use foo::T;
1111
|

src/test/ui/traits/trait-item-privacy.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ LL | S.b();
2828
| ^ method not found in `S`
2929
|
3030
= help: items from traits can only be used if the trait is in scope
31-
help: the following trait is implemented but not in scope, perhaps add a `use` for it:
31+
help: the following trait is implemented but not in scope; perhaps add a `use` for it:
3232
|
3333
LL | use method::B;
3434
|
@@ -62,7 +62,7 @@ LL | S::b(&S);
6262
| ^ function or associated item not found in `S`
6363
|
6464
= help: items from traits can only be used if the trait is in scope
65-
help: the following trait is implemented but not in scope, perhaps add a `use` for it:
65+
help: the following trait is implemented but not in scope; perhaps add a `use` for it:
6666
|
6767
LL | use method::B;
6868
|
@@ -96,7 +96,7 @@ LL | S::B;
9696
| ^ associated item not found in `S`
9797
|
9898
= help: items from traits can only be used if the trait is in scope
99-
help: the following trait is implemented but not in scope, perhaps add a `use` for it:
99+
help: the following trait is implemented but not in scope; perhaps add a `use` for it:
100100
|
101101
LL | use assoc_const::B;
102102
|

src/test/ui/traits/trait-method-private.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | foo.method();
55
| ^^^^^^
66
|
77
= help: items from traits can only be used if the trait is in scope
8-
help: the following trait is implemented but not in scope, perhaps add a `use` for it:
8+
help: the following trait is implemented but not in scope; perhaps add a `use` for it:
99
|
1010
LL | use inner::Bar;
1111
|

src/test/ui/underscore-imports/shadow.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | x.deref();
55
| ^^^^^ method not found in `&()`
66
|
77
= help: items from traits can only be used if the trait is in scope
8-
= note: the following trait is implemented but not in scope, perhaps add a `use` for it:
8+
= note: the following trait is implemented but not in scope; perhaps add a `use` for it:
99
`use std::ops::Deref;`
1010

1111
error: aborting due to previous error

0 commit comments

Comments
 (0)