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

ICE with Indicatif crate: cannot relate bound region #109420

Closed
trombonehero opened this issue Mar 21, 2023 · 2 comments
Closed

ICE with Indicatif crate: cannot relate bound region #109420

trombonehero opened this issue Mar 21, 2023 · 2 comments
Labels
A-borrow-checker Area: The borrow checker A-type-system Area: Type system 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.

Comments

@trombonehero
Copy link

Code

use std::io::Write;
use indicatif::{ProgressBar, ProgressState, ProgressStyle};

fn main() {
    let pb = ProgressBar::new(10000000);
    pb.set_style(ProgressStyle::with_template("{spinner:.green} [{elapsed_precise}] [{wide_bar:.cyan/blue}] {bytes}/{total_bytes} ({eta})")
        .unwrap()
        .with_key("eta", |state: &ProgressState, w: &mut dyn Write| write!(w, "{:.1}s", state.eta().as_secs_f64()).unwrap());
}

Meta

rustc --version --verbose:

rustc 1.68.0 (2c8cc3432 2023-03-06)
binary: rustc
commit-hash: 2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74
commit-date: 2023-03-06
host: aarch64-apple-darwin
release: 1.68.0
LLVM version: 15.0.6

Error output

I see the following when I add the call to with_key above:

   Compiling tmp v0.1.0 (/Users/jon/Dev/upss/stores/tmp)
error: internal compiler error: compiler/rustc_infer/src/infer/region_constraints/mod.rs:568:17: cannot relate bound region: ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrNamed(DefId(0:11 ~ tmp[9223]::main::'_#1), '_) }) <= ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrNamed(DefId(20:1145 ~ indicatif[025c]::style::{impl#10}::'_#1), '_) })

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/compiler/rustc_errors/src/lib.rs:987:33
stack backtrace:
   0:        0x103872978 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h1027694b54c428d0
   1:        0x1038c2cf0 - core::fmt::write::hb60cc483d75d6594
   2:        0x103866374 - std::io::Write::write_fmt::h6c907fc10bdb865b
   3:        0x10387278c - std::sys_common::backtrace::print::h1a62458f14dd2797
   4:        0x1038752e0 - std::panicking::default_hook::{{closure}}::h03c6918072c36210
   5:        0x103875038 - std::panicking::default_hook::hd0f3cf66b6a0fb5e
   6:        0x10bb504fc - rustc_driver[7e9c70f5b960cc99]::DEFAULT_HOOK::{closure#0}::{closure#0}
   7:        0x1038759d8 - std::panicking::rust_panic_with_hook::h9ed2a7a45efbd034
   8:        0x10f7d1394 - std[bed70ebd0cf395b0]::panicking::begin_panic::<rustc_errors[3041147eb80b6979]::ExplicitBug>::{closure#0}
   9:        0x10f7cb440 - std[bed70ebd0cf395b0]::sys_common::backtrace::__rust_end_short_backtrace::<std[bed70ebd0cf395b0]::panicking::begin_panic<rustc_errors[3041147eb80b6979]::ExplicitBug>::{closure#0}, !>
  10:        0x10fe79eac - std[bed70ebd0cf395b0]::panicking::begin_panic::<rustc_errors[3041147eb80b6979]::ExplicitBug>
  11:        0x10f878b30 - std[bed70ebd0cf395b0]::panic::panic_any::<rustc_errors[3041147eb80b6979]::ExplicitBug>
  12:        0x10f8750a4 - <rustc_errors[3041147eb80b6979]::HandlerInner>::span_bug::<rustc_span[c5f28c4f2d409cdb]::span_encoding::Span, &alloc[bc0f0745c2f902f]::string::String>
  13:        0x10f874eec - <rustc_errors[3041147eb80b6979]::Handler>::span_bug::<rustc_span[c5f28c4f2d409cdb]::span_encoding::Span, &alloc[bc0f0745c2f902f]::string::String>
  14:        0x10f8113a0 - rustc_middle[3903fd3487382ed0]::util::bug::opt_span_bug_fmt::<rustc_span[c5f28c4f2d409cdb]::span_encoding::Span>::{closure#0}
  15:        0x10f811698 - rustc_middle[3903fd3487382ed0]::ty::context::tls::with_opt::<rustc_middle[3903fd3487382ed0]::util::bug::opt_span_bug_fmt<rustc_span[c5f28c4f2d409cdb]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  16:        0x10f810c00 - rustc_middle[3903fd3487382ed0]::ty::context::tls::with_context_opt::<rustc_middle[3903fd3487382ed0]::ty::context::tls::with_opt<rustc_middle[3903fd3487382ed0]::util::bug::opt_span_bug_fmt<rustc_span[c5f28c4f2d409cdb]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  17:        0x10f810bbc - rustc_middle[3903fd3487382ed0]::util::bug::opt_span_bug_fmt::<rustc_span[c5f28c4f2d409cdb]::span_encoding::Span>
  18:        0x10fe75c34 - rustc_middle[3903fd3487382ed0]::util::bug::span_bug_fmt::<rustc_span[c5f28c4f2d409cdb]::span_encoding::Span>
  19:        0x10f80bf0c - <rustc_infer[fd8b2ba72d33c6f8]::infer::region_constraints::RegionConstraintCollector>::make_subregion
  20:        0x10f8063f0 - <rustc_infer[fd8b2ba72d33c6f8]::infer::region_constraints::RegionConstraintCollector>::make_eqregion
  21:        0x10f816348 - <rustc_infer[fd8b2ba72d33c6f8]::infer::equate::Equate as rustc_middle[3903fd3487382ed0]::ty::relate::TypeRelation>::regions
  22:        0x10f81cd54 - rustc_middle[3903fd3487382ed0]::ty::relate::super_relate_tys::<rustc_infer[fd8b2ba72d33c6f8]::infer::equate::Equate>
  23:        0x10f819570 - <rustc_infer[fd8b2ba72d33c6f8]::infer::equate::Equate as rustc_middle[3903fd3487382ed0]::ty::relate::TypeRelation>::tys
  24:        0x10f64dd30 - <rustc_infer[fd8b2ba72d33c6f8]::infer::InferCtxt>::commit_if_ok::<rustc_infer[fd8b2ba72d33c6f8]::infer::InferOk<()>, rustc_middle[3903fd3487382ed0]::ty::error::TypeError, <rustc_infer[fd8b2ba72d33c6f8]::infer::at::Trace>::eq<rustc_middle[3903fd3487382ed0]::ty::Ty>::{closure#0}>
  25:        0x10f656324 - <rustc_infer[fd8b2ba72d33c6f8]::infer::InferCtxt>::can_eq::<rustc_middle[3903fd3487382ed0]::ty::Ty>
  26:        0x10f6322f4 - rustc_trait_selection[86bcde4a4696cf51]::traits::error_reporting::suggestions::hint_missing_borrow
  27:        0x10f6fc120 - <rustc_infer[fd8b2ba72d33c6f8]::infer::error_reporting::TypeErrCtxt as rustc_trait_selection[86bcde4a4696cf51]::traits::error_reporting::suggestions::TypeErrCtxtExt>::report_closure_arg_mismatch
  28:        0x10f70a520 - <rustc_infer[fd8b2ba72d33c6f8]::infer::error_reporting::TypeErrCtxt as rustc_trait_selection[86bcde4a4696cf51]::traits::error_reporting::TypeErrCtxtExt>::report_selection_error
  29:        0x10f713af4 - <rustc_infer[fd8b2ba72d33c6f8]::infer::error_reporting::TypeErrCtxt as rustc_trait_selection[86bcde4a4696cf51]::traits::error_reporting::InferCtxtPrivExt>::report_fulfillment_error
  30:        0x10f705028 - <rustc_infer[fd8b2ba72d33c6f8]::infer::error_reporting::TypeErrCtxt as rustc_trait_selection[86bcde4a4696cf51]::traits::error_reporting::TypeErrCtxtExt>::report_fulfillment_errors
  31:        0x10de153cc - <rustc_hir_typeck[c57fafc8510b2a7e]::fn_ctxt::FnCtxt>::check_argument_types
  32:        0x10de149d4 - <rustc_hir_typeck[c57fafc8510b2a7e]::fn_ctxt::FnCtxt>::check_method_argument_types
  33:        0x10de54054 - <rustc_hir_typeck[c57fafc8510b2a7e]::fn_ctxt::FnCtxt>::check_expr_kind
  34:        0x10de0891c - <rustc_hir_typeck[c57fafc8510b2a7e]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  35:        0x10de15524 - <rustc_hir_typeck[c57fafc8510b2a7e]::fn_ctxt::FnCtxt>::check_argument_types
  36:        0x10de149d4 - <rustc_hir_typeck[c57fafc8510b2a7e]::fn_ctxt::FnCtxt>::check_method_argument_types
  37:        0x10de54054 - <rustc_hir_typeck[c57fafc8510b2a7e]::fn_ctxt::FnCtxt>::check_expr_kind
  38:        0x10de0891c - <rustc_hir_typeck[c57fafc8510b2a7e]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  39:        0x10de1b8ac - <rustc_hir_typeck[c57fafc8510b2a7e]::fn_ctxt::FnCtxt>::check_stmt
  40:        0x10de1be34 - <rustc_hir_typeck[c57fafc8510b2a7e]::fn_ctxt::FnCtxt>::check_block_with_expected
  41:        0x10de4f3a8 - <rustc_hir_typeck[c57fafc8510b2a7e]::fn_ctxt::FnCtxt>::check_expr_kind
  42:        0x10de0891c - <rustc_hir_typeck[c57fafc8510b2a7e]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  43:        0x10de09bfc - <rustc_hir_typeck[c57fafc8510b2a7e]::fn_ctxt::FnCtxt>::check_return_expr
  44:        0x10deab920 - rustc_hir_typeck[c57fafc8510b2a7e]::check::check_fn
  45:        0x10ded9068 - rustc_hir_typeck[c57fafc8510b2a7e]::typeck
  46:        0x10edc9ed8 - <rustc_query_system[6dfbca34f7eeeccd]::dep_graph::graph::DepGraph<rustc_middle[3903fd3487382ed0]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[3903fd3487382ed0]::ty::context::TyCtxt, rustc_span[c5f28c4f2d409cdb]::def_id::LocalDefId, &rustc_middle[3903fd3487382ed0]::ty::typeck_results::TypeckResults>
  47:        0x10ec145f0 - rustc_query_system[6dfbca34f7eeeccd]::query::plumbing::try_execute_query::<rustc_query_impl[f8b25e787c1f6d4]::queries::typeck, rustc_query_impl[f8b25e787c1f6d4]::plumbing::QueryCtxt>
  48:        0x10ed0c208 - <rustc_query_impl[f8b25e787c1f6d4]::Queries as rustc_middle[3903fd3487382ed0]::ty::query::QueryEngine>::typeck
  49:        0x10dea05dc - rustc_data_structures[bb1b474d032cb23d]::sync::par_for_each_in::<&[rustc_span[c5f28c4f2d409cdb]::def_id::LocalDefId], <rustc_middle[3903fd3487382ed0]::hir::map::Map>::par_body_owners<rustc_hir_typeck[c57fafc8510b2a7e]::typeck_item_bodies::{closure#0}>::{closure#0}>
  50:        0x10ded7304 - rustc_hir_typeck[c57fafc8510b2a7e]::typeck_item_bodies
  51:        0x10edf5084 - <rustc_query_system[6dfbca34f7eeeccd]::dep_graph::graph::DepGraph<rustc_middle[3903fd3487382ed0]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[3903fd3487382ed0]::ty::context::TyCtxt, (), ()>
  52:        0x10eba3aa0 - rustc_query_system[6dfbca34f7eeeccd]::query::plumbing::try_execute_query::<rustc_query_impl[f8b25e787c1f6d4]::queries::typeck_item_bodies, rustc_query_impl[f8b25e787c1f6d4]::plumbing::QueryCtxt>
  53:        0x10ed0c100 - <rustc_query_impl[f8b25e787c1f6d4]::Queries as rustc_middle[3903fd3487382ed0]::ty::query::QueryEngine>::typeck_item_bodies
  54:        0x10e023924 - <rustc_session[4c53cce1cbffcbb4]::session::Session>::time::<(), rustc_hir_analysis[ec5810db45fb7689]::check_crate::{closure#7}>
  55:        0x10dfdb6ec - rustc_hir_analysis[ec5810db45fb7689]::check_crate
  56:        0x10bbee6a8 - rustc_interface[5368bf6011624330]::passes::analysis
  57:        0x10eded6bc - <rustc_query_system[6dfbca34f7eeeccd]::dep_graph::graph::DepGraph<rustc_middle[3903fd3487382ed0]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[3903fd3487382ed0]::ty::context::TyCtxt, (), core[bacde730fb80eda9]::result::Result<(), rustc_errors[3041147eb80b6979]::ErrorGuaranteed>>
  58:        0x10ec16b18 - rustc_query_system[6dfbca34f7eeeccd]::query::plumbing::try_execute_query::<rustc_query_impl[f8b25e787c1f6d4]::queries::analysis, rustc_query_impl[f8b25e787c1f6d4]::plumbing::QueryCtxt>
  59:        0x10ed093a0 - <rustc_query_impl[f8b25e787c1f6d4]::Queries as rustc_middle[3903fd3487382ed0]::ty::query::QueryEngine>::analysis
  60:        0x10baf072c - <rustc_interface[5368bf6011624330]::passes::QueryContext>::enter::<rustc_driver[7e9c70f5b960cc99]::run_compiler::{closure#1}::{closure#2}::{closure#2}, core[bacde730fb80eda9]::result::Result<(), rustc_errors[3041147eb80b6979]::ErrorGuaranteed>>
  61:        0x10bb41670 - <rustc_interface[5368bf6011624330]::queries::QueryResult<rustc_interface[5368bf6011624330]::passes::QueryContext>>::enter::<core[bacde730fb80eda9]::result::Result<(), rustc_errors[3041147eb80b6979]::ErrorGuaranteed>, rustc_driver[7e9c70f5b960cc99]::run_compiler::{closure#1}::{closure#2}::{closure#2}>
  62:        0x10bb281b4 - <rustc_interface[5368bf6011624330]::interface::Compiler>::enter::<rustc_driver[7e9c70f5b960cc99]::run_compiler::{closure#1}::{closure#2}, core[bacde730fb80eda9]::result::Result<core[bacde730fb80eda9]::option::Option<rustc_interface[5368bf6011624330]::queries::Linker>, rustc_errors[3041147eb80b6979]::ErrorGuaranteed>>
  63:        0x10bb40e28 - rustc_span[c5f28c4f2d409cdb]::with_source_map::<core[bacde730fb80eda9]::result::Result<(), rustc_errors[3041147eb80b6979]::ErrorGuaranteed>, rustc_interface[5368bf6011624330]::interface::run_compiler<core[bacde730fb80eda9]::result::Result<(), rustc_errors[3041147eb80b6979]::ErrorGuaranteed>, rustc_driver[7e9c70f5b960cc99]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  64:        0x10baf6450 - std[bed70ebd0cf395b0]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[5368bf6011624330]::util::run_in_thread_pool_with_globals<rustc_interface[5368bf6011624330]::interface::run_compiler<core[bacde730fb80eda9]::result::Result<(), rustc_errors[3041147eb80b6979]::ErrorGuaranteed>, rustc_driver[7e9c70f5b960cc99]::run_compiler::{closure#1}>::{closure#0}, core[bacde730fb80eda9]::result::Result<(), rustc_errors[3041147eb80b6979]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[bacde730fb80eda9]::result::Result<(), rustc_errors[3041147eb80b6979]::ErrorGuaranteed>>
  65:        0x10bad8fe0 - <<std[bed70ebd0cf395b0]::thread::Builder>::spawn_unchecked_<rustc_interface[5368bf6011624330]::util::run_in_thread_pool_with_globals<rustc_interface[5368bf6011624330]::interface::run_compiler<core[bacde730fb80eda9]::result::Result<(), rustc_errors[3041147eb80b6979]::ErrorGuaranteed>, rustc_driver[7e9c70f5b960cc99]::run_compiler::{closure#1}>::{closure#0}, core[bacde730fb80eda9]::result::Result<(), rustc_errors[3041147eb80b6979]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[bacde730fb80eda9]::result::Result<(), rustc_errors[3041147eb80b6979]::ErrorGuaranteed>>::{closure#1} as core[bacde730fb80eda9]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  66:        0x10387de18 - std::sys::unix::thread::Thread::new::thread_start::hd47d33498d4475f3
  67:        0x18650206c - __pthread_deallocate

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.68.0 (2c8cc3432 2023-03-06) running on aarch64-apple-darwin

note: compiler flags: --crate-type bin -C embed-bitcode=no -C split-debuginfo=unpacked -C debuginfo=2 -C incremental=[REDACTED]

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [typeck] type-checking `main`
#1 [typeck_item_bodies] type-checking all item bodies
#2 [analysis] running analysis passes on this crate
end of query stack
error: could not compile `tmp`

@trombonehero trombonehero 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 Mar 21, 2023
@workingjubilee
Copy link
Member

likely duplicate of #109339

but this looks much more minimizable, despite the crate dependency, so I am not closing it right away.

@jyn514 jyn514 changed the title ICE with Indicatif crate ICE with Indicatif crate: cannot relate bound region Mar 21, 2023
@jyn514 jyn514 added A-type-system Area: Type system A-borrow-checker Area: The borrow checker labels Mar 21, 2023
@aliemjay
Copy link
Member

aliemjay commented Mar 21, 2023

Closing in favor of #109361 which has an MCVE.

@aliemjay aliemjay closed this as not planned Won't fix, can't repro, duplicate, stale Mar 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-borrow-checker Area: The borrow checker A-type-system Area: Type system 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.
Projects
None yet
Development

No branches or pull requests

4 participants