Skip to content

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

Closed

Description

@DutchGhost

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

Activity

  1. added
    C-bugCategory: This is a bug.
    I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    on Sep 29, 2020
  2. DutchGhost commented on Sep 29, 2020

    @DutchGhost
    Author

    This started happening on stable 1.36

  3. DutchGhost commented on Sep 29, 2020

    @DutchGhost
    Author

    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 
  4. added
    A-closuresArea: Closures (`|…| { … }`)
    A-HIRArea: The high-level intermediate representation (HIR)
    I-prioritizeIssue needs a team member to assess the impact. Will be replaced by P-{low,medium,high,critical}
    on Sep 29, 2020
  5. tesuji commented on Sep 29, 2020

    @tesuji
    Contributor

    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

  6. tamuhey commented on Sep 29, 2020

    @tamuhey

    Smaller example:

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

    playground

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

  7. added and removed
    I-prioritizeIssue needs a team member to assess the impact. Will be replaced by P-{low,medium,high,critical}
    on Sep 29, 2020
  8. frxstrem commented on Sep 29, 2020

    @frxstrem

    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

  9. tesuji commented on Sep 29, 2020

    @tesuji
    Contributor

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

  10. lcnr commented on Sep 29, 2020

    @lcnr
    Contributor

    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

  11. lcnr commented on Sep 29, 2020

    @lcnr
    Contributor

    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())
    }
  12. added
    E-needs-bisectionCall for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc
    on Sep 30, 2020
  13. tamuhey commented on Sep 30, 2020

    @tamuhey

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

  14. lcnr commented on Oct 4, 2020

    @lcnr
    Contributor

    Not something I can fix myself, releasing assignment.

  15. removed their assignment
    on Oct 4, 2020
  16. lcnr commented on Oct 4, 2020

    @lcnr
    Contributor

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

  17. removed
    E-needs-bisectionCall for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc
    on Oct 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-HIRArea: The high-level intermediate representation (HIR)A-closuresArea: Closures (`|…| { … }`)C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-mediumMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.glacierICE tracked in rust-lang/glacier.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions