]> git.lizzy.rs Git - rust.git/blob - tests/ui/suggestions/issue-84973.rs
Rollup merge of #106751 - clubby789:const-intrinsic, r=GuillaumeGomez
[rust.git] / tests / ui / suggestions / issue-84973.rs
1 // Checks whether borrowing is suggested when a trait bound is not satisfied
2 // for found type `T`, but is for `&/&mut T`.
3
4 fn main() {
5     let f = Fancy{};
6     let o = Other::new(f);
7     //~^ ERROR: the trait bound `Fancy: SomeTrait` is not satisfied [E0277]
8 }
9
10 struct Fancy {}
11
12 impl <'a> SomeTrait for &'a Fancy {
13 }
14
15 trait SomeTrait {}
16
17 struct Other<'a, G> {
18     a: &'a str,
19     g: G,
20 }
21
22 // Broadly copied from https://docs.rs/petgraph/0.5.1/src/petgraph/dot.rs.html#70
23 impl<'a, G> Other<'a, G>
24 where
25     G: SomeTrait,
26 {
27     pub fn new(g: G) -> Self {
28         Other {
29             a: "hi",
30             g: g,
31         }
32     }
33 }