Skip to content

Commit 8621285

Browse files
reword message to be less vague
1 parent eb76764 commit 8621285

11 files changed

+23
-23
lines changed

compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4029,15 +4029,15 @@ fn hint_missing_borrow<'tcx>(
40294029

40304030
if !to_borrow.is_empty() {
40314031
err.multipart_suggestion_verbose(
4032-
"consider borrowing the argument",
4032+
"consider adjusting the signature so it borrows its argument",
40334033
to_borrow,
40344034
Applicability::MaybeIncorrect,
40354035
);
40364036
}
40374037

40384038
if !remove_borrow.is_empty() {
40394039
err.multipart_suggestion_verbose(
4040-
"do not borrow the argument",
4040+
"consider adjusting the signature so it does not borrow its argument",
40414041
remove_borrow,
40424042
Applicability::MaybeIncorrect,
40434043
);

tests/ui/anonymous-higher-ranked-lifetime.stderr

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ note: required by a bound in `f1`
1313
|
1414
LL | fn f1<F>(_: F) where F: Fn(&(), &()) {}
1515
| ^^^^^^^^^^^^ required by this bound in `f1`
16-
help: consider borrowing the argument
16+
help: consider adjusting the signature so it borrows its argument
1717
|
1818
LL | f1(|_: &(), _: &()| {});
1919
| + +
@@ -33,7 +33,7 @@ note: required by a bound in `f2`
3333
|
3434
LL | fn f2<F>(_: F) where F: for<'a> Fn(&'a (), &()) {}
3535
| ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `f2`
36-
help: consider borrowing the argument
36+
help: consider adjusting the signature so it borrows its argument
3737
|
3838
LL | f2(|_: &(), _: &()| {});
3939
| + +
@@ -53,7 +53,7 @@ note: required by a bound in `f3`
5353
|
5454
LL | fn f3<'a, F>(_: F) where F: Fn(&'a (), &()) {}
5555
| ^^^^^^^^^^^^^^^ required by this bound in `f3`
56-
help: consider borrowing the argument
56+
help: consider adjusting the signature so it borrows its argument
5757
|
5858
LL | f3(|_: &(), _: &()| {});
5959
| + +
@@ -73,7 +73,7 @@ note: required by a bound in `f4`
7373
|
7474
LL | fn f4<F>(_: F) where F: for<'r> Fn(&(), &'r ()) {}
7575
| ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `f4`
76-
help: consider borrowing the argument
76+
help: consider adjusting the signature so it borrows its argument
7777
|
7878
LL | f4(|_: &(), _: &()| {});
7979
| + +
@@ -93,7 +93,7 @@ note: required by a bound in `f5`
9393
|
9494
LL | fn f5<F>(_: F) where F: for<'r> Fn(&'r (), &'r ()) {}
9595
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `f5`
96-
help: consider borrowing the argument
96+
help: consider adjusting the signature so it borrows its argument
9797
|
9898
LL | f5(|_: &(), _: &()| {});
9999
| + +
@@ -113,7 +113,7 @@ note: required by a bound in `g1`
113113
|
114114
LL | fn g1<F>(_: F) where F: Fn(&(), Box<dyn Fn(&())>) {}
115115
| ^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `g1`
116-
help: consider borrowing the argument
116+
help: consider adjusting the signature so it borrows its argument
117117
|
118118
LL | g1(|_: &(), _: ()| {});
119119
| +
@@ -133,7 +133,7 @@ note: required by a bound in `g2`
133133
|
134134
LL | fn g2<F>(_: F) where F: Fn(&(), fn(&())) {}
135135
| ^^^^^^^^^^^^^^^^ required by this bound in `g2`
136-
help: consider borrowing the argument
136+
help: consider adjusting the signature so it borrows its argument
137137
|
138138
LL | g2(|_: &(), _: ()| {});
139139
| +
@@ -153,7 +153,7 @@ note: required by a bound in `g3`
153153
|
154154
LL | fn g3<F>(_: F) where F: for<'s> Fn(&'s (), Box<dyn Fn(&())>) {}
155155
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `g3`
156-
help: consider borrowing the argument
156+
help: consider adjusting the signature so it borrows its argument
157157
|
158158
LL | g3(|_: &(), _: ()| {});
159159
| +
@@ -173,7 +173,7 @@ note: required by a bound in `g4`
173173
|
174174
LL | fn g4<F>(_: F) where F: Fn(&(), for<'r> fn(&'r ())) {}
175175
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `g4`
176-
help: consider borrowing the argument
176+
help: consider adjusting the signature so it borrows its argument
177177
|
178178
LL | g4(|_: &(), _: ()| {});
179179
| +
@@ -193,7 +193,7 @@ note: required by a bound in `h1`
193193
|
194194
LL | fn h1<F>(_: F) where F: Fn(&(), Box<dyn Fn(&())>, &(), fn(&(), &())) {}
195195
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `h1`
196-
help: consider borrowing the argument
196+
help: consider adjusting the signature so it borrows its argument
197197
|
198198
LL | h1(|_: &(), _: (), _: &(), _: ()| {});
199199
| + +
@@ -213,7 +213,7 @@ note: required by a bound in `h2`
213213
|
214214
LL | fn h2<F>(_: F) where F: for<'t0> Fn(&(), Box<dyn Fn(&())>, &'t0 (), fn(&(), &())) {}
215215
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `h2`
216-
help: consider borrowing the argument
216+
help: consider adjusting the signature so it borrows its argument
217217
|
218218
LL | h2(|_: &(), _: (), _: &(), _: ()| {});
219219
| + +

tests/ui/closures/multiple-fn-bounds.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ note: required by a bound in `foo`
1818
|
1919
LL | fn foo<F: Fn(&char) -> bool + Fn(char) -> bool>(f: F) {
2020
| ^^^^^^^^^^^^^^^^ required by this bound in `foo`
21-
help: do not borrow the argument
21+
help: consider adjusting the signature so it does not borrow its argument
2222
|
2323
LL | foo(move |char| v);
2424
| ~~~~

tests/ui/mismatched_types/closure-arg-type-mismatch-issue-45727.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ LL | let _ = (-10..=10).find(|x: i32| x.signum() == 0);
1010
found closure signature `fn(i32) -> _`
1111
note: required by a bound in `find`
1212
--> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
13-
help: consider borrowing the argument
13+
help: consider adjusting the signature so it borrows its argument
1414
|
1515
LL | let _ = (-10..=10).find(|x: &i32| x.signum() == 0);
1616
| +
@@ -27,7 +27,7 @@ LL | let _ = (-10..=10).find(|x: &&&i32| x.signum() == 0);
2727
found closure signature `for<'a, 'b, 'c> fn(&'a &'b &'c i32) -> _`
2828
note: required by a bound in `find`
2929
--> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
30-
help: do not borrow the argument
30+
help: consider adjusting the signature so it does not borrow its argument
3131
|
3232
LL - let _ = (-10..=10).find(|x: &&&i32| x.signum() == 0);
3333
LL + let _ = (-10..=10).find(|x: &i32| x.signum() == 0);

tests/ui/mismatched_types/closure-arg-type-mismatch.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ LL | a.iter().map(|_: (u32, u32)| 45);
1010
found closure signature `fn((u32, u32)) -> _`
1111
note: required by a bound in `map`
1212
--> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
13-
help: consider borrowing the argument
13+
help: consider adjusting the signature so it borrows its argument
1414
|
1515
LL | a.iter().map(|_: &(u32, u32)| 45);
1616
| +

tests/ui/mismatched_types/issue-36053-2.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ LL | once::<&str>("str").fuse().filter(|a: &str| true).count();
1010
found closure signature `for<'a> fn(&'a str) -> _`
1111
note: required by a bound in `filter`
1212
--> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
13-
help: consider borrowing the argument
13+
help: consider adjusting the signature so it borrows its argument
1414
|
1515
LL | once::<&str>("str").fuse().filter(|a: &&str| true).count();
1616
| +

tests/ui/mismatched_types/suggest-option-asderef-inference-var.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ LL | let _has_inference_vars: Option<i32> = Some(0).map(deref_int);
1313
found function signature `for<'a> fn(&'a i32) -> _`
1414
note: required by a bound in `Option::<T>::map`
1515
--> $SRC_DIR/core/src/option.rs:LL:COL
16-
help: do not borrow the argument
16+
help: consider adjusting the signature so it does not borrow its argument
1717
|
1818
LL - fn deref_int(a: &i32) -> i32 {
1919
LL + fn deref_int(a: i32) -> i32 {

tests/ui/mismatched_types/suggest-option-asderef.fixed

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ fn generic<T>(_: T) -> Option<()> {
1717
}
1818

1919
fn generic_ref<T>(_: T) -> Option<()> {
20-
//~^ HELP do not borrow the argument
20+
//~^ HELP consider adjusting the signature so it does not borrow its argument
2121
Some(())
2222
}
2323

tests/ui/mismatched_types/suggest-option-asderef.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ fn generic<T>(_: T) -> Option<()> {
1717
}
1818

1919
fn generic_ref<T>(_: &T) -> Option<()> {
20-
//~^ HELP do not borrow the argument
20+
//~^ HELP consider adjusting the signature so it does not borrow its argument
2121
Some(())
2222
}
2323

tests/ui/mismatched_types/suggest-option-asderef.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ LL | let _ = produces_string().and_then(generic_ref);
7373
found function signature `for<'a> fn(&'a _) -> _`
7474
note: required by a bound in `Option::<T>::and_then`
7575
--> $SRC_DIR/core/src/option.rs:LL:COL
76-
help: do not borrow the argument
76+
help: consider adjusting the signature so it does not borrow its argument
7777
|
7878
LL - fn generic_ref<T>(_: &T) -> Option<()> {
7979
LL + fn generic_ref<T>(_: T) -> Option<()> {

tests/ui/suggestions/late-bound-in-borrow-closure-sugg.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ note: required by a bound in `Trader::<'a>::set_closure`
1616
|
1717
LL | pub fn set_closure(&mut self, function: impl Fn(&mut Trader) + 'a) {
1818
| ^^^^^^^^^^^^^^^ required by this bound in `Trader::<'a>::set_closure`
19-
help: consider borrowing the argument
19+
help: consider adjusting the signature so it borrows its argument
2020
|
2121
LL | let closure = |trader : &mut Trader| {
2222
| ++++

0 commit comments

Comments
 (0)