about summary refs log tree commit diff
path: root/tests/ui/impl-trait/in-bindings/implicit-sized.rs
blob: 2f16db941895a60dae6fe6ba6b712fea566f90e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#![feature(impl_trait_in_bindings)]

trait Trait {}
impl<T: ?Sized> Trait for T {}

fn doesnt_work() {
    let x: &impl Trait = "hi";
    //~^ ERROR the size for values of type `str` cannot be known at compilation time
}

fn works() {
    let x: &(impl Trait + ?Sized) = "hi";
    // No implicit sized.

    let x: &impl Trait = &();
    // Is actually sized.
}

fn main() {}