]> git.lizzy.rs Git - rust.git/blob - src/test/ui/traits/suggest-deferences/issue-62530.rs
Merge commit 'a5d597637dcb78dc73f93561ce474f23d4177c35' into clippyup
[rust.git] / src / test / ui / traits / suggest-deferences / issue-62530.rs
1 // run-rustfix
2 fn takes_str(_x: &str) {}
3
4 fn takes_type_parameter<T>(_x: T) where T: SomeTrait {}
5
6 trait SomeTrait {}
7 impl SomeTrait for &'_ str {}
8 impl SomeTrait for char {}
9
10 fn main() {
11     let string = String::new();
12     takes_str(&string);             // Ok
13     takes_type_parameter(&string);  // Error
14     //~^ ERROR the trait bound `&String: SomeTrait` is not satisfied
15 }