You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
suggestion to use generic parameter in case of "error[E0782]: trait objects must include the dyn keyword" #125139
error[E0782]: trait objects must include the `dyn` keyword
--> src/lib.rs:7:15
|
7 | fn view(_: &StateTrait) -> Vec<Self>;| ^^^^^^^^^^
|
help: add `dyn` keyword before this trait
|
7 | fn view(_: &dyn StateTrait) -> Vec<Self>;| +++
error: aborting due to previous error
For more information about this error, try `rustc --explain E0782`.
Desired output
error[E0782]: trait objects must include the `dyn` keyword for dynamic dispatch
--> src/lib.rs:7:15
|
7 | fn view(_: &StateTrait) -> Vec<Self>;| ^^^^^^^^^^
|
help: add `dyn` keyword before this trait
|
7 | fn view(_: &dyn StateTrait) -> Vec<Self>;| +++
error: aborting due to previous error
For more information about this error, try `rustc --explain E0782`.
error[????]: use a generic parameter for the trait objects for static dispatch
--> src/lib.rs:7:15
|
7 | fn view(_: &StateTrait) -> Vec<Self>;| ^^^^^^^^^^
|
help: add `dyn` keyword before this trait
|
7 | fn view<S: StateTrait>(_: &S) -> Vec<Self>;| +++
error: aborting due to previous error
For more information about this error, try `rustc --explain ????`.
changed the title [-]error[E0782]: trait objects must include the `dyn` keyword[/-][+]suggestion to use generic parameter in case of "error[E0782]: trait objects must include the `dyn` keyword"[/+]on May 15, 2024
Help text could be combined instead of throwing a separate error to increase readability and show association between suggestions.
error[E0782]: trait objects must include the `dyn` keyword for dynamic dispatch
--> src/lib.rs:7:15
|
7 | fn view(_: &StateTrait) -> Vec<Self>;| ^^^^^^^^^^
|
help: add `dyn` keyword before this trait
|
7 | fn view(_: &dyn StateTrait) -> Vec<Self>;| +++
help: or use a generic parameter for static dispatch
|
7 | fn view<S: StateTrait>(_: &S) -> Vec<Self>;| +++++++++++++++
error: aborting due to previous error
For more information about this error, try `rustc --explain E0782`.
Activity
[-]error[E0782]: trait objects must include the `dyn` keyword[/-][+]suggestion to use generic parameter in case of "error[E0782]: trait objects must include the `dyn` keyword"[/+]HaydenAtFoxHaven commentedon May 15, 2024
Help text could be combined instead of throwing a separate error to increase readability and show association between suggestions.
fmease commentedon May 15, 2024
Huh, I think we did suggest that at some point (well, at least suggesting adding
implnext to existingdynsuggestion).veera-sivarajan commentedon Jul 9, 2024
@rustbot claim
Rollup merge of rust-lang#127692 - veera-sivarajan:bugfix-125139, r=e…
Rollup merge of rust-lang#127692 - veera-sivarajan:bugfix-125139, r=e…
Rollup merge of rust-lang#127692 - veera-sivarajan:bugfix-125139, r=e…
Unrolled build for rust-lang#127692