summaryrefslogtreecommitdiff
path: root/tests/ui/impl-trait/in-assoc-type-unconstrained.stderr
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/impl-trait/in-assoc-type-unconstrained.stderr')
-rw-r--r--tests/ui/impl-trait/in-assoc-type-unconstrained.stderr59
1 files changed, 59 insertions, 0 deletions
diff --git a/tests/ui/impl-trait/in-assoc-type-unconstrained.stderr b/tests/ui/impl-trait/in-assoc-type-unconstrained.stderr
new file mode 100644
index 00000000000..1097cd0f452
--- /dev/null
+++ b/tests/ui/impl-trait/in-assoc-type-unconstrained.stderr
@@ -0,0 +1,59 @@
+error[E0271]: type mismatch resolving `<Option<<() as Trait>::Ty::{opaque#0}> as IntoIterator>::Item == ()`
+ --> $DIR/in-assoc-type-unconstrained.rs:8:19
+ |
+LL | type Ty = Option<impl Sized>;
+ | ^^^^^^^^^^^^^^^^^^ expected `()`, found opaque type
+ |
+ = note: expected unit type `()`
+ found opaque type `<() as compare_ty::Trait>::Ty::{opaque#0}`
+note: required by a bound in `compare_ty::Trait::Ty`
+ --> $DIR/in-assoc-type-unconstrained.rs:5:31
+ |
+LL | type Ty: IntoIterator<Item = ()>;
+ | ^^^^^^^^^ required by this bound in `Trait::Ty`
+
+error: unconstrained opaque type
+ --> $DIR/in-assoc-type-unconstrained.rs:8:26
+ |
+LL | type Ty = Option<impl Sized>;
+ | ^^^^^^^^^^
+ |
+ = note: `Ty` must be used in combination with a concrete type within the same impl
+
+error[E0053]: method `method` has an incompatible type for trait
+ --> $DIR/in-assoc-type-unconstrained.rs:22:24
+ |
+LL | type Ty = impl Sized;
+ | ---------- the expected opaque type
+LL |
+LL | fn method() -> () {}
+ | ^^
+ | |
+ | expected opaque type, found `()`
+ | help: change the output type to match the trait: `<() as compare_method::Trait>::Ty`
+ |
+note: type in trait
+ --> $DIR/in-assoc-type-unconstrained.rs:17:24
+ |
+LL | fn method() -> Self::Ty;
+ | ^^^^^^^^
+ = note: expected signature `fn() -> <() as compare_method::Trait>::Ty`
+ found signature `fn()`
+note: this item must have the opaque type in its signature in order to be able to register hidden types
+ --> $DIR/in-assoc-type-unconstrained.rs:22:9
+ |
+LL | fn method() -> () {}
+ | ^^^^^^^^^^^^^^^^^
+
+error: unconstrained opaque type
+ --> $DIR/in-assoc-type-unconstrained.rs:20:19
+ |
+LL | type Ty = impl Sized;
+ | ^^^^^^^^^^
+ |
+ = note: `Ty` must be used in combination with a concrete type within the same impl
+
+error: aborting due to 4 previous errors
+
+Some errors have detailed explanations: E0053, E0271.
+For more information about an error, try `rustc --explain E0053`.