// Copyright 2016 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 or the MIT license // , at your // option. This file may not be copied, modified, or distributed // except according to those terms. #![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() { let _: ::N; //~ ERROR unresolved associated type `Tr::N` let _: ::N; //~ ERROR unresolved associated type `E::N` let _: ::N; //~ ERROR unresolved associated type `A::N` ::N; //~ ERROR unresolved method or associated constant `Tr::N` ::N; //~ ERROR unresolved method or associated constant `E::N` ::N; //~ ERROR unresolved method or associated constant `A::N` let _: ::Y; // OK let _: ::Y; //~ ERROR expected associated type, found variant `E::Y` ::Y; // OK ::Y; //~ ERROR expected method or associated constant, found unit variant `E::Y` let _: ::N::NN; //~ ERROR unresolved associated type `Tr::N` let _: ::N::NN; //~ ERROR unresolved associated type `E::N` let _: ::N::NN; //~ ERROR unresolved associated type `A::N` ::N::NN; //~ ERROR unresolved associated type `Tr::N` ::N::NN; //~ ERROR unresolved associated type `E::N` ::N::NN; //~ ERROR unresolved associated type `A::N` let _: ::Y::NN; //~ ERROR ambiguous associated type let _: ::Y::NN; //~ ERROR expected associated type, found variant `E::Y` ::Y::NN; //~ ERROR no associated item named `NN` found for type `::Y` ::Y::NN; //~ ERROR expected associated type, found variant `E::Y` let _: ::NN; //~ ERROR unresolved associated type `Tr::N::NN` let _: ::NN; //~ ERROR unresolved associated type `E::N::NN` let _: ::NN; //~ ERROR unresolved associated type `A::N::NN` ::NN; //~ ERROR unresolved method or associated constant `Tr::N::NN` ::NN; //~ ERROR unresolved method or associated constant `E::N::NN` ::NN; //~ ERROR unresolved method or associated constant `A::N::NN` let _: ::NN; //~ ERROR unresolved associated type `Tr::Y::NN` let _: ::NN; //~ ERROR failed to resolve. Not a module `Y` ::NN; //~ ERROR unresolved method or associated constant `Tr::Y::NN` ::NN; //~ ERROR failed to resolve. Not a module `Y` let _: ::Z; //~ ERROR expected associated type, found method `Dr::Z` ::X; //~ ERROR expected method or associated constant, found associated type `Dr::X` let _: ::Z::N; //~ ERROR expected associated type, found method `Dr::Z` ::X::N; //~ ERROR no associated item named `N` found for type `::X` }