Repository navigation
Nightly associated types regression E0284 #163550
Copy link
Copy link
Closed
Labels
A-inferenceArea: Type inferenceArea: Type inferenceC-bugCategory: This is a bug.Category: This is a bug.P-highHigh priorityHigh priorityS-has-bisectionStatus: A bisection has been found for this issueStatus: A bisection has been found for this issueT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant 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.Relevant 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.Performance or correctness regression from stable to nightly.
Description
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
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-inferenceArea: Type inferenceArea: Type inferenceC-bugCategory: This is a bug.Category: This is a bug.P-highHigh priorityHigh priorityS-has-bisectionStatus: A bisection has been found for this issueStatus: A bisection has been found for this issueT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant 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.Relevant 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.Performance or correctness regression from stable to nightly.
Activity
maxdexh commentedon Sep 30, 2026
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
maxdexh commentedon Sep 30, 2026
Probably #162655.The return type on
transpose(&self)is not necessary for the error.lqd commentedon Sep 30, 2026
This should be from #163200 cc @dianne
maxdexh commentedon Sep 30, 2026
Oh yeah that makes more sense ^^
rustbot commentedon Oct 7, 2026
Assigning P-high (discussion on Zulip).
Rollup merge of rust-lang#163958 - dianne:fix-rustaceansareawesome-ta…
Rollup merge of rust-lang#163958 - dianne:fix-rustaceansareawesome-ta…
Rollup merge of rust-lang#163958 - dianne:fix-rustaceansareawesome-ta…
Rollup merge of rust-lang#163958 - dianne:fix-rustaceansareawesome-ta…
Unrolled build for #163958 in rollup 164005
Rollup merge of #163958 - dianne:fix-rustaceansareawesome-take-2-part…