Skip to content

Shorthand projections inside RPITITs fail to resolve #132372

Closed
@Vollbrecht

Description

@Vollbrecht

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

Labels

A-associated-itemsArea: Associated items (types, constants & functions)A-type-systemArea: Type systemC-bugCategory: This is a bug.S-has-bisectionStatus: A bisection has been found for this issueS-has-mcveStatus: A Minimal Complete and Verifiable Example 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