1 // Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 #![feature(associated_type_defaults)]
29 let _: <u8 as Tr>::N; //~ ERROR cannot find associated type `N` in trait `Tr`
30 let _: <u8 as E>::N; //~ ERROR cannot find associated type `N` in enum `E`
31 let _: <u8 as A>::N; //~ ERROR cannot find associated type `N` in `A`
32 <u8 as Tr>::N; //~ ERROR cannot find method or associated constant `N` in trait `Tr`
33 <u8 as E>::N; //~ ERROR cannot find method or associated constant `N` in enum `E`
34 <u8 as A>::N; //~ ERROR cannot find method or associated constant `N` in `A`
35 let _: <u8 as Tr>::Y; // OK
36 let _: <u8 as E>::Y; //~ ERROR expected associated type, found variant `E::Y`
38 <u8 as E>::Y; //~ ERROR expected method or associated constant, found unit variant `E::Y`
40 let _: <u8 as Tr>::N::NN; //~ ERROR cannot find associated type `N` in trait `Tr`
41 let _: <u8 as E>::N::NN; //~ ERROR cannot find associated type `N` in enum `E`
42 let _: <u8 as A>::N::NN; //~ ERROR cannot find associated type `N` in `A`
43 <u8 as Tr>::N::NN; //~ ERROR cannot find associated type `N` in trait `Tr`
44 <u8 as E>::N::NN; //~ ERROR cannot find associated type `N` in enum `E`
45 <u8 as A>::N::NN; //~ ERROR cannot find associated type `N` in `A`
46 let _: <u8 as Tr>::Y::NN; //~ ERROR ambiguous associated type
47 let _: <u8 as E>::Y::NN; //~ ERROR expected associated type, found variant `E::Y`
48 <u8 as Tr>::Y::NN; //~ ERROR no associated item named `NN` found for type `<u8 as Tr>::Y`
49 <u8 as E>::Y::NN; //~ ERROR expected associated type, found variant `E::Y`
51 let _: <u8 as Tr::N>::NN; //~ ERROR cannot find associated type `NN` in `Tr::N`
52 let _: <u8 as E::N>::NN; //~ ERROR cannot find associated type `NN` in `E::N`
53 let _: <u8 as A::N>::NN; //~ ERROR cannot find associated type `NN` in `A::N`
54 <u8 as Tr::N>::NN; //~ ERROR cannot find method or associated constant `NN` in `Tr::N`
55 <u8 as E::N>::NN; //~ ERROR cannot find method or associated constant `NN` in `E::N`
56 <u8 as A::N>::NN; //~ ERROR cannot find method or associated constant `NN` in `A::N`
57 let _: <u8 as Tr::Y>::NN; //~ ERROR cannot find associated type `NN` in `Tr::Y`
58 let _: <u8 as E::Y>::NN; //~ ERROR failed to resolve: not a module `Y`
59 <u8 as Tr::Y>::NN; //~ ERROR cannot find method or associated constant `NN` in `Tr::Y`
60 <u8 as E::Y>::NN; //~ ERROR failed to resolve: not a module `Y`
62 let _: <u8 as Dr>::Z; //~ ERROR expected associated type, found method `Dr::Z`
63 <u8 as Dr>::X; //~ ERROR expected method or associated constant, found associated type `Dr::X`
64 let _: <u8 as Dr>::Z::N; //~ ERROR expected associated type, found method `Dr::Z`
65 <u8 as Dr>::X::N; //~ ERROR no associated item named `N` found for type `<u8 as Dr>::X`