Closed
Description
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
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
alexreg commentedon Mar 8, 2019
Thanks for the report. I don't think the fix for this is too difficult judging by your example. Unfortunately, I'm very busy right now. You've contributed to rustc before, if I'm not mistaken... would you be interested in taking up this fix if I mentored/reviewed?
seanmonstar commentedon Mar 8, 2019
@alexreg I'd be happy to help. I spent a couple hours last night trying to figure out how to work on the related "import methods" issue, and was completely at a loss of how to find it.
alexreg commentedon Mar 9, 2019
@seanmonstar Super! I'd like to tackle method importing for both trait aliases and maybe type aliases too, but due to my lack of experience in that area, I'll probably need to chat it over with someone first. (@rust-lang/compiler, any ideas who would be good for this?)
This issue should be no problem though. Would you like me to post some general suggestions/pointers here, or chat about it? I'm on Discord/Zulip if you prefer the latter.
seanmonstar commentedon Mar 9, 2019
@alexreg If you wouldn't mind leaving pointers here, it'll be easier to find later (like Monday). Or maybe someone can beat me to it. I got to this line from the panic message at least:
rust/src/librustc/hir/map/mod.rs
Line 546 in b2ea6c8
alexreg commentedon Mar 11, 2019
@seanmonstar Unfortunately I didn't get a chance to have a proper look at this on the weekend, but I've just looked quickly, and I'm hoping the fix may be as easy as matching
ItemKind::TraitAlias
as well asItemKind::Trait
onrust/src/librustc/hir/map/mod.rs
Line 544 in b2ea6c8
If that's not enough to fix it (may well not be), have a peek around the
type_param_predicates
fn incollect.rs
and try handling trait aliases in an analogous way to traits.Let me know what this yields.
alexreg commentedon Mar 11, 2019
@Centril Did you nominate this because of my questions about importing or what?
Centril commentedon Mar 11, 2019
@alexreg I-ICEs are generally nominated for triage I think.
alexreg commentedon Mar 11, 2019
Okay.
13 remaining items