diff options
| author | Camille GILLOT <gillot.camille@gmail.com> | 2023-03-05 20:55:29 +0000 |
|---|---|---|
| committer | Camille GILLOT <gillot.camille@gmail.com> | 2023-03-05 20:55:29 +0000 |
| commit | 5d7234abb65fa8cf0007ed03dfd8448eb9128f5d (patch) | |
| tree | 6a552f4a18963288d1aa9d37bd4ccc0d4218f563 | |
| parent | 0fbfc3e76916521b509b63286296dd0762170d34 (diff) | |
| download | rust-5d7234abb65fa8cf0007ed03dfd8448eb9128f5d.tar.gz rust-5d7234abb65fa8cf0007ed03dfd8448eb9128f5d.zip | |
Add test.
| -rw-r--r-- | tests/ui/mir/unsize-trait.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/ui/mir/unsize-trait.rs b/tests/ui/mir/unsize-trait.rs new file mode 100644 index 00000000000..45b5308c093 --- /dev/null +++ b/tests/ui/mir/unsize-trait.rs @@ -0,0 +1,15 @@ +// Check that the interpreter does not ICE when trying to unsize `B` to `[u8]`. +// This is a `build` test to ensure that const-prop-lint runs. +// build-pass + +#![feature(unsize)] + +fn foo<B>(buffer: &mut [B; 2]) + where B: std::marker::Unsize<[u8]>, +{ + let buffer: &[u8] = &buffer[0]; +} + +fn main() { + foo(&mut [[0], [5]]); +} |
