From 218caa410aa38c29984be31a5229b9fa717560ee Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:19:13 +0200 Subject: Merging upstream version 1.68.2+dfsg1. Signed-off-by: Daniel Baumann --- tests/ui/ufcs/ufcs-partially-resolved.rs | 56 ++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 tests/ui/ufcs/ufcs-partially-resolved.rs (limited to 'tests/ui/ufcs/ufcs-partially-resolved.rs') diff --git a/tests/ui/ufcs/ufcs-partially-resolved.rs b/tests/ui/ufcs/ufcs-partially-resolved.rs new file mode 100644 index 000000000..e6470aa6d --- /dev/null +++ b/tests/ui/ufcs/ufcs-partially-resolved.rs @@ -0,0 +1,56 @@ +#![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 `u16` + ::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: `Y` is a variant, not a module + ::NN; //~ ERROR cannot find method or associated constant `NN` in `Tr::Y` + ::NN; //~ ERROR failed to resolve: `Y` is a variant, not a module + + let _: ::Z; //~ ERROR expected associated type, found associated function `Dr::Z` + ::X; //~ ERROR expected method or associated constant, found associated type `Dr::X` + let _: ::Z::N; //~ ERROR expected associated type, found associated function `Dr::Z` + ::X::N; //~ ERROR no associated item named `N` found for type `u16` +} -- cgit v1.2.3