|
| 1 | +warning: trait objects without an explicit `dyn` are deprecated |
| 2 | + --> $DIR/dyn-trait-ice-153366.rs:5:14 |
| 3 | + | |
| 4 | +LL | fn iso<A>(a: Fn) -> Option<_> |
| 5 | + | ^^ |
| 6 | + | |
| 7 | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! |
| 8 | + = note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2021/warnings-promoted-to-error.html> |
| 9 | + = note: `#[warn(bare_trait_objects)]` (part of `#[warn(rust_2021_compatibility)]`) on by default |
| 10 | +help: if this is a dyn-compatible trait, use `dyn` |
| 11 | + | |
| 12 | +LL | fn iso<A>(a: dyn Fn) -> Option<_> |
| 13 | + | +++ |
| 14 | + |
| 15 | +error[E0107]: missing generics for trait `Fn` |
| 16 | + --> $DIR/dyn-trait-ice-153366.rs:5:14 |
| 17 | + | |
| 18 | +LL | fn iso<A>(a: Fn) -> Option<_> |
| 19 | + | ^^ expected 1 generic argument |
| 20 | + | |
| 21 | +help: add missing generic argument |
| 22 | + | |
| 23 | +LL | fn iso<A>(a: Fn<Args>) -> Option<_> |
| 24 | + | ++++++ |
| 25 | + |
| 26 | +error[E0277]: the size for values of type `(dyn Fn(_) + 'static)` cannot be known at compilation time |
| 27 | + --> $DIR/dyn-trait-ice-153366.rs:18:5 |
| 28 | + | |
| 29 | +LL | iso(()) |
| 30 | + | ^^^^^^^ doesn't have a size known at compile-time |
| 31 | + | |
| 32 | + = help: the trait `Sized` is not implemented for `(dyn Fn(_) + 'static)` |
| 33 | +note: required by a bound in `iso` |
| 34 | + --> $DIR/dyn-trait-ice-153366.rs:11:22 |
| 35 | + | |
| 36 | +LL | fn iso<A>(a: Fn) -> Option<_> |
| 37 | + | --- required by a bound in this function |
| 38 | +... |
| 39 | +LL | dyn Fn(A) -> (): Sized, |
| 40 | + | ^^^^^ required by this bound in `iso` |
| 41 | + |
| 42 | +error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types |
| 43 | + --> $DIR/dyn-trait-ice-153366.rs:16:30 |
| 44 | + | |
| 45 | +LL | fn iso_un_option<B>() -> Box<_> { |
| 46 | + | ^ not allowed in type signatures |
| 47 | + |
| 48 | +error[E0308]: mismatched types |
| 49 | + --> $DIR/dyn-trait-ice-153366.rs:13:5 |
| 50 | + | |
| 51 | +LL | fn iso<A>(a: Fn) -> Option<_> |
| 52 | + | --------- expected `Option<_>` because of return type |
| 53 | +... |
| 54 | +LL | Box::new(iso_un_option) |
| 55 | + | ^^^^^^^^^^^^^^^^^^^^^^^ expected `Option<_>`, found `Box<fn() -> ... {iso_un_option::<_>}>` |
| 56 | + | |
| 57 | + = note: expected enum `Option<_>` |
| 58 | + found struct `Box<fn() -> {type error} {iso_un_option::<_>}>` |
| 59 | +help: use parentheses to call this function |
| 60 | + | |
| 61 | +LL | Box::new(iso_un_option)() |
| 62 | + | ++ |
| 63 | +help: try wrapping the expression in `Some` |
| 64 | + | |
| 65 | +LL | Some(Box::new(iso_un_option)) |
| 66 | + | +++++ + |
| 67 | + |
| 68 | +error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types |
| 69 | + --> $DIR/dyn-trait-ice-153366.rs:5:28 |
| 70 | + | |
| 71 | +LL | fn iso<A>(a: Fn) -> Option<_> |
| 72 | + | ^ not allowed in type signatures |
| 73 | + |
| 74 | +error[E0277]: the size for values of type `(dyn Fn(_) + 'static)` cannot be known at compilation time |
| 75 | + --> $DIR/dyn-trait-ice-153366.rs:23:5 |
| 76 | + | |
| 77 | +LL | iso(()) |
| 78 | + | ^^^^^^^ doesn't have a size known at compile-time |
| 79 | + | |
| 80 | + = help: the trait `Sized` is not implemented for `(dyn Fn(_) + 'static)` |
| 81 | +note: required by a bound in `iso` |
| 82 | + --> $DIR/dyn-trait-ice-153366.rs:11:22 |
| 83 | + | |
| 84 | +LL | fn iso<A>(a: Fn) -> Option<_> |
| 85 | + | --- required by a bound in this function |
| 86 | +... |
| 87 | +LL | dyn Fn(A) -> (): Sized, |
| 88 | + | ^^^^^ required by this bound in `iso` |
| 89 | + |
| 90 | +error: aborting due to 6 previous errors; 1 warning emitted |
| 91 | + |
| 92 | +Some errors have detailed explanations: E0107, E0121, E0277, E0308. |
| 93 | +For more information about an error, try `rustc --explain E0107`. |
0 commit comments