]> git.lizzy.rs Git - rust.git/blob - tests/ui/suggestions/issue-84973-negative.rs
Rollup merge of #106670 - albertlarsan68:check-docs-in-pr-ci, r=Mark-Simulacrum
[rust.git] / tests / ui / suggestions / issue-84973-negative.rs
1 // Checks that we only suggest borrowing if &T actually implements the trait.
2
3 trait Tr {}
4 impl Tr for &f32 {}
5 fn bar<T: Tr>(t: T) {}
6
7 fn main() {
8     let a = 0i32;
9     let b = 0.0f32;
10     bar(a); //~ ERROR: the trait bound `i32: Tr` is not satisfied [E0277]
11     bar(b); //~ ERROR: the trait bound `f32: Tr` is not satisfied [E0277]
12 }