Skip to content

regression: error[E0119]: conflicting implementations of trait AsStr for type String #134708

Closed as not planned

Description

@cuviper
[INFO] [stdout] error[E0119]: conflicting implementations of trait `AsStr` for type `String`
[INFO] [stdout]  --> examples/basic.rs:3:1
[INFO] [stdout]   |
[INFO] [stdout] 3 | #[delegate]
[INFO] [stdout]   | ^^^^^^^^^^^ conflicting implementation for `String`
[INFO] [stdout] ...
[INFO] [stdout] 8 | impl AsStr for String {
[INFO] [stdout]   | --------------------- first implementation here
[INFO] [stdout]   |
[INFO] [stdout]   = note: upstream crates may add a new impl of trait `temporary_enum_delegate_0_3_0::__macros::Convert` for type `std::string::String` in future versions
[INFO] [stdout]   = note: upstream crates may add a new impl of trait `temporary_enum_delegate_0_3_0::__macros::Bound<259758991428806249286467916654556560740, 268186603860731246084428674422145461480, 3, 1>` for type `std::string::String` in future versions
[INFO] [stdout]   = note: this error originates in the attribute macro `delegate` (in Nightly builds, run with -Z macro-backtrace for more info)
[INFO] [stdout] 
[INFO] [stdout] 
[INFO] [stdout] For more information about this error, try `rustc --explain E0119`.
[INFO] [stdout] 
[INFO] [stderr] error: could not compile `temporary_enum_delegate_0_3_0` (example "basic") due to 1 previous error

Version it worked on

It most recently worked on: 1.83.0

Version with regression

Using rustc 1.84.0-beta.4 in crater #134138.

@rustbot modify labels: +regression-from-stable-to-beta -regression-untriaged

Activity

  1. added
    C-bugCategory: This is a bug.
    regression-untriagedUntriaged performance or correctness regression.
    on Dec 23, 2024
  2. added
    I-prioritizeIssue needs a team member to assess the impact. Will be replaced by P-{low,medium,high,critical}
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    and removed
    regression-untriagedUntriaged performance or correctness regression.
    on Dec 23, 2024
  3. compiler-errors commented on Dec 23, 2024

    @compiler-errors
    Contributor

    @lcnr: do you remember if this is known breakage from #130654? This seems coherence related 🤔

  4. lcnr commented on Dec 23, 2024

    @lcnr
    Contributor

    looking at the expansion, this feels like it's #114061

    trait AsStr {}
    impl<D> AsStr for D
    where
        D: upstream::Convert + upstream::Bound<{ AsStr.0 }, { AsStr.1 }, { AsStr.2 }, { AsStr.3 }>,
        <D as upstream::Convert>::Owned: AsStr__DelegateOwned,
        for<'d> <D as upstream::Convert>::Ref<'d>: AsStr__DelegateRef<'d>,
        for<'d> <D as upstream::Convert>::RefMut<'d>: AsStr__DelegateRefMut<'d>,
    {
    }
    
    impl AsStr for std::string::String {}

    std::string::String: upstream::Convert fails the is_knowable check and should do so. This means that all these trait bounds have an unknown type as the self-type and have to be ambiguous. After-all, upstream could implement String: Convert with arbitrary associated types.

  5. added this to the 1.84.0 milestone on Dec 24, 2024
  6. changed the title [-]regression: conflicting implementations of trait `AsStr` for type `String`[/-] [+]regression: error[E0119]: conflicting implementations of trait `AsStr` for type `String`[/+] on Dec 24, 2024
  7. added
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    T-typesRelevant to the types team, which will review and decide on the PR/issue.
    on Dec 24, 2024
  8. Mark-Simulacrum commented on Jan 3, 2025

    @Mark-Simulacrum
    Member

    Closing as a known and relnotes'd soundness fix.

  9. removed
    I-prioritizeIssue needs a team member to assess the impact. Will be replaced by P-{low,medium,high,critical}
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Jan 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.T-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

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions