2019-02-21 16:02:56 -06:00
|
|
|
//@ compile-flags:-Z unstable-options --show-coverage
|
2020-04-19 18:40:53 -05:00
|
|
|
//@ check-pass
|
2019-02-21 16:02:56 -06:00
|
|
|
|
|
|
|
#![feature(trait_alias)]
|
2021-07-26 15:01:16 -05:00
|
|
|
#![feature(type_alias_impl_trait)]
|
2019-02-21 16:02:56 -06:00
|
|
|
|
|
|
|
/// look at this trait right here
|
|
|
|
pub trait ThisTrait {
|
|
|
|
/// that's a trait all right
|
|
|
|
fn right_here(&self);
|
|
|
|
|
|
|
|
/// even the provided functions show up as trait methods
|
|
|
|
fn aww_yeah(&self) {}
|
|
|
|
|
|
|
|
/// gotta check those associated types, they're slippery
|
|
|
|
type SomeType;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// so what happens if we take some struct...
|
2021-04-09 08:00:12 -05:00
|
|
|
#[derive(Clone)]
|
2019-02-21 16:02:56 -06:00
|
|
|
pub struct SomeStruct;
|
|
|
|
|
|
|
|
/// ...and slap this trait on it?
|
|
|
|
impl ThisTrait for SomeStruct {
|
2019-02-28 16:24:38 -06:00
|
|
|
/// nothing! trait impls are totally ignored in this calculation, sorry.
|
2019-02-21 16:02:56 -06:00
|
|
|
fn right_here(&self) {}
|
|
|
|
|
|
|
|
type SomeType = String;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// but what about those aliases? i hear they're pretty exotic
|
|
|
|
pub trait MyAlias = ThisTrait + Send + Sync;
|
|
|
|
|
2021-04-09 08:10:11 -05:00
|
|
|
/// woah, getting all opaque in here
|
|
|
|
pub type ThisExists = impl ThisTrait;
|
|
|
|
|
|
|
|
/// why don't we get a little more concrete
|
|
|
|
pub fn defines() -> ThisExists { SomeStruct {} }
|