@@ -7,16 +7,30 @@ LL | #![feature(dyn_star)]
77 = note: see issue #102425 <https://github.com/rust-lang/rust/issues/102425> for more information
88 = note: `#[warn(incomplete_features)]` on by default
99
10+ error[E0599]: no method named `method` found for type parameter `T` in the current scope
11+ --> $DIR/wrap-dyn-in-suggestion-issue-120223.rs:24:7
12+ |
13+ LL | pub fn in_ty_param<T: Fn() -> dyn std::fmt::Debug> (t: T) {
14+ | - method `method` not found for this type parameter
15+ LL | t.method();
16+ | ^^^^^^ method not found in `T`
17+ |
18+ = help: items from traits can only be used if the type parameter is bounded by the trait
19+ help: the following trait defines an item `method`, perhaps you need to restrict type parameter `T` with it:
20+ |
21+ LL | pub fn in_ty_param<T: Fn() -> (dyn std::fmt::Debug) + Trait> (t: T) {
22+ | + +++++++++
23+
1024error[E0277]: the size for values of type `T` cannot be known at compilation time
11- --> $DIR/wrap-dyn-in-suggestion-issue-120223.rs:23 :21
25+ --> $DIR/wrap-dyn-in-suggestion-issue-120223.rs:29 :21
1226 |
1327LL | fn with_sized<T: Fn() -> &'static (dyn std::fmt::Debug) + ?Sized>() {
1428 | - this type parameter needs to be `Sized`
15- LL | without_sized::<T>();
29+ LL | without_sized::<T>();
1630 | ^ doesn't have a size known at compile-time
1731 |
1832note: required by an implicit `Sized` bound in `without_sized`
19- --> $DIR/wrap-dyn-in-suggestion-issue-120223.rs:27 :18
33+ --> $DIR/wrap-dyn-in-suggestion-issue-120223.rs:33 :18
2034 |
2135LL | fn without_sized<T: Fn() -> &'static dyn std::fmt::Debug>() {}
2236 | ^ required by the implicit `Sized` requirement on this type parameter in `without_sized`
@@ -58,27 +72,7 @@ help: consider adding an explicit lifetime bound
5872LL | executor: impl FnOnce(T) -> (dyn* Future<Output = ()>) + 'static,
5973 | + +++++++++++
6074
61- error[E0382]: use of moved value: `f`
62- --> $DIR/wrap-dyn-in-suggestion-issue-120223.rs:19:5
63- |
64- LL | pub fn in_ty_param<F: FnOnce() -> &'static dyn std::fmt::Debug>(f: F) {
65- | - move occurs because `f` has type `F`, which does not implement the `Copy` trait
66- LL | f();
67- | --- `f` moved due to this call
68- LL | f();
69- | ^ value used here after move
70- |
71- note: this value implements `FnOnce`, which causes it to be moved when called
72- --> $DIR/wrap-dyn-in-suggestion-issue-120223.rs:18:5
73- |
74- LL | f();
75- | ^
76- help: consider restricting type parameters
77- |
78- LL | pub fn in_ty_param<F: FnOnce() -> &'static (dyn std::fmt::Debug) + Copy>(f: F) {
79- | + ++++++++
80-
8175error: aborting due to 4 previous errors; 1 warning emitted
8276
83- Some errors have detailed explanations: E0277, E0310, E0382 .
77+ Some errors have detailed explanations: E0277, E0310, E0599 .
8478For more information about an error, try `rustc --explain E0277`.
0 commit comments