// 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 cannot find associated type `N` in trait `Tr` let _: ::N; //~ ERROR cannot find associated type `N` in enum `E` let _: ::N; //~ ERROR cannot find associated type `N` in `A` ::N; //~ ERROR cannot find method or associated constant `N` in trait `Tr` ::N; //~ ERROR cannot find method or associated constant `N` in enum `E` ::N; //~ ERROR cannot find method or associated constant `N` in `A` 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 cannot find associated type `N` in trait `Tr` let _: ::N::NN; //~ ERROR cannot find associated type `N` in enum `E` let _: ::N::NN; //~ ERROR cannot find associated type `N` in `A` ::N::NN; //~ ERROR cannot find associated type `N` in trait `Tr` ::N::NN; //~ ERROR cannot find associated type `N` in enum `E` ::N::NN; //~ ERROR cannot find associated type `N` in `A` 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 cannot find associated type `NN` in `Tr::N` let _: ::NN; //~ ERROR cannot find associated type `NN` in `E::N` let _: ::NN; //~ ERROR cannot find associated type `NN` in `A::N` ::NN; //~ ERROR cannot find method or associated constant `NN` in `Tr::N` ::NN; //~ ERROR cannot find method or associated constant `NN` in `E::N` ::NN; //~ ERROR cannot find method or associated constant `NN` in `A::N` let _: ::NN; //~ ERROR cannot find associated type `NN` in `Tr::Y` let _: ::NN; //~ ERROR failed to resolve. Not a module `Y` ::NN; //~ ERROR cannot find method or associated constant `NN` in `Tr::Y` ::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` }