2016-11-30 22:35:25 +00:00
|
|
|
#![feature(associated_type_defaults)]
|
|
|
|
|
|
|
|
trait Tr {
|
|
|
|
type Y = u16;
|
|
|
|
fn Y() {}
|
|
|
|
}
|
|
|
|
impl Tr for u8 {}
|
|
|
|
|
|
|
|
trait Dr {
|
|
|
|
type X = u16;
|
|
|
|
fn Z() {}
|
|
|
|
}
|
|
|
|
impl Dr for u8 {}
|
|
|
|
|
|
|
|
enum E { Y }
|
|
|
|
type A = u32;
|
|
|
|
|
|
|
|
fn main() {
|
2017-01-11 22:18:08 +00:00
|
|
|
let _: <u8 as Tr>::N; //~ ERROR cannot find associated type `N` in trait `Tr`
|
2023-04-03 21:41:16 +00:00
|
|
|
let _: <u8 as E>::N; //~ ERROR expected trait, found enum `E`
|
|
|
|
let _: <u8 as A>::N; //~ ERROR expected trait, found type alias `A`
|
2017-01-11 22:18:08 +00:00
|
|
|
<u8 as Tr>::N; //~ ERROR cannot find method or associated constant `N` in trait `Tr`
|
2023-04-03 21:41:16 +00:00
|
|
|
<u8 as E>::N; //~ ERROR expected trait, found enum `E`
|
|
|
|
<u8 as A>::N; //~ ERROR expected trait, found type alias `A`
|
2016-11-30 22:35:25 +00:00
|
|
|
let _: <u8 as Tr>::Y; // OK
|
2023-04-03 21:41:16 +00:00
|
|
|
let _: <u8 as E>::Y; //~ ERROR expected trait, found enum `E`
|
2016-11-30 22:35:25 +00:00
|
|
|
<u8 as Tr>::Y; // OK
|
2023-04-03 21:41:16 +00:00
|
|
|
<u8 as E>::Y; //~ ERROR expected trait, found enum `E`
|
2016-11-30 22:35:25 +00:00
|
|
|
|
2017-01-11 22:18:08 +00:00
|
|
|
let _: <u8 as Tr>::N::NN; //~ ERROR cannot find associated type `N` in trait `Tr`
|
2023-04-03 21:41:16 +00:00
|
|
|
let _: <u8 as E>::N::NN; //~ ERROR expected trait, found enum `E`
|
|
|
|
let _: <u8 as A>::N::NN; //~ ERROR expected trait, found type alias `A`
|
2017-01-11 22:18:08 +00:00
|
|
|
<u8 as Tr>::N::NN; //~ ERROR cannot find associated type `N` in trait `Tr`
|
2023-04-03 21:41:16 +00:00
|
|
|
<u8 as E>::N::NN; //~ ERROR expected trait, found enum `E`
|
|
|
|
<u8 as A>::N::NN; //~ ERROR expected trait, found type alias `A`
|
2016-11-30 22:35:25 +00:00
|
|
|
let _: <u8 as Tr>::Y::NN; //~ ERROR ambiguous associated type
|
2023-04-03 21:41:16 +00:00
|
|
|
let _: <u8 as E>::Y::NN; //~ ERROR expected trait, found enum `E`
|
2019-06-13 19:36:15 +00:00
|
|
|
<u8 as Tr>::Y::NN; //~ ERROR no associated item named `NN` found for type `u16`
|
2023-04-03 21:41:16 +00:00
|
|
|
<u8 as E>::Y::NN; //~ ERROR expected trait, found enum `E`
|
2016-11-30 22:35:25 +00:00
|
|
|
|
2023-04-03 21:41:16 +00:00
|
|
|
let _: <u8 as Tr::N>::NN; //~ ERROR cannot find trait `N` in trait `Tr`
|
|
|
|
let _: <u8 as E::N>::NN; //~ ERROR cannot find trait `N` in enum `E`
|
|
|
|
let _: <u8 as A::N>::NN; //~ ERROR cannot find trait `N` in `A`
|
|
|
|
<u8 as Tr::N>::NN; //~ ERROR cannot find trait `N` in trait `Tr`
|
|
|
|
<u8 as E::N>::NN; //~ ERROR cannot find trait `N` in enum `E`
|
|
|
|
<u8 as A::N>::NN; //~ ERROR cannot find trait `N` in `A`
|
|
|
|
let _: <u8 as Tr::Y>::NN; //~ ERROR expected trait, found associated type `Tr::Y
|
|
|
|
let _: <u8 as E::Y>::NN; //~ ERROR expected trait, found variant `E::Y`
|
|
|
|
<u8 as Tr::Y>::NN; //~ ERROR expected trait, found associated type `Tr::Y`
|
|
|
|
<u8 as E::Y>::NN; //~ ERROR expected trait, found variant `E::Y`
|
2016-11-30 22:35:25 +00:00
|
|
|
|
2020-03-05 03:03:15 +00:00
|
|
|
let _: <u8 as Dr>::Z; //~ ERROR expected associated type, found associated function `Dr::Z`
|
2016-11-30 22:35:25 +00:00
|
|
|
<u8 as Dr>::X; //~ ERROR expected method or associated constant, found associated type `Dr::X`
|
2020-03-05 03:03:15 +00:00
|
|
|
let _: <u8 as Dr>::Z::N; //~ ERROR expected associated type, found associated function `Dr::Z`
|
2019-06-13 19:36:15 +00:00
|
|
|
<u8 as Dr>::X::N; //~ ERROR no associated item named `N` found for type `u16`
|
2016-11-30 22:35:25 +00:00
|
|
|
}
|