rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
98.17k stars 12.7k forks source link

compiler panicked at 'Box<Any>' #61664

Closed JuanPotato closed 5 years ago

JuanPotato commented 5 years ago

Hi, I was working on a project on 1.36.0 nightly and when I upgraded to 1.37.0 nightly (rustc 1.37.0-nightly (d132f544f 2019-06-07) running on x86_64-unknown-linux-gnu) I got an internal compiler error.

https://github.com/JuanPotato/XKCD-search-bot/tree/d7624b25fbeb57975b54a19d9c8e8103b0d261a4 is the project, and the current code should cause this error

Error log
error: internal compiler error: src/librustc_mir/transform/generator.rs:532: Broken MIR: generator contains type std::option::Option in MIR, but typeck only knows about for<'r, 's, 't0, 't1, 't2> {std::sync::Arc, impl Iterator, std::collections::HashMap, std::iter::Filter, [closure@src/scraper.rs:71:43: 71:56]>, futures_channel::mpsc::Sender<(scraper::XkcdInfo, usize)>, futures_channel::mpsc::Receiver<(scraper::XkcdInfo, usize)>, std::vec::Vec>, fn(std::ops::Range) ->  as std::iter::IntoIterator>::IntoIter { as std::iter::IntoIterator>::into_iter}, usize, std::ops::Range, &'r mut std::iter::Filter, [closure@src/scraper.rs:71:43: 71:56]>, std::option::Option, futures_channel::mpsc::Sender, futures_channel::mpsc::Receiver, impl core::future::future::Future, futures_util::sink::send::Send<'s, futures_channel::mpsc::Sender, usize>, (), futures_util::stream::next::Next<'t0, futures_channel::mpsc::Receiver<(scraper::XkcdInfo, usize)>>, std::option::Option<(scraper::XkcdInfo, usize)>, scraper::XkcdInfo, &'t1 mut std::iter::Filter, [closure@src/scraper.rs:71:43: 71:56]>, futures_util::sink::send::Send<'t2, futures_channel::mpsc::Sender, usize>}
   --> src/scraper.rs:70:32
    |
70  |   ) -> HashMap {
    |  ________________________________^
71  | |     let mut xkcd_nums = comic_nums.filter(|&n| n != 404); // remove 404 if found
72  | |
73  | |     const MAX_WORKERS: usize = 250;
...   |
104 | |     xkcd_comics
105 | | }
    | |_^

thread 'rustc' panicked at 'Box', src/librustc_errors/lib.rs:573:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
error: aborting due to previous error

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.37.0-nightly (d132f544f 2019-06-07) running on x86_64-unknown-linux-gnu

note: compiler flags: -C opt-level=3 --crate-type bin

note: some of the compiler flags provided by cargo are hidden
JuanPotato commented 5 years ago

Is this a duplicate of #61579

mati865 commented 5 years ago

Yes, it's duplicate.

jonas-schievink commented 5 years ago

Looks like it. Closing in favor of #61579.