about summary refs log tree commit diff
path: root/tests/ui/type-alias-impl-trait/defining-use-submodule.rs
blob: b953cd646a027fbd5db6fedfcaadc2431415071b (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
//@ check-pass

#![feature(type_alias_impl_trait)]
#![allow(dead_code)]

// test that the type alias impl trait defining use is in a submodule

fn main() {}

type Foo = impl std::fmt::Display;
type Bar = impl std::fmt::Display;

mod foo {
    #[define_opaque(super::Foo)]
    pub(crate) fn foo() -> super::Foo {
        "foo"
    }

    pub(crate) mod bar {
        #[define_opaque(crate::Bar)]
        pub(crate) fn bar() -> crate::Bar {
            1
        }
    }
}

mod bar {
    pub type Baz = impl std::fmt::Display;
}

#[define_opaque(bar::Baz)]
fn baz() -> bar::Baz {
    "boom"
}