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

nightly compiler panic with type-annotated array of impl Generator #58504

Closed
anderspapitto opened this issue Feb 15, 2019 · 1 comment · Fixed by #87383
Closed

nightly compiler panic with type-annotated array of impl Generator #58504

anderspapitto opened this issue Feb 15, 2019 · 1 comment · Fixed by #87383
Labels
-Zvalidate-mir Unstable option: MIR validation A-coroutines Area: Coroutines A-impl-trait Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch. A-MIR Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html C-bug Category: This is a bug. F-coroutines `#![feature(coroutines)]` F-impl_trait_in_bindings `#![feature(impl_trait_in_bindings)]` F-never_type `#![feature(never_type)]` 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

@anderspapitto
Copy link
Contributor

anderspapitto commented Feb 15, 2019

playground link:

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

Code:

#![feature(never_type)]
#![feature(impl_trait_in_bindings)]
#![feature(generators,generator_trait)]

use std::ops::Generator;

fn mk_gen() -> impl Generator<Return=!, Yield=()> {
    || { loop { yield; } }
}

fn main() {
    let gens: [impl Generator<Return=!, Yield=()>;2] = [ mk_gen(), mk_gen() ];
}

Error:

   Compiling playground v0.0.1 (/playground)
warning: unused variable: `gens`
  --> src/main.rs:12:9
   |
12 |     let gens: [impl Generator<Return=!, Yield=()>;2] = [ mk_gen(), mk_gen() ];
   |         ^^^^ help: consider prefixing with an underscore: `_gens`
   |
   = note: #[warn(unused_variables)] on by default

error: internal compiler error: broken MIR in DefId(0/0:5 ~ playground[c9b6]::main[0]) (_1 = [move _2, move _3]): bad assignment ([impl std::ops::Generator; 2] = [impl std::ops::Generator; 2]): NoSolution
  --> src/main.rs:12:56
   |
12 |     let gens: [impl Generator<Return=!, Yield=()>;2] = [ mk_gen(), mk_gen() ];
   |                                                        ^^^^^^^^^^^^^^^^^^^^^^

thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', src/librustc_errors/lib.rs:354:17
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
             at src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:39
   1: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:70
   2: std::panicking::default_hook::{{closure}}
             at src/libstd/sys_common/backtrace.rs:58
             at src/libstd/panicking.rs:200
   3: std::panicking::default_hook
             at src/libstd/panicking.rs:215
   4: rustc::util::common::panic_hook
   5: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:482
   6: std::panicking::begin_panic
   7: <rustc_errors::Handler as core::ops::drop::Drop>::drop
   8: core::ptr::real_drop_in_place
   9: core::ptr::real_drop_in_place
  10: core::ptr::real_drop_in_place
  11: <scoped_tls::ScopedKey<T>>::set
query stack during panic:
end of query stack

error: internal compiler error: unexpected panic

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

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.34.0-nightly (f47ec2ad5 2019-02-14) running on x86_64-unknown-linux-gnu

note: compiler flags: -C codegen-units=1 -C debuginfo=2 --crate-type bin

note: some of the compiler flags provided by cargo are hidden

error: Could not compile `playground`.

To learn more, run the command again with --verbose.

Note that there is no compiler panic if the array is of size 1, or if the explicit type annotation on gens is omitted

@anderspapitto anderspapitto changed the title nightly compiler panic with array of impl Generator nightly compiler panic with type-annotated array of impl Generator Feb 15, 2019
@jonas-schievink jonas-schievink added 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. C-bug Category: This is a bug. A-coroutines Area: Coroutines labels Feb 15, 2019
@matthewjasper matthewjasper added the A-impl-trait Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch. label Feb 16, 2019
@csmoe csmoe added the A-MIR Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html label Feb 27, 2019
@Centril Centril added F-impl_trait_in_bindings `#![feature(impl_trait_in_bindings)]` F-coroutines `#![feature(coroutines)]` F-never_type `#![feature(never_type)]` requires-nightly This issue requires a nightly compiler in some way. labels Jul 28, 2019
@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label Oct 15, 2019
@estebank
Copy link
Contributor

Triage: no change.

@jonas-schievink jonas-schievink added the -Zvalidate-mir Unstable option: MIR validation label Feb 20, 2021
JohnTitor added a commit to JohnTitor/rust that referenced this issue Jul 23, 2021
…sts, r=oli-obk

Add regression tests for the impl_trait_in_bindings ICEs

Closes rust-lang#54600, closes rust-lang#54840, closes rust-lang#58504, closes rust-lang#58956, closes rust-lang#70971, closes rust-lang#79099, closes rust-lang#84919, closes rust-lang#86201, closes rust-lang#86642, closes rust-lang#87295

r? `@oli-obk`
@bors bors closed this as completed in 7c0c329 Jul 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
-Zvalidate-mir Unstable option: MIR validation A-coroutines Area: Coroutines A-impl-trait Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch. A-MIR Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html C-bug Category: This is a bug. F-coroutines `#![feature(coroutines)]` F-impl_trait_in_bindings `#![feature(impl_trait_in_bindings)]` F-never_type `#![feature(never_type)]` 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.

7 participants