Skip to content

Update the examples for E0191 #115042

Closed
@mu001999

Description

@mu001999

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-docsArea: Documentation for any part of the project, including the compiler, standard library, and tools

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions