Skip to content

type_alias_impl_trait ICE: Non-defining use of DefId #77987

Closed

Description

Code

#![feature(min_type_alias_impl_trait)]
#![feature(type_alias_impl_trait)]

trait Foo<T> {}
impl<T, U> Foo<T> for U {} 

type Scope = impl Foo<()>;

#[allow(unused)]
fn infer_scope() -> Scope { 
    ()
}

#[allow(unused)]
fn ice() -> impl Foo<Scope>
{
    loop {}
}

Meta

rustc --version --verbose:

rustc 1.49.0-nightly (e160e5cb8 2020-10-14)
binary: rustc
commit-hash: e160e5cb80652bc2afe74cb3affbe35b74243ea9
commit-date: 2020-10-14
host: x86_64-unknown-linux-gnu
release: 1.49.0-nightly
LLVM version: 11.0

Error output

error: internal compiler error: Non-defining use of DefId(0:9 ~ foo[a0d1]::Scope::{opaque#0}) with revealed type
  --> src/lib.rs:14:1
   |
14 | / fn ice() -> impl Foo<Scope>
15 | | {
16 | |     loop {}
17 | | }
   | |_^
   |
   = note: delayed at compiler/rustc_mir/src/borrow_check/type_check/mod.rs:1278:46

error: internal compiler error: errors selecting obligation during MIR typeck: [FulfillmentError(Obligation(predicate=TraitPredicate(<_ as std::marker::Sized>), depth=0),Ambiguity), FulfillmentError(Obligation(predicate=TraitPredicate(<_ as Foo<()>>), depth=0),Ambiguity), FulfillmentError(Obligation(predicate=TraitPredicate(<_ as std::marker::Sized>), depth=1),Ambiguity)]
  |
  = note: delayed at /rustc/e160e5cb80652bc2afe74cb3affbe35b74243ea9/compiler/rustc_trait_selection/src/traits/query/type_op/custom.rs:84:37
Backtrace

thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', compiler/rustc_errors/src/lib.rs:961:13
stack backtrace:
   0: rust_begin_unwind
             at /rustc/e160e5cb80652bc2afe74cb3affbe35b74243ea9/library/std/src/panicking.rs:483:5
   1: std::panicking::begin_panic_fmt
             at /rustc/e160e5cb80652bc2afe74cb3affbe35b74243ea9/library/std/src/panicking.rs:437:5
   2: rustc_errors::HandlerInner::flush_delayed
   3: <rustc_errors::HandlerInner as core::ops::drop::Drop>::drop
   4: core::ptr::drop_in_place
   5: <alloc::rc::Rc<T> as core::ops::drop::Drop>::drop
   6: core::ptr::drop_in_place
   7: rustc_span::with_source_map
   8: scoped_tls::ScopedKey<T>::set

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.glacierICE tracked in rust-lang/glacier.requires-nightlyThis issue requires a nightly compiler in some way.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions