Skip to content

Conversation

@rynewang
Copy link
Owner

@rynewang rynewang commented Feb 7, 2026

Summary

Fix ICE when using return type notation (RTN) through a trait alias.

Problem

#![feature(return_type_notation, trait_alias)]
trait Tr { fn f() -> impl Sized; }
trait Al = Tr;
fn f<T: Al<f(..): Copy>>() {}

ICEs with span_delayed_bug("bad return type notation here").

Root Cause

Two places in resolve_bound_vars.rs only check for DefKind::Trait but not DefKind::TraitAlias:

  1. The type_def_id resolution match
  2. The RTN guard condition

Fix

Add DefKind::TraitAlias to both locations. supertrait_hrtb_vars() already handles trait aliases.

Includes regression test.

Fixes rust-lang#152158

@rynewang rynewang force-pushed the fix/ice-152158-rtn-trait-alias branch 4 times, most recently from 867b1a8 to 9433d7b Compare February 7, 2026 23:05
Handle DefKind::TraitAlias in resolve_bound_vars so that associated
item constraints and return type notation work through trait aliases.
@rynewang rynewang force-pushed the fix/ice-152158-rtn-trait-alias branch from 9433d7b to 7c5ea7f Compare February 8, 2026 02:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ICE due to RBV not handling RTN where trait is behind trait alias

1 participant