Commit 5e91e35
committed
Account for multiple trait bounds in bare trait object suggestion
Note the parentheses in the last suggestion:
```
error[E0277]: the size for values of type `(dyn Foo + Send + 'static)` cannot be known at compilation time
--> $DIR/not-on-bare-trait.rs:7:8
|
LL | fn foo(_x: Foo + Send) {
| ^^ doesn't have a size known at compile-time
|
= help: the trait `Sized` is not implemented for `(dyn Foo + Send + 'static)`
= help: unsized fn params are gated as an unstable feature
help: you can use `impl Trait` as the argument type
|
LL | fn foo(_x: impl Foo + Send) {
| ++++
help: function arguments must have a statically known size, borrowed types always have a known size
|
LL | fn foo(_x: &(Foo + Send)) {
| ++ +
```1 parent d3e5bfc commit 5e91e35
File tree
3 files changed
+56
-8
lines changed- compiler/rustc_trait_selection/src/traits/error_reporting
- tests/ui/traits/bound
3 files changed
+56
-8
lines changedLines changed: 34 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3031 | 3031 | | |
3032 | 3032 | | |
3033 | 3033 | | |
3034 | | - | |
| 3034 | + | |
| 3035 | + | |
3035 | 3036 | | |
3036 | | - | |
| 3037 | + | |
3037 | 3038 | | |
3038 | 3039 | | |
3039 | 3040 | | |
| |||
3050 | 3051 | | |
3051 | 3052 | | |
3052 | 3053 | | |
3053 | | - | |
3054 | | - | |
3055 | | - | |
| 3054 | + | |
| 3055 | + | |
| 3056 | + | |
| 3057 | + | |
| 3058 | + | |
| 3059 | + | |
| 3060 | + | |
| 3061 | + | |
| 3062 | + | |
| 3063 | + | |
| 3064 | + | |
| 3065 | + | |
| 3066 | + | |
| 3067 | + | |
| 3068 | + | |
| 3069 | + | |
| 3070 | + | |
| 3071 | + | |
| 3072 | + | |
| 3073 | + | |
| 3074 | + | |
| 3075 | + | |
| 3076 | + | |
| 3077 | + | |
| 3078 | + | |
| 3079 | + | |
| 3080 | + | |
| 3081 | + | |
| 3082 | + | |
| 3083 | + | |
3056 | 3084 | | |
3057 | 3085 | | |
3058 | | - | |
| 3086 | + | |
3059 | 3087 | | |
3060 | 3088 | | |
3061 | 3089 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
12 | 15 | | |
13 | 16 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
38 | 55 | | |
39 | 56 | | |
40 | | - | |
| 57 | + | |
41 | 58 | | |
42 | 59 | | |
0 commit comments