blob: f2762ad421ba5fdac64a95a54e1ade7303cda4b6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
// Issue #90528: provide helpful suggestions when a trait bound is unsatisfied
// due to a missed unsizing coercion.
//
// This test exercises array variables and a trait implemented on immmutable slices.
trait Read {}
impl Read for &[u8] {}
fn wants_read(_: impl Read) {}
fn main() {
let x = [0u8];
wants_read(x);
//~^ ERROR the trait bound `[u8; 1]: Read` is not satisfied
wants_read(&x);
//~^ ERROR the trait bound `&[u8; 1]: Read` is not satisfied
wants_read(&x[..]);
let x = &[0u8];
wants_read(x);
//~^ ERROR the trait bound `&[u8; 1]: Read` is not satisfied
wants_read(&x);
//~^ ERROR the trait bound `&&[u8; 1]: Read` is not satisfied
wants_read(*x);
//~^ ERROR the trait bound `[u8; 1]: Read` is not satisfied
wants_read(&x[..]);
}
|