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
    C-bug
    on Jun 4, 2026
  2. added
    needs-triage
    on Jun 4, 2026
  3. added
    regression-from-stable-to-beta
    E-needs-bisection
    E-needs-mcve
    on Jun 4, 2026
  4. added
    I-prioritize
    on Jun 4, 2026
  5. 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
    
  6. added
    T-types
    A-coherence
    A-trait-system
    on Jun 5, 2026
  7. 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`.
    
  8. added
    S-has-mcve
    and removed
    E-needs-mcve
    on Jun 5, 2026
  9. 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

  10. 6 remaining items

  11. added
    P-high
    on Jun 8, 2026
  12. added
    I-types-nominated
    on Jun 8, 2026
  13. bit-aloo commented on Jun 8, 2026

    @bit-aloo
    Member

    @rustbot claim

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

    @theemathas
    ContributorAuthor

    Reopening to track beta backport.

  16. added a commit that references this issue on Jun 13, 2026
    359bdad
  17. 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

  18. removed
    I-types-nominated
    on Jun 25, 2026
  19. 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-coherenceA-trait-systemC-bugP-highS-has-bisectionS-has-mcveT-typesregression-from-stable-to-beta

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions