Skip to content

1.97 beta regression: "conflicting implementations of trait" #157407

Closed

Description

@theemathas

This regression was discovered by the 1.97 beta crater run.

[INFO] [stdout] error[E0119]: conflicting implementations of trait `FromRow<'_, PgRow>` for type `ChallengeRecord`
[INFO] [stdout]    --> src/activities.rs:58:37
[INFO] [stdout]     |
[INFO] [stdout]  58 | #[derive(Clone, Debug, Deserialize, FromRow, PartialEq, Serialize)]
[INFO] [stdout]     |                                     ^^^^^^^ conflicting implementation for `ChallengeRecord`
[INFO] [stdout] ...
[INFO] [stdout] 114 | impl FromRow<'_, PgRow> for ChallengeRecord {
[INFO] [stdout]     | ------------------------------------------- first implementation here
[INFO] [stdout]     |
[INFO] [stdout]     = note: downstream crates may implement trait `sqlx::Decode<'_, _>` for type `activities::ActivityType`
[INFO] [stdout]     = note: downstream crates may implement trait `sqlx::Type<_>` for type `activities::ActivityType`
[INFO] [stdout]     = note: this error originates in the derive macro `FromRow` (in Nightly builds, run with -Z macro-backtrace for more info)

https://crater-reports.s3.amazonaws.com/beta-1.97-3-v2/1.97.0-beta.1/gh/njbartlett.pfnext-shuttle/log.txt

Activity

  1. added
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Jun 4, 2026
  2. added
    E-needs-bisectionCall for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc
    E-needs-mcveCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example
    on Jun 4, 2026
  3. added
    I-prioritizeIssue needs a team member to assess the impact. Will be replaced by P-{low,medium,high,critical}
    on Jun 4, 2026
  4. theemathas commented on Jun 5, 2026

    @theemathas
    ContributorAuthor

    Smaller reproducer:

    [package]
    name = "repro"
    version = "0.1.0"
    edition = "2024"
    
    [dependencies]
    sqlx = { version = "0.9.0", features = ["postgres"] }
    use sqlx::decode::Decode;
    use sqlx::postgres::PgRow;
    use sqlx::{Error, FromRow, Row};
    
    pub struct ActivityType;
    
    pub struct ChallengeRecord;
    
    impl FromRow<'_, PgRow> for ChallengeRecord {
        fn from_row(_: &'_ PgRow) -> Result<Self, Error> {
            todo!()
        }
    }
    
    impl<'a, R: Row> FromRow<'a, R> for ChallengeRecord
    where
        ActivityType: Decode<'a, R::Database>,
    {
        fn from_row(__row: &'a R) -> sqlx::Result<Self> {
            todo!()
        }
    }

    Error on beta:

    error[E0119]: conflicting implementations of trait `FromRow<'_, PgRow>` for type `ChallengeRecord`
      --> src/lib.rs:15:1
       |
     9 |   impl FromRow<'_, PgRow> for ChallengeRecord {
       |   ------------------------------------------- first implementation here
    ...
    15 | / impl<'a, R: Row> FromRow<'a, R> for ChallengeRecord
    16 | | where
    17 | |     ActivityType: Decode<'a, R::Database>,
       | |__________________________________________^ conflicting implementation for `ChallengeRecord`
       |
       = note: downstream crates may implement trait `sqlx::Decode<'_, _>` for type `ActivityType`
    
    For more information about this error, try `rustc --explain E0119`.
    error: could not compile `repro` (lib) due to 1 previous error
    
  5. added
    T-typesRelevant to the types team, which will review and decide on the PR/issue.
    on Jun 5, 2026
  6. theemathas commented on Jun 5, 2026

    @theemathas
    ContributorAuthor

    Minimized:

    dep/src/lib.rs

    pub trait Row {
        type Database;
    }
    
    pub struct PgRow;

    src/lib.rs

    use dep::{PgRow, Row};
    
    pub trait FromRow {}
    pub trait Decode<T> {}
    
    pub struct ActivityType;
    
    impl FromRow for PgRow {}
    
    impl<R: Row> FromRow for R where ActivityType: Decode<R::Database> {}

    Error output on beta

    error[E0119]: conflicting implementations of trait `FromRow` for type `PgRow`
      --> src/lib.rs:10:1
       |
     8 | impl FromRow for PgRow {}
       | ---------------------- first implementation here
     9 |
    10 | impl<R: Row> FromRow for R where ActivityType: Decode<R::Database> {}
       | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `PgRow`
       |
       = note: upstream crates may add a new impl of trait `dep::Row` for type `dep::PgRow` in future versions
       = note: downstream crates may implement trait `Decode<_>` for type `ActivityType`
    
    For more information about this error, try `rustc --explain E0119`.
    
  7. added
    S-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issue
    and removed
    E-needs-mcveCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example
    on Jun 5, 2026
  8. theemathas commented on Jun 5, 2026

    @theemathas
    ContributorAuthor

    Bisection results:

    searched toolchains 4c4205163abcbd08948b3efab796c543ba1ea687 through 3bf5c6d99bc8a0c0d5b2f69826ed4f6d256a0a21
    
    
    ********************************************************************************
    Regression in a3e96d8cb8a420022828d0a595277ad3671928a7
    ********************************************************************************
    
    Attempting to search unrolled perf builds
    ERROR: couldn't find perf build comment
    

    Regressed in #155767. cc @adminwhite @lcnr

  9. 6 remaining items

  10. added
    I-types-nominatedNominated for discussion during a types team meeting.
    on Jun 8, 2026
  11. bit-aloo commented on Jun 8, 2026

    @bit-aloo
    Member

    @rustbot claim

  12. added 2 commits that reference this issue on Jun 12, 2026
    ed636d1
    4e391cf
  13. theemathas commented on Jun 13, 2026

    @theemathas
    ContributorAuthor

    Reopening to track beta backport.

  14. added a commit that references this issue on Jun 13, 2026
    359bdad
  15. apiraino commented on Jun 25, 2026

    @apiraino
    Contributor

    I assume this issue has been discussed by T-types (see comment)

    @rustbot label -i-types-nominated

  16. removed
    I-types-nominatedNominated for discussion during a types team meeting.
    on Jun 25, 2026
  17. theemathas commented on Jun 26, 2026

    @theemathas
    ContributorAuthor

    Fixed by #158420

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

A-coherenceArea: CoherenceA-trait-systemArea: Trait systemC-bugCategory: This is a bug.P-highHigh priorityS-has-bisectionStatus: A bisection has been found for this issueS-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueT-typesRelevant to the types team, which will review and decide on the PR/issue.regression-from-stable-to-betaPerformance or correctness regression from stable to beta.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions