Skip to content

Nightly associated types regression E0284 #163550

Closed

Description

@LucaCappelletti94

Code

I tried this code:

pub trait Matrix {
    type Coordinates;
}

pub trait Matrix2D: Matrix<Coordinates = <Self as Matrix2D>::RowIndex> {
    type RowIndex;
}

pub trait Transposable<T: Matrix2D<RowIndex = Self::RowIndex>>: Matrix2D {
    fn transpose(&self) -> T;
}

Should compile, parse cargo check as it currently does on stable.

Currently, it rejects code that works nominally in stable.

error[E0284]: type annotations needed
  --> src/lib.rs:10:5
   |
10 |     fn transpose(&self) -> T;
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type
   |
   = note: cannot satisfy `<T as Matrix2D>::RowIndex == _`

For more information about this error, try `rustc --explain E0284`.

Version it worked on

rustc 1.101.0-nightly (c1070d693 2026-09-28)
binary: rustc
commit-hash: c1070d69382b8d2f2eb65119c738a77d9e324c9e
commit-date: 2026-09-28
host: x86_64-unknown-linux-gnu
release: 1.101.0-nightly
LLVM version: 23.1.1

Version with regression

rustc 1.101.0-nightly (5c543b0b8 2026-09-29)
binary: rustc
commit-hash: 5c543b0b8c73c7b72bc8284ced4fb22ead15734d
commit-date: 2026-09-29
host: x86_64-unknown-linux-gnu
release: 1.101.0-nightly
LLVM version: 23.1.1

searched nightlies: from nightly-2026-09-29 to nightly-2026-09-30
regressed nightly: nightly-2026-09-30
searched commit range: c1070d6...5c543b0
regressed commit: b46c90c

bisected with cargo-bisect-rustc v0.6.11

Host triple: x86_64-unknown-linux-gnu
Reproduce with:

cargo bisect-rustc --start 2026-09-29 --end 2026-09-30 --regress error -- check 

Backtrace

Backtrace

RUST_BACKTRACE=1 rustc +nightly-2026-09-30 --crate-type=lib -Ztreat-err-as-bug=1 src/lib.rs

stack backtrace:
   0: __rustc::rust_begin_unwind
   1: core::panicking::panic_fmt
   2: <rustc_errors::DiagCtxtInner>::panic_if_treat_err_as_bug
   3: <rustc_errors::DiagCtxtInner>::emit_diagnostic::{closure#3}
   4: rustc_interface::callbacks::track_diagnostic::<core::option::Option<rustc_span::ErrorGuaranteed>>
   5: <rustc_errors::DiagCtxtInner>::emit_diagnostic
   6: <rustc_errors::DiagCtxtHandle>::emit_diagnostic
   7: <rustc_errors::diagnostic::Diag>::emit_err
   8: <rustc_trait_selection::error_reporting::TypeErrCtxt>::maybe_report_ambiguity
   9: <rustc_trait_selection::error_reporting::TypeErrCtxt>::report_fulfillment_error
  10: <rustc_trait_selection::error_reporting::TypeErrCtxt>::report_fulfillment_errors
  11: rustc_trait_selection::traits::do_normalize_clauses
  12: rustc_trait_selection::traits::normalize_param_env_or_error
  13: rustc_trait_selection::traits::dyn_compatibility::virtual_call_violations_for_method
  14: rustc_trait_selection::traits::dyn_compatibility::dyn_compatibility_violations_for_assoc_item
  [15-16: iterator adapters in dyn_compatibility_violations_for_trait]
  17: rustc_trait_selection::traits::dyn_compatibility::dyn_compatibility_violations
  18: rustc_trait_selection::traits::dyn_compatibility::is_dyn_compatible
  19: <rustc_lint::BuiltinCombinedLateLintModPass as rustc_lint::passes::LateLintPass>::check_item
  20: <rustc_lint::late::LateContextAndPass<rustc_lint::BuiltinCombinedLateLintModPass> as rustc_hir::intravisit::Visitor>::visit_nested_item
  21: rustc_lint::lint_mod
  [22-31: query system and driver]

query stack during panic:
#0 [dyn_compatibility_violations] determining dyn-compatibility of trait `Transposable`
#1 [is_dyn_compatible] checking if trait `Transposable` is dyn-compatible
#2 [lint_mod] linting top-level module
#3 [analysis] running analysis passes on crate `lib`
end of query stack

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

Activity

  1. added
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    I-prioritizeIssue needs a team member to assess the impact. Will be replaced by P-{low,medium,high,critical}
    and removed
    regression-untriagedUntriaged performance or correctness regression.
    on Sep 30, 2026
  2. maxdexh commented on Sep 30, 2026

    @maxdexh
    Member

    Oh wow, fresh from the tap.

    This one also happens with -Znext-solver=coherence, so it's a regression independent from the switch to next-solver!

    @rustbot label S-has-bisection A-inference T-types T-compiler

  3. added
    S-has-bisectionStatus: A bisection has been found for this issue
    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 Sep 30, 2026
  4. maxdexh commented on Sep 30, 2026

    @maxdexh
    Member

    Probably #162655.

    The return type on transpose(&self) is not necessary for the error.

  5. lqd commented on Sep 30, 2026

    @lqd
    Member

    This should be from #163200 cc @dianne

  6. maxdexh commented on Sep 30, 2026

    @maxdexh
    Member

    Oh yeah that makes more sense ^^

  7. self-assigned this
    on Sep 30, 2026
  8. removed
    I-prioritizeIssue needs a team member to assess the impact. Will be replaced by P-{low,medium,high,critical}
    on Oct 7, 2026
  9. rustbot commented on Oct 7, 2026

    @rustbot
    Collaborator

    Assigning P-high (discussion on Zulip).

  10. removed
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Oct 7, 2026
  11. added 4 commits that reference this issue on Oct 8, 2026
  12. added a commit that references this issue on Oct 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

A-inferenceArea: Type inferenceC-bugCategory: This is a bug.P-highHigh priorityS-has-bisectionStatus: A bisection has been found for this issueT-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-nightlyPerformance or correctness regression from stable to nightly.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions