11error[E0277]: the trait bound `str: From<_>` is not satisfied
2- --> $DIR/dont-suggest-borrowing-existing-borrow.rs:10 :14
2+ --> $DIR/dont-suggest-borrowing-existing-borrow.rs:14 :14
33 |
44LL | let _ = &str::from("value");
55 | ^^^ the trait `From<_>` is not implemented for `str`
@@ -17,42 +17,78 @@ LL | let _ = <&str>::from("value");
1717 | + +
1818
1919error[E0277]: the trait bound `S: Trait` is not satisfied
20- --> $DIR/dont-suggest-borrowing-existing-borrow.rs:13 :18
20+ --> $DIR/dont-suggest-borrowing-existing-borrow.rs:17 :18
2121 |
2222LL | let _ = &mut S::foo();
2323 | ^ the trait `Trait` is not implemented for `S`
2424 |
25- = help: the following other types implement trait `Trait`:
26- &S
27- &mut S
25+ = help: the trait `Trait` is implemented for `&mut S`
2826help: you likely meant to call the associated function `foo` for type `&mut S`, but the code as written calls associated function `foo` on type `S`
2927 |
3028LL | let _ = <&mut S>::foo();
3129 | + +
3230
3331error[E0277]: the trait bound `S: Trait` is not satisfied
34- --> $DIR/dont-suggest-borrowing-existing-borrow.rs:15 :14
32+ --> $DIR/dont-suggest-borrowing-existing-borrow.rs:19 :14
3533 |
3634LL | let _ = &S::foo();
3735 | ^ the trait `Trait` is not implemented for `S`
3836 |
39- = help: the following other types implement trait `Trait`:
37+ = help: the trait `Trait` is implemented for `&mut S`
38+ help: you likely meant to call the associated function `foo` for type `&S`, but the code as written calls associated function `foo` on type `S`
39+ |
40+ LL - let _ = &S::foo();
41+ LL + let _ = <&mut S>::foo();
42+ |
43+
44+ error[E0277]: the trait bound `S: Trait` is not satisfied
45+ --> $DIR/dont-suggest-borrowing-existing-borrow.rs:21:13
46+ |
47+ LL | let _ = S::foo();
48+ | ^ the trait `Trait` is not implemented for `S`
49+ |
50+ help: consider mutably borrowing here
51+ |
52+ LL | let _ = <&mut S>::foo();
53+ | +++++ +
54+
55+ error[E0277]: the trait bound `S: Trait2` is not satisfied
56+ --> $DIR/dont-suggest-borrowing-existing-borrow.rs:23:18
57+ |
58+ LL | let _ = &mut S::bar();
59+ | ^ the trait `Trait2` is not implemented for `S`
60+ |
61+ = help: the following other types implement trait `Trait2`:
4062 &S
4163 &mut S
42- help: you likely meant to call the associated function `foo` for type `&S`, but the code as written calls associated function `foo` on type `S`
64+ help: you likely meant to call the associated function `bar` for type `&mut S`, but the code as written calls associated function `bar` on type `S`
65+ |
66+ LL | let _ = <&mut S>::bar();
67+ | + +
68+
69+ error[E0277]: the trait bound `S: Trait2` is not satisfied
70+ --> $DIR/dont-suggest-borrowing-existing-borrow.rs:25:14
71+ |
72+ LL | let _ = &S::bar();
73+ | ^ the trait `Trait2` is not implemented for `S`
74+ |
75+ = help: the following other types implement trait `Trait2`:
76+ &S
77+ &mut S
78+ help: you likely meant to call the associated function `bar` for type `&S`, but the code as written calls associated function `bar` on type `S`
4379 |
44- LL | let _ = <&S>::foo ();
80+ LL | let _ = <&S>::bar ();
4581 | + +
4682
4783error[E0277]: the size for values of type `str` cannot be known at compilation time
48- --> $DIR/dont-suggest-borrowing-existing-borrow.rs:10 :14
84+ --> $DIR/dont-suggest-borrowing-existing-borrow.rs:14 :14
4985 |
5086LL | let _ = &str::from("value");
5187 | ^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
5288 |
5389 = help: the trait `Sized` is not implemented for `str`
5490 = note: the return type of a function must have a statically known size
5591
56- error: aborting due to 4 previous errors
92+ error: aborting due to 7 previous errors
5793
5894For more information about this error, try `rustc --explain E0277`.
0 commit comments