Skip to content

Overflow evaluating well-formedness requirement with empty trait bound on associated type #148349

Open

Description

@dschoepe

rustc 1.91.0 as well as nightly (1.93.0-nightly (2025-10-30 d5419f1e97b90741d518)) produce an overflow error when using a where clause on an associated type when the bound in the where clause is empty. While this is a pathological example, this did occur in auto-generated code (e.g. in verus).

trait SomeBound {}

trait T where
    Self::Assoc:,
    // this works:
    //Self::Assoc: SomeBound
{
    type Assoc;
}

Playground link

I expected this to compile successfully (and indeed it did on Rust 1.88).

On nightly and with 1.91 (rustc 1.91.0 (f8297e351 2025-10-28)), I get the following error:

   Compiling playground v0.0.1 (/playground)
error[E0275]: overflow evaluating the requirement `<Self as T>::Assoc well-formed`
 --> src/lib.rs:4:5
  |
4 |     Self::Assoc:,
  |     ^^^^^^^^^^^
  |
note: required by a bound in `T`
 --> src/lib.rs:4:5
  |
3 | trait T where
  |       - required by a bound in this trait
4 |     Self::Assoc:,
  |     ^^^^^^^^^^^ required by this bound in `T`

For more information about this error, try `rustc --explain E0275`.
error: could not compile `playground` (lib) due to 1 previous error

Activity

  1. added
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Oct 31, 2025
  2. added
    I-prioritizeIssue needs a team member to assess the impact. Will be replaced by P-{low,medium,high,critical}
    on Oct 31, 2025
  3. added
    E-needs-bisectionCall for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc
    on Nov 1, 2025
  4. theemathas commented on Nov 1, 2025

    @theemathas
    Contributor

    Bisection result:

    searched toolchains nightly-2025-05-09 through nightly-2025-08-02
    
    
    ********************************************************************************
    Regression in nightly-2025-05-18
    ********************************************************************************
    
    fetching https://static.rust-lang.org/dist/2025-05-17/channel-rust-nightly-git-commit-hash.txt
    nightly manifest 2025-05-17: 40 B / 40 B [=============================================] 100.00 % 73.10 KB/s converted 2025-05-17 to 16d2276fa6fccb0cc239a542d4c3f0eb46f660ec
    fetching https://static.rust-lang.org/dist/2025-05-18/channel-rust-nightly-git-commit-hash.txt
    nightly manifest 2025-05-18: 40 B / 40 B [============================================] 100.00 % 114.82 KB/s converted 2025-05-18 to 777d372772aa3b39ba7273fcb8208a89f2ab0afd
    looking for regression commit between 2025-05-17 and 2025-05-18
    fetching (via remote github) commits from max(16d2276fa6fccb0cc239a542d4c3f0eb46f660ec, 2025-05-15) to 777d372772aa3b39ba7273fcb8208a89f2ab0afd
    ending github query because we found starting sha: 16d2276fa6fccb0cc239a542d4c3f0eb46f660ec
    get_commits_between returning commits, len: 8
      commit[0] 2025-05-16: Auto merge of #140911 - rust-lang:cargo_update, r=clubby789
      commit[1] 2025-05-16: Auto merge of #140978 - davidtwco:deep-reject-in-match-norm-trait-ref, r=lcnr
      commit[2] 2025-05-17: Auto merge of #141002 - GuillaumeGomez:subtree-update_cg_gcc_2025-05-14, r=GuillaumeGomez
      commit[3] 2025-05-17: Auto merge of #141024 - jieyouxu:revert-arm64ec, r=wesleywiser
      commit[4] 2025-05-17: Auto merge of #141113 - matthiaskrgr:rollup-k7izuh8, r=matthiaskrgr
      commit[5] 2025-05-17: Auto merge of #141116 - RalfJung:miri-sync, r=RalfJung
      commit[6] 2025-05-17: Auto merge of #141133 - matthiaskrgr:rollup-u8ndxyz, r=matthiaskrgr
      commit[7] 2025-05-17: Auto merge of #138087 - tgross35:core-float-math, r=Amanieu
    ERROR: no CI builds available between 16d2276fa6fccb0cc239a542d4c3f0eb46f660ec and 777d372772aa3b39ba7273fcb8208a89f2ab0afd within last 167 days
    
  5. added
    S-has-bisectionStatus: A bisection has been found for this issue
    and removed
    E-needs-bisectionCall for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc
    on Nov 1, 2025
  6. theemathas commented on Nov 1, 2025

    @theemathas
    Contributor
  7. added
    T-typesRelevant to the types team, which will review and decide on the PR/issue.
    A-coinductionArea: Concerning coinduction, most often for auto traits
    and removed
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Nov 1, 2025
  8. lcnr commented on Nov 3, 2025

    @lcnr
    Contributor

    This is an intended change, we did not expect much breakage from it however. cc @rust-lang/types

    Is this challenging to work around on in verus? My current tendency is to close this as intended, we could stop the lowering as explicit WellFormed clauses in predicates_of but instead only check that these empty where-clauses are well-formed in item WF check to avoid this breakage here..

  9. added
    P-highHigh priority
    and removed
    I-prioritizeIssue needs a team member to assess the impact. Will be replaced by P-{low,medium,high,critical}
    on Nov 3, 2025
  10. jackh726 commented on Nov 3, 2025

    @jackh726
    Member

    I'm very curious if there is a simple fix to verus.

    Given that there is breakage here (while we did the FCP in #140208 under the presumption of no breakage), I feel a bit conflicted about just closing as intended. On one hand, this has been stable for a couple releases now. On the other hand, #140208 didn't have great motivation other than just not wanted to try to support it in the new solver.

    I think if there is a quick and simple fix to verus and we can get that landed, let's just do that. A simple fix in the compiler, regardless, would also not be the worst idea - if it's local and well thought out. I'd probably be happy to get it landed orthogonally.

    I guess, I'm not happy to just close this as intended breakage - I want some defined resolution to this.

  11. dschoepe commented on Nov 3, 2025

    @dschoepe
    Author

    Yes, this was easy to fix in verus by omitting empty bounds in the part that generates such code, but I figured I'd report it anyway.

  12. BoxyUwU commented on Nov 3, 2025

    @BoxyUwU
    Member

    I don't think the justification for making wf goals not be coinductive was "dont want to put effort into it in the new solver", it was more of a "we're not sure that this is theoretically sound" iirc. I would like to keep treating them as not coinductive which means either treating this as intended breakage or no longer lowering Ty:, bounds to wf(Ty).

    Making Ty: not lower to wf(Ty) seems fairly reasonable to me but I don't know if we might for some reason want to ensure that Ty sticks around after hir ty lowering which would make it problematic to drop altogether

  13. lcnr commented on Nov 4, 2025

    @lcnr
    Contributor

    I don't know if we might for some reason want to ensure that Ty sticks around after hir ty lowering which would make it problematic to drop altogether

    I think we do want to check that these types are well-formed. We don't have to add these requirements to predicates_of/ the param_env however, we could lower them separately and then explicitly prove them in when checking that item WF

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

    A-coinductionArea: Concerning coinduction, most often for auto traitsA-trait-systemArea: Trait systemC-bugCategory: This is a bug.P-highHigh priorityS-has-bisectionStatus: A bisection has been found for this issueT-typesRelevant to the types team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions