Closed
Description
Recent rust nigthly version can't compile previously working code, duo to compiler not being able to find associated type inside a "async fn in trait" definition.
Code
Compiling this code:
#![allow(async_fn_in_trait)]
pub trait foo {}
pub trait bar {
type foo: foo;
}
pub trait baz {
async fn boom<X: bar>() -> Result<(), X::foo>;
}
I expected to see this happen: In previous version up to nightly-2024-10-28
this code compiled
Instead, this happened: It stoped compiling with the error
error[E0220]: associated type `foo` not found for `X`
8 | async fn boom<X: bar>() -> Result<(), X::foo>;
| ^^^ there is an associated type `foo` in the trait `bar`
Version it worked on
nightly-2024-10-28
Version with regression
nightly-2024-10-29
rustc --version --verbose
:
rustc 1.84.0-nightly (1e4f10ba6 2024-10-29)
binary: rustc
commit-hash: 1e4f10ba6476e48a42a79b9f846a2d9366525b9e
commit-date: 2024-10-29
host: x86_64-unknown-linux-gnu
release: 1.84.0-nightly
LLVM version: 19.1.1
No, code just stops compiling.
Metadata
Metadata
Assignees
Labels
Area: Associated items (types, constants & functions)Area: Type systemCategory: This is a bug.Status: A bisection has been found for this issueStatus: A Minimal Complete and Verifiable Example has been found for this issueRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.Performance or correctness regression from stable to nightly.