Skip to content

"No def'n found for DefId" ICE for impl appearing before trait declaration that includes an associated type #20371

Closed
@huonw

Description

@huonw
#![feature(associated_types)]
impl X for f64 { type Y = int; }
trait X {type Y; }
//impl X for f64 { type Y = int; }
fn main() {}

gives

error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: http://doc.rust-lang.org/complement-bugreport.html
note: run with `RUST_BACKTRACE=1` for a backtrace
thread 'rustc' panicked at 'No def'n found for DefId { krate: 0, node: 13 } in tcx.impl_or_trait_items', /build/rust-git/src/rust/src/librustc/middle/ty.rs:4801

Swapping the comments on the impls removes the ICE. Similar to #18611.

(Side note: the above test case started as 46KB of source, but creduce only took two minutes to reduce to basically the above; very cool.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-associated-itemsArea: Associated items (types, constants & functions)I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions