summary refs log tree commit diff
path: root/src/test/ui/const-generics/issues/issue-90318.rs
blob: bebd0c6ac1202d656c67299d2dac1f19a105a02c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#![feature(const_type_id)]
#![feature(generic_const_exprs)]
#![feature(core_intrinsics)]
#![allow(incomplete_features)]

use std::any::TypeId;

struct If<const B: bool>;
pub trait True {}
impl True for If<true> {}

fn consume<T: 'static>(_val: T)
where
    If<{ TypeId::of::<T>() != TypeId::of::<()>() }>: True,
    //~^ ERROR: overly complex generic constant
    //~| ERROR: cannot call non-const operator in constants
{
}

fn test<T: 'static>()
where
    If<{ TypeId::of::<T>() != TypeId::of::<()>() }>: True,
    //~^ ERROR: overly complex generic constant
    //~| ERROR: cannot call non-const operator in constants
{
}

fn main() {
    let a = ();
    consume(0i32);
    consume(a);
}