@@ -7,16 +7,30 @@ LL | #![feature(dyn_star)]
7
7
= note: see issue #102425 <https://github.com/rust-lang/rust/issues/102425> for more information
8
8
= note: `#[warn(incomplete_features)]` on by default
9
9
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
+
10
24
error[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
12
26
|
13
27
LL | fn with_sized<T: Fn() -> &'static (dyn std::fmt::Debug) + ?Sized>() {
14
28
| - this type parameter needs to be `Sized`
15
- LL | without_sized::<T>();
29
+ LL | without_sized::<T>();
16
30
| ^ doesn't have a size known at compile-time
17
31
|
18
32
note: 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
20
34
|
21
35
LL | fn without_sized<T: Fn() -> &'static dyn std::fmt::Debug>() {}
22
36
| ^ required by the implicit `Sized` requirement on this type parameter in `without_sized`
@@ -58,27 +72,7 @@ help: consider adding an explicit lifetime bound
58
72
LL | executor: impl FnOnce(T) -> (dyn* Future<Output = ()>) + 'static,
59
73
| + +++++++++++
60
74
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
-
81
75
error: aborting due to 4 previous errors; 1 warning emitted
82
76
83
- Some errors have detailed explanations: E0277, E0310, E0382 .
77
+ Some errors have detailed explanations: E0277, E0310, E0599 .
84
78
For more information about an error, try `rustc --explain E0277`.
0 commit comments