use abstract consts when unifying ConstKind::Unevaluated

This commit is contained in:
Bastian Kauschke 2020-09-10 18:48:18 +02:00
parent d327fa112b
commit c3a772f55f
8 changed files with 96 additions and 10 deletions

View file

@ -1,10 +1,18 @@
error: generic parameters must not be used inside of non trivial constant values
--> $DIR/simple.rs:8:33
--> $DIR/simple.rs:8:53
|
LL | type Arr<const N: usize> = [u8; N - 1];
| ^ non-trivial anonymous constants must not depend on the parameter `N`
LL | fn test<const N: usize>() -> [u8; N - 1] where [u8; N - 1]: Default {
| ^ non-trivial anonymous constants must not depend on the parameter `N`
|
= help: it is currently only allowed to use either `N` or `{ N }` as generic constants
error: aborting due to previous error
error: generic parameters must not be used inside of non trivial constant values
--> $DIR/simple.rs:8:35
|
LL | fn test<const N: usize>() -> [u8; N - 1] where [u8; N - 1]: Default {
| ^ non-trivial anonymous constants must not depend on the parameter `N`
|
= help: it is currently only allowed to use either `N` or `{ N }` as generic constants
error: aborting due to 2 previous errors

View file

@ -5,10 +5,9 @@
#![feature(const_evaluatable_checked)]
#![allow(incomplete_features)]
type Arr<const N: usize> = [u8; N - 1];
//[min]~^ ERROR generic parameters must not be used inside of non trivial constant values
fn test<const N: usize>() -> Arr<N> where Arr<N>: Default {
fn test<const N: usize>() -> [u8; N - 1] where [u8; N - 1]: Default {
//[min]~^ ERROR generic parameters
//[min]~| ERROR generic parameters
Default::default()
}