fn bug<T>() -> impl Iterator<Item = [(); { |x: [u8]| { x } }]> {
std::iter::empty()
}
rustc --version --verbose:
rustc 1.46.0 (04488afe3 2020-08-24)
rustc 1.47.0-beta.5 (9f0e6fa94 2020-09-29)
rustc 1.48.0-nightly (fc2daaae6 2020-09-28)
thread 'rustc' panicked at 'assertion failed: `(left == right)`
left: `DefId(0:5 ~ playground[6bea]::bug[0]::{{opaque}}[0])`,
right: `DefId(0:3 ~ playground[6bea]::bug[0])`', src/librustc_middle/hir/map/collector.rs:226:13
Backtrace
Compiling playground v0.0.1 (/playground)
stack backtrace:
0: backtrace::backtrace::libunwind::trace
at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/libunwind.rs:86
1: backtrace::backtrace::trace_unsynchronized
at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/mod.rs:66
2: std::sys_common::backtrace::_print_fmt
at src/libstd/sys_common/backtrace.rs:78
3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
at src/libstd/sys_common/backtrace.rs:59
4: core::fmt::write
at src/libcore/fmt/mod.rs:1076
5: std::io::Write::write_fmt
at src/libstd/io/mod.rs:1537
6: std::sys_common::backtrace::_print
at src/libstd/sys_common/backtrace.rs:62
7: std::sys_common::backtrace::print
at src/libstd/sys_common/backtrace.rs:49
8: std::panicking::default_hook::{{closure}}
at src/libstd/panicking.rs:198
9: std::panicking::default_hook
at src/libstd/panicking.rs:217
10: rustc_driver::report_ice
11: std::panicking::rust_panic_with_hook
at src/libstd/panicking.rs:530
12: rust_begin_unwind
at src/libstd/panicking.rs:437
13: std::panicking::begin_panic_fmt
at src/libstd/panicking.rs:391
14: rustc_middle::hir::map::collector::NodeCollector::insert_entry
15: <rustc_middle::hir::map::collector::NodeCollector as rustc_hir::intravisit::Visitor>::visit_param
16: rustc_hir::intravisit::walk_body
17: rustc_hir::intravisit::walk_expr
18: rustc_hir::intravisit::walk_block
19: rustc_hir::intravisit::walk_expr
20: rustc_hir::intravisit::walk_body
21: rustc_hir::intravisit::walk_ty
22: rustc_hir::intravisit::walk_assoc_type_binding
23: rustc_hir::intravisit::walk_path
24: rustc_hir::intravisit::Visitor::visit_param_bound
25: rustc_hir::intravisit::walk_item
26: <rustc_middle::hir::map::collector::NodeCollector as rustc_hir::intravisit::Visitor>::visit_item
27: rustc_hir::intravisit::walk_ty
28: rustc_hir::intravisit::walk_fn
29: <rustc_middle::hir::map::collector::NodeCollector as rustc_hir::intravisit::Visitor>::visit_fn
30: rustc_hir::intravisit::walk_item
31: <rustc_middle::hir::map::collector::NodeCollector as rustc_hir::intravisit::Visitor>::visit_item
32: rustc_middle::hir::map::index_hir
33: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
34: rustc_data_structures::stack::ensure_sufficient_stack
35: rustc_query_system::query::plumbing::get_query_impl
36: core::ops::function::FnOnce::call_once
37: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
38: rustc_data_structures::stack::ensure_sufficient_stack
39: rustc_query_system::query::plumbing::get_query_impl
40: rustc_middle::hir::map::Map::expect_item
41: rustc_middle::hir::map::Map::visit_item_likes_in_module
42: rustc_passes::hir_id_validator::check_crate
43: rustc_interface::passes::analysis
44: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::analysis>::compute
45: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
46: rustc_query_system::query::plumbing::get_query_impl
47: rustc_middle::ty::context::tls::enter_global
48: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
49: rustc_span::with_source_map
50: rustc_interface::interface::create_compiler_and_run
51: scoped_tls::ScopedKey<T>::set
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
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.46.0 (04488afe3 2020-08-24) running on x86_64-unknown-linux-gnu
note: compiler flags: -C embed-bitcode=no -C codegen-units=1 -C debuginfo=2 --crate-type lib
note: some of the compiler flags provided by cargo are hidden
query stack during panic:
#0 [index_hir] index HIR
#1 [hir_owner] HIR owner of `{{misc}}#0`
#2 [analysis] running analysis passes on this crate
end of query stack
error: could not compile `playground`.
This started happening on stable 1.36
I'm realy unsure on how much this bisect can be trusted, I'm happy to run other ones with a little bit of help, this is the best I got.
searched nightlies: from nightly-2020-04-30 to nightly-2020-08-28
regressed nightly: nightly-2020-05-03
searched commits: from https://github.com/rust-lang/rust/commit/7f65393b9abf5e70d0b9a8080558f17c5625bd40 to https://github.com/rust-lang/rust/commit/f05a5240440b3eaef1684a7965860fab40301947
regressed commit: https://github.com/rust-lang/rust/commit/dae90c195989b09475b6c0225a3018cbd7afa587
bisected with cargo-bisect-rustc v0.5.2
Host triple: x86_64-unknown-linux-gnu
Reproduce with:
cargo bisect-rustc --regress=non-error
My bisect:
ERROR: no commits between e4c66afba5d69356879570aeff22db5a38566a86...aa99abeb262307d5e9aa11a792312fd620b7f89a within last 167 days
git lg --author=bors e4c66afba5d69356879570aeff22db5a38566a86...aa99abeb262307d5e9aa11a792312fd620b7f89a
Command: cargo-bisect-rustc --start 2019-02-28 --end 2019-07-01 --preserve --regress=ice
Smaller example:
trait Foo {}
fn bug() -> impl Foo<[(); |_: ()| {}]> {}
Something wrong with the inference when iml trait and array expression are used together
Using regular const generics on nightly produces the same error, so it's probably related:
#![feature(min_const_generics)]
trait Foo {}
struct Bar<const N: usize>;
fn bug() -> impl Foo<Bar<{|_: ()| {}}>> {}
All example include closure. So I don't think it is particular bug for const generics.
Looks like something blocking const generics, even if it's not directly caused by it.
Also something I want to look into myself, so @rustbot claim
This also breaks code which, if nonsensical, should be working. Don't think we have to increase the priority because of this though.
fn bug<T>() -> impl Iterator<Item = [(); { |x: u32| { x }; 4 }]> {
std::iter::empty()
}
fn ok<T>() -> Box<dyn Iterator<Item = [(); { |x: u32| { x }; 4 }]>> {
Box::new(std::iter::empty())
}
It is a regression - stable 1.26.0 correctly outputs a compile error
Not something I can fix myself, releasing assignment.
Something I can fix myself, #77546 (with a lot of guidance by eddyb)
Most helpful comment
Something I can fix myself, #77546 (with a lot of guidance by eddyb)