about summary refs log tree commit diff
path: root/tests/ui/traits/trivial-unsized-projection-2.rs
blob: af4e12f6f90084f9b1d53b876f546f6ae5f32f28 (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
33
34
//@ 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;
}

struct Tail([()]);

impl Bad for Tail {}

#[cfg(any(bad, bad_new))]
const FOO: <Tail 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 Tail: Sized {
    let _: <Tail as Bad>::Assert;
}

fn main() {}