about summary refs log tree commit diff
path: root/tests/ui/traits/trivial-unsized-projection.rs
blob: 62ff25fb7ac0a75b352ceeed4a9ec2c89c82a681 (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
//@ revisions: good bad good_new bad_new
//@[good_new] compile-flags: -Znext-solver
//@[bad_new] compile-flags: -Znext-solver
//@ ignore-compare-mode-next-solver (explicit revisions)
//@[good] check-pass
//@[good_new] check-pass

#![feature(trivial_bounds)]
#![allow(trivial_bounds)]

trait Bad {
    type Assert
    where
        Self: Sized;
}

impl Bad for [()] {}

#[cfg(any(bad, bad_new))]
const FOO: <[()] as Bad>::Assert = todo!();
//[bad]~^ ERROR the size for values of type `[()]` cannot be known at compilation time
//[bad]~| ERROR the size for values of type `[()]` cannot be known at compilation time
//[bad_new]~^^^ ERROR the size for values of type `[()]` cannot be known at compilation time
//[bad_new]~| ERROR the size for values of type `[()]` cannot be known at compilation time

#[cfg(any(good, good_new))]
// Well-formed in trivially false param-env
fn foo() where [()]: Sized {
    let _: <[()] as Bad>::Assert;
}

fn main() {}