File: in-assoc-type-unconstrained.stderr

package info (click to toggle)
rustc 1.85.0%2Bdfsg3-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental, sid, trixie
  • size: 893,396 kB
  • sloc: xml: 158,127; python: 35,830; javascript: 19,497; cpp: 19,002; sh: 17,245; ansic: 13,127; asm: 4,376; makefile: 1,051; perl: 29; lisp: 29; ruby: 19; sql: 11
file content (60 lines) | stat: -rw-r--r-- 2,278 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
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 `()`
   |
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:12
   |
LL |         fn method() -> () {}
   |            ^^^^^^
help: change the output type to match the trait
   |
LL |         fn method() -> <() as compare_method::Trait>::Ty {}
   |                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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`.