const_evaluatable_checked: fix occurs check
This commit is contained in:
parent
92e4fb0732
commit
71d7550350
4 changed files with 52 additions and 2 deletions
20
src/test/ui/const-generics/occurs-check/unused-substs-5.rs
Normal file
20
src/test/ui/const-generics/occurs-check/unused-substs-5.rs
Normal 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>();
|
||||
}
|
||||
|
|
@ -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`.
|
||||
Loading…
Add table
Add a link
Reference in a new issue