Skip to content

ICE with trait alias when alias refers to bare Self #59029

Closed
@seanmonstar

Description

@seanmonstar
trait Svc<Req> {
    type Res;
}

// ICEs:
trait MkSvc<Target, Req> = Svc<Target> where Self::Res: Svc<Req>;

// works:
// trait MkSvc<Target, Req> = Svc<Target> where <Self as Svc<Target>>::Res: Svc<Req>;

Related playground: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=e29c998d2dc1d0c0ef60f4f3bd5ae934

The compiler outputs:

error: internal compiler error: src/librustc/hir/map/mod.rs:546: ty_param_owner: trait alias MkSvc (id=17) not a type parameter

thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:620:9
note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
error: aborting due to previous error

note: the compiler unexpectedly panicked. this is a bug.

note: rustc 1.35.0-nightly (88f755f8a 2019-03-07) running on x86_64-unknown-linux-gnu

cc #41517

Metadata

Metadata

Assignees

Labels

A-trait-systemArea: Trait systemC-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-highHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions