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

Stable ICE: assertion failed: (left == right) #77329

Closed
DutchGhost opened this issue Sep 29, 2020 · 11 comments · Fixed by #77546
Closed

Stable ICE: assertion failed: (left == right) #77329

DutchGhost opened this issue Sep 29, 2020 · 11 comments · Fixed by #77546
Labels
A-closures Area: closures (`|args| { .. }`) A-hir Area: The high-level intermediate representation (HIR) 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) ❄️ P-medium Medium priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@DutchGhost
Copy link
Contributor

DutchGhost commented Sep 29, 2020

Code

fn bug<T>() -> impl Iterator<Item = [(); { |x: [u8]| { x } }]> {
    std::iter::empty()
}

Meta

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)

Error output

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`.

@DutchGhost DutchGhost 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 Sep 29, 2020
@DutchGhost
Copy link
Contributor Author

This started happening on stable 1.36

@DutchGhost
Copy link
Contributor Author

DutchGhost commented Sep 29, 2020

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 7f65393 to f05a524
regressed commit: dae90c1

bisected with cargo-bisect-rustc v0.5.2

Host triple: x86_64-unknown-linux-gnu
Reproduce with:

cargo bisect-rustc --regress=non-error 

@jonas-schievink jonas-schievink added A-closures Area: closures (`|args| { .. }`) A-hir Area: The high-level intermediate representation (HIR) I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Sep 29, 2020
@tesuji
Copy link
Contributor

tesuji commented Sep 29, 2020

My bisect:
ERROR: no commits between e4c66af...aa99abe 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

@tamuhey
Copy link
Member

tamuhey commented Sep 29, 2020

Smaller example:

trait Foo {}
fn bug() -> impl Foo<[(); |_: ()| {}]> {}

playground

Something wrong with the inference when iml trait and array expression are used together

@hameerabbasi hameerabbasi added P-medium Medium priority and removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Sep 29, 2020
@frxstrem
Copy link

frxstrem commented Sep 29, 2020

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<{|_: ()| {}}>> {}

playground

@tesuji
Copy link
Contributor

tesuji commented Sep 29, 2020

All example include closure. So I don't think it is particular bug for const generics.

@lcnr
Copy link
Contributor

lcnr commented Sep 29, 2020

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

@lcnr
Copy link
Contributor

lcnr commented Sep 29, 2020

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())
}

@tamuhey tamuhey added the E-needs-bisection Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc label Sep 30, 2020
@tamuhey
Copy link
Member

tamuhey commented Sep 30, 2020

It is a regression - stable 1.26.0 correctly outputs a compile error

@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label Sep 30, 2020
@lcnr
Copy link
Contributor

lcnr commented Oct 4, 2020

Not something I can fix myself, releasing assignment.

@lcnr lcnr removed their assignment Oct 4, 2020
@lcnr
Copy link
Contributor

lcnr commented Oct 4, 2020

Something I can fix myself, #77546 (with a lot of guidance by eddyb)

@lcnr lcnr removed the E-needs-bisection Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc label Oct 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-closures Area: closures (`|args| { .. }`) A-hir Area: The high-level intermediate representation (HIR) 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) ❄️ P-medium Medium priority 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.

8 participants