summaryrefslogtreecommitdiffstats
path: root/tests/ui/suggestions/issue-84973-negative.rs
blob: f339251e57dabd49ab830695553153409f4719a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
// Checks that we only suggest borrowing if &T actually implements the trait.

trait Tr {}
impl Tr for &f32 {}
fn bar<T: Tr>(t: T) {}

fn main() {
    let a = 0i32;
    let b = 0.0f32;
    bar(a); //~ ERROR: the trait bound `i32: Tr` is not satisfied [E0277]
    bar(b); //~ ERROR: the trait bound `f32: Tr` is not satisfied [E0277]
}