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

Open
anderspapitto opened this Issue Feb 15, 2019 · 0 comments

Comments

Projects
None yet
4 participants
@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

@csmoe csmoe added the A-mir label Feb 27, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.