summary refs log tree commit diff
path: root/src/test/ui/impl-trait/issues/issue-70877.stderr
blob: 7cbd58bdabf2f7b9521cb5f6a85f4d6b8d1b8904 (plain)
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
error[E0308]: mismatched types
  --> $DIR/issue-70877.rs:16:9
   |
LL | type FooRet = impl std::fmt::Debug;
   |               -------------------- the expected opaque type
...
LL |     fn next(&mut self) -> Option<Self::Item> {
   |                           ------------------ expected `Option<Box<(dyn for<'r> Fn(&'r (dyn ToString + 'r)) -> FooRet + 'static)>>` because of return type
LL |         Some(Box::new(quux))
   |         ^^^^^^^^^^^^^^^^^^^^ expected trait object `dyn Fn`, found fn item
   |
   = note: expected enum `Option<Box<(dyn for<'r> Fn(&'r (dyn ToString + 'r)) -> FooRet + 'static)>>`
              found enum `Option<Box<for<'r> fn(&'r (dyn ToString + 'r)) -> FooRet {quux}>>`

error: opaque type's hidden type cannot be another opaque type from the same scope
  --> $DIR/issue-70877.rs:31:12
   |
LL |     return func(&"oof");
   |            ^^^^^^^^^^^^ one of the two opaque types used here has to be outside its defining scope
   |
note: opaque type whose hidden type is being assigned
  --> $DIR/issue-70877.rs:28:13
   |
LL | fn oof() -> impl std::fmt::Debug {
   |             ^^^^^^^^^^^^^^^^^^^^
note: opaque type being used as hidden type
  --> $DIR/issue-70877.rs:4:15
   |
LL | type FooRet = impl std::fmt::Debug;
   |               ^^^^^^^^^^^^^^^^^^^^

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0308`.