Skip to content

compiler panic on "this enum variant takes 1 argument but 2 arguments were supplied" #94444

Closed
@leoleoasd

Description

@leoleoasd

Code

https://github.com/leoleoasd/ptranse/blob/6e7d647a2ea77af904c461df7df6a9067c76809f/src/process.rs#L90

Sorry, I'm new to rust and I can't provide a more minimized example. Commenting this line out and everything works fine.

Meta

rustc --version --verbose:

rustc 1.61.0-nightly (68369a041 2022-02-22)
binary: rustc
commit-hash: 68369a041cea809a87e5bd80701da90e0e0a4799
commit-date: 2022-02-22
host: x86_64-unknown-linux-gnu
release: 1.61.0-nightly
LLVM version: 14.0.0

Error output

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.61.0-nightly (68369a041 2022-02-22) running on x86_64-unknown-linux-gnu

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

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

query stack during panic:
#0 [typeck] type-checking `process::process`
#1 [typeck] type-checking `process::process::{closure#0}`
#2 [typeck_item_bodies] type-checking all item bodies
#3 [analysis] running analysis passes on this crate
end of query stack
Backtrace

  Compiling ptranse v0.1.0 (/home/leo/code/ptranse)
warning: unused imports: `ProgressIterator`, `ProgressStyle`
 --> src/process.rs:8:30
  |
8 | use indicatif::{ProgressBar, ProgressStyle, ProgressIterator};
  |                              ^^^^^^^^^^^^^  ^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

error: internal compiler error: compiler/rustc_typeck/src/check/fn_ctxt/_impl.rs:318:26: while adjusting Expr { hir_id: HirId { owner: DefId(0:50 ~ ptranse[60bd]::process::process), local_id: 761 }, kind: MethodCall(PathSegment { ident: take#0, hir_id: Some(HirId { owner: DefId(0:50 ~ ptranse[60bd]::process::process), local_id: 755 }), res: Some(Err), args: None, infer_args: true }, [Expr { hir_id: HirId { owner: DefId(0:50 ~ ptranse[60bd]::process::process), local_id: 759 }, kind: MethodCall(PathSegment { ident: iter#0, hir_id: Some(HirId { owner: DefId(0:50 ~ ptranse[60bd]::process::process), local_id: 756 }), res: Some(Err), args: None, infer_args: true }, [Expr { hir_id: HirId { owner: DefId(0:50 ~ ptranse[60bd]::process::process), local_id: 758 }, kind: Path(Resolved(None, Path { span: src/process.rs:90:31: 90:32 (#0), res: Local(HirId { owner: DefId(0:50 ~ ptranse[60bd]::process::process), local_id: 748 }), segments: [PathSegment { ident: t#0, hir_id: Some(HirId { owner: DefId(0:50 ~ ptranse[60bd]::process::process), local_id: 757 }), res: Some(Local(HirId { owner: DefId(0:50 ~ ptranse[60bd]::process::process), local_id: 748 })), args: None, infer_args: true }] })), span: src/process.rs:90:31: 90:32 (#0) }], src/process.rs:90:33: 90:39 (#0)), span: src/process.rs:90:31: 90:39 (#0) }, Expr { hir_id: HirId { owner: DefId(0:50 ~ ptranse[60bd]::process::process), local_id: 760 }, kind: Lit(Spanned { node: Int(1, Unsuffixed), span: src/process.rs:90:45: 90:46 (#0) }), span: src/process.rs:90:45: 90:46 (#0) }], src/process.rs:90:40: 90:47 (#0)), span: src/process.rs:90:31: 90:47 (#0) }, can't compose [Borrow(Ref('_#440r, Mut { allow_two_phase_borrow: Yes })) -> &mut std::iter::Take<std::collections::hash_set::Iter<'_, &Triple<'_>>>] and [Borrow(Ref('_#454r, Mut { allow_two_phase_borrow: Yes })) -> &mut std::iter::Take<std::collections::hash_set::Iter<'_, &Triple<'_>>>]

thread 'rustc' panicked at 'Box<dyn Any>', compiler/rustc_errors/src/lib.rs:1160:9
stack backtrace:
   0: std::panicking::begin_panic::<rustc_errors::ExplicitBug>
   1: std::panic::panic_any::<rustc_errors::ExplicitBug>
   2: <rustc_errors::HandlerInner>::bug
   3: <rustc_errors::Handler>::bug
   4: rustc_middle::ty::context::tls::with_opt::<rustc_middle::util::bug::opt_span_bug_fmt<rustc_span::span_encoding::Span>::{closure#0}, ()>
   5: rustc_middle::util::bug::opt_span_bug_fmt::<rustc_span::span_encoding::Span>
   6: rustc_middle::util::bug::bug_fmt
   7: <rustc_typeck::check::fn_ctxt::FnCtxt>::apply_adjustments
   8: <rustc_typeck::check::method::confirm::ConfirmContext>::confirm
   9: <rustc_typeck::check::fn_ctxt::FnCtxt>::lookup_method
  10: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind
  11: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
  12: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind
  13: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_argument_types
  14: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_call
  15: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind
  16: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  17: <rustc_middle::ty::Ty as rustc_middle::ty::context::InternIteratorElement<rustc_middle::ty::Ty, rustc_middle::ty::Ty>>::intern_with::<core::iter::adapters::map::Map<core::iter::adapters::enumerate::Enumerate<core::slice::iter::Iter<rustc_hir::hir::Expr>>, <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_tuple::{closure#1}>, <rustc_middle::ty::context::TyCtxt>::mk_tup<core::iter::adapters::map::Map<core::iter::adapters::enumerate::Enumerate<core::slice::iter::Iter<rustc_hir::hir::Expr>>, <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_tuple::{closure#1}>>::{closure#0}>
  18: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind
  19: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
  20: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_block_with_expected
  21: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
  22: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind
  23: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
  24: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_block_with_expected
  25: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
  26: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind
  27: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
  28: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_block_with_expected
  29: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
  30: rustc_typeck::check::check::check_fn
  31: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_closure
  32: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind
  33: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_argument_types
  34: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind
  35: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
  36: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind
  37: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
  38: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind
  39: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
  40: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind
  41: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
  42: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_stmt
  43: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_block_with_expected
  44: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
  45: rustc_typeck::check::check::check_fn
  46: <rustc_infer::infer::InferCtxtBuilder>::enter::<&rustc_middle::ty::context::TypeckResults, <rustc_typeck::check::inherited::InheritedBuilder>::enter<rustc_typeck::check::typeck_with_fallback<rustc_typeck::check::typeck::{closure#0}>::{closure#1}, &rustc_middle::ty::context::TypeckResults>::{closure#0}>
  47: rustc_typeck::check::typeck
  48: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle::ty::context::TyCtxt, rustc_span::def_id::LocalDefId, &rustc_middle::ty::context::TypeckResults>
  49: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::plumbing::QueryCtxt, rustc_query_system::query::caches::DefaultCache<rustc_span::def_id::LocalDefId, &rustc_middle::ty::context::TypeckResults>>
  50: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::typeck
  51: rustc_typeck::check::typeck
  52: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle::ty::context::TyCtxt, rustc_span::def_id::LocalDefId, &rustc_middle::ty::context::TypeckResults>
  53: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::plumbing::QueryCtxt, rustc_query_system::query::caches::DefaultCache<rustc_span::def_id::LocalDefId, &rustc_middle::ty::context::TypeckResults>>
  54: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::typeck
  55: <rustc_middle::hir::map::Map>::par_body_owners::<rustc_typeck::check::typeck_item_bodies::{closure#0}>
  56: rustc_typeck::check::typeck_item_bodies
  57: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle::ty::context::TyCtxt, (), ()>
  58: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::plumbing::QueryCtxt, rustc_query_system::query::caches::DefaultCache<(), ()>>
  59: rustc_query_system::query::plumbing::get_query::<rustc_query_impl::queries::typeck_item_bodies, rustc_query_impl::plumbing::QueryCtxt>
  60: rustc_typeck::check_crate
  61: rustc_interface::passes::analysis
  62: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle::ty::context::TyCtxt, (), core::result::Result<(), rustc_errors::ErrorReported>>
  63: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::plumbing::QueryCtxt, rustc_query_system::query::caches::DefaultCache<(), core::result::Result<(), rustc_errors::ErrorReported>>>
  64: rustc_query_system::query::plumbing::get_query::<rustc_query_impl::queries::analysis, rustc_query_impl::plumbing::QueryCtxt>
  65: <rustc_interface::passes::QueryContext>::enter::<rustc_driver::run_compiler::{closure#1}::{closure#2}::{closure#3}, core::result::Result<(), rustc_errors::ErrorReported>>
  66: <rustc_interface::interface::Compiler>::enter::<rustc_driver::run_compiler::{closure#1}::{closure#2}, core::result::Result<core::option::Option<rustc_interface::queries::Linker>, rustc_errors::ErrorReported>>
  67: rustc_span::with_source_map::<core::result::Result<(), rustc_errors::ErrorReported>, rustc_interface::interface::create_compiler_and_run<core::result::Result<(), rustc_errors::ErrorReported>, rustc_driver::run_compiler::{closure#1}>::{closure#1}>
  68: rustc_interface::interface::create_compiler_and_run::<core::result::Result<(), rustc_errors::ErrorReported>, rustc_driver::run_compiler::{closure#1}>
  69: <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorReported>, rustc_driver::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorReported>>
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

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.61.0-nightly (68369a041 2022-02-22) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type bin -C embed-bitcode=no -C debuginfo=2 -C incremental

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

query stack during panic:
#0 [typeck] type-checking `process::process`
#1 [typeck] type-checking `process::process::{closure#0}`
#2 [typeck_item_bodies] type-checking all item bodies
#3 [analysis] running analysis passes on this crate
end of query stack
warning: `ptranse` (bin "ptranse") generated 1 warning
error: could not compile `ptranse`; 1 warning emitted

Other information

rustc 1.58.0-nightly doesn't have this bug.

(i386)  ➜  ~/code/ptranse git:(master) rustc -V --verbose
rustc 1.58.0-nightly (e90c5fbbc 2021-11-12)
binary: rustc
commit-hash: e90c5fbbc5df5c81267747daeb937d4e955ce6ad
commit-date: 2021-11-12
host: x86_64-apple-darwin
release: 1.58.0-nightly
LLVM version: 13.0.0
(i386)  ➜  ~/code/ptranse git:(master) cargo build
   Compiling ptranse v0.1.0 (/Volumes/Code/ptranse)
warning: unused imports: `ProgressIterator`, `ProgressStyle`
 --> src/process.rs:8:30
  |
8 | use indicatif::{ProgressBar, ProgressStyle, ProgressIterator};
  |                              ^^^^^^^^^^^^^  ^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

error[E0061]: this enum variant takes 1 argument but 2 arguments were supplied
  --> src/process.rs:90:26
   |
90 |                 (triple, Some(t.iter().take(1).next().unwrap(), r1.2 as f64 / total_length as f64))
   |                          ^^^^ --------------------------------  --------------------------------- supplied 2 arguments
   |                          |
   |                          expected 1 argument

warning: unused import: `rand::prelude`
 --> src/process.rs:7:5
  |
7 | use rand::prelude::*;
  |     ^^^^^^^^^^^^^

For more information about this error, try `rustc --explain E0061`.
warning: `ptranse` (bin "ptranse") generated 2 warnings
error: could not compile `ptranse` due to previous error; 2 warnings emitted

Metadata

Metadata

Assignees

No one assigned

    Labels

    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.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions