Skip to content

Update the examples for E0191 #115042

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mu001999 opened this issue Aug 21, 2023 · 0 comments · Fixed by #115054
Closed

Update the examples for E0191 #115042

mu001999 opened this issue Aug 21, 2023 · 0 comments · Fixed by #115054
Labels
A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools

Comments

@mu001999
Copy link
Contributor

Location

https://doc.rust-lang.org/error_codes/E0191.html

Trait objects need to have all associated types specified. Please verify that all associated types of the trait were specified and the correct trait was used. Example:

trait Trait {
    type Bar;
}

type Foo = Trait<Bar=i32>; // ok!

Summary

But according to E0782, trait objects must include the dyn keyword:

error[[E0782]](https://doc.rust-lang.org/stable/error_codes/E0782.html): trait objects must include the `dyn` keyword
 --> src/lib.rs:5:12
  |
5 | type Foo = Trait<Bar=i32>; // ok!
  |            ^^^^^^^^^^^^^^
  |
help: add `dyn` keyword before this trait
  |
5 | type Foo = dyn Trait<Bar=i32>; // ok!
  |            +++

For more information about this error, try `rustc --explain E0782`.
error: could not compile `playground` (lib) due to previous error

I think the examples for E0191 should be updated.

@mu001999 mu001999 added the A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools label Aug 21, 2023
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Aug 21, 2023
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Aug 21, 2023
…, r=compiler-errors

Fix syntax in E0191 explanation.

This trait needs `dyn` in modern Rust.

Fixes rust-lang#115042.
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Aug 21, 2023
…, r=compiler-errors

Fix syntax in E0191 explanation.

This trait needs `dyn` in modern Rust.

Fixes rust-lang#115042.
@bors bors closed this as completed in fd2982c Aug 21, 2023
@Noratrieb Noratrieb removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Aug 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants