Skip to content

Compiler bad error message: E0277 error in Diesel #58968

Open
@JCapucho

Description

@JCapucho

I tried this code:

pub fn establish_connection(database_url: &str) -> Pool<PgConnection> {
        let manager = ConnectionManager::<PgConnection>::new(database_url);
        Pool::builder()
                .build(manager)
                .expect(&format!("Error connecting to {}", database_url))
}

And was expecting to get an error message something like:

Expected Pool<ConnectionManager<PgConnection>> got Pool<PgConnection>

Instead i got an misleading error:

the trait `diesel::r2d2::ManageConnection` is not implemented for `diesel::PgConnection`

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions