const_evaluatable_checked: fix occurs check

This commit is contained in:
Bastian Kauschke 2020-12-02 14:33:26 +01:00
parent 92e4fb0732
commit 71d7550350
4 changed files with 52 additions and 2 deletions

View file

@ -0,0 +1,20 @@
#![feature(const_generics, const_evaluatable_checked)]
#![allow(incomplete_features)]
// `N + 1` also depends on `T` here even if it doesn't use it.
fn q<T, const N: usize>(_: T) -> [u8; N + 1] {
todo!()
}
fn supplier<T>() -> T {
todo!()
}
fn catch_me<const N: usize>() where [u8; N + 1]: Default {
let mut x = supplier();
x = q::<_, N>(x); //~ ERROR mismatched types
}
fn main() {
catch_me::<3>();
}

View file

@ -0,0 +1,12 @@
error[E0308]: mismatched types
--> $DIR/unused-substs-5.rs:15:9
|
LL | x = q::<_, N>(x);
| ^^^^^^^^^^^^
| |
| cyclic type of infinite size
| help: try using a conversion method: `q::<_, N>(x).to_vec()`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0308`.