rust/src/test/ui/const-generics/occurs-check/unify-n-nplusone.rs

18 lines
394 B
Rust
Raw Normal View History

2020-09-09 02:43:53 -05:00
#![feature(const_generics)]
#![allow(incomplete_features)]
// This test would try to unify `N` with `N + 1` which must fail the occurs check.
fn bind<const N: usize>(value: [u8; N]) -> [u8; N + 1] {
//~^ ERROR constant expression depends on a generic parameter
todo!()
}
fn sink(_: [u8; 5]) {}
fn main() {
let mut arr = Default::default();
arr = bind(arr);
sink(arr);
}