rust/tests/ui/suggestions/issue-84973-negative.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

13 lines
335 B
Rust
Raw Normal View History

2021-05-17 15:58:09 -05:00
// 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]
}