rust-lang / rust-lang/rust

Worse error message with TAIT + next_solver

Open
#162,093 1 comment 0 reactions 1 assignee View on GitHub

@yashksaini-coder is already working on this.

Since Sep 1, 2026.

A-diagnostics D-terse F-type_alias_impl_trait T-compiler WG-trait-system-refactor
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

Code
#![feature(type_alias_impl_trait)]

#[diagnostic::on_unimplemented(message = "my custom message")]
trait Marker {}

type Ta = impl Marker;

#[define_opaque(Ta)]
fn construct() -> Ta {
    5u32
}

fn main() {}
Current output
error[E0271]: type mismatch resolving `Ta == u32`
 --> src/main.rs:9:19
  |
9 | fn construct() -> Ta {
  |                   ^^ types differ
Desired output
error[E0277]: my custom message
  --> src/main.rs:9:19
   |
 9 | fn construct() -> Ta {
   |                   ^^ the trait `Marker` is not implemented for `u32`
10 |     5u32
   |     ---- return type was inferred to be `u32` here
Rationale and extra context

With the old solver you would get the good error message "u32 doesn't implement Marker".

With the new solver it's just a type mismatch, no indication why.

A consequence of this is the #[on_unimplemented] message is not shown to the user. We were using it in embassy-executor to give better error messages, see here.

Other cases

Rust Version
rustc 1.100.0-nightly (c656540d6 2026-08-21)
binary: rustc
commit-hash: c656540d6467dee1381f0cbd882412d6bd1cd5ae
commit-date: 2026-08-21
host: x86_64-unknown-linux-gnu
release: 1.100.0-nightly
LLVM version: 23.1.0
Anything else?

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.