about summary refs log tree commit diff
path: root/tests/ui/impl-trait/type-alias-impl-trait-in-fn-body.rs
blob: 77b2407e304fe4074d837b338848515ec11a7452 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//! Test that it is basically not possible to declare *and opaquely use* opaque types
//! in function bodies. This will work again once we have a `#[defines]` attribute

#![feature(type_alias_impl_trait)]

use std::fmt::Debug;

fn main() {
    //~^ ERROR: item does not constrain
    type Existential = impl Debug;

    #[define_opaque(Existential)]
    fn f() -> Existential {}
    println!("{:?}", f());
}