mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 08:13:41 +00:00
8ac7d0eef5
For #90528.
21 lines
590 B
Rust
21 lines
590 B
Rust
// Issue #90528: provide helpful suggestions when a trait bound is unsatisfied
|
|
// due to a missed unsizing coercion.
|
|
//
|
|
// This test exercises array literals and a trait implemented on immutable slices.
|
|
|
|
trait Read {}
|
|
|
|
impl Read for &[u8] {}
|
|
|
|
fn wants_read(_: impl Read) {}
|
|
|
|
fn main() {
|
|
wants_read([0u8]);
|
|
//~^ ERROR the trait bound `[u8; 1]: Read` is not satisfied
|
|
wants_read(&[0u8]);
|
|
//~^ ERROR the trait bound `&[u8; 1]: Read` is not satisfied
|
|
wants_read(&[0u8][..]);
|
|
wants_read(&mut [0u8]);
|
|
//~^ ERROR the trait bound `&mut [u8; 1]: Read` is not satisfied
|
|
}
|