Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

type_alias_impl_trait ICE: Non-defining use of DefId #77987

Closed
jswrenn opened this issue Oct 15, 2020 · 0 comments · Fixed by #94081
Closed

type_alias_impl_trait ICE: Non-defining use of DefId #77987

jswrenn opened this issue Oct 15, 2020 · 0 comments · Fixed by #94081
Labels
C-bug Category: This is a bug. glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@jswrenn
Copy link
Member

jswrenn commented Oct 15, 2020

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

@jswrenn jswrenn added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Oct 15, 2020
@jonas-schievink jonas-schievink added F-type_alias_impl_trait `#[feature(type_alias_impl_trait)]` requires-nightly This issue requires a nightly compiler in some way. labels Oct 15, 2020
@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label Oct 15, 2020
@jackh726 jackh726 added F-min_type_alias_impl_trait and removed F-type_alias_impl_trait `#[feature(type_alias_impl_trait)]` labels Jun 29, 2021
@bors bors closed this as completed in f132bcf Mar 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants