Skip to content

Error when compiling with serde_hex #97847

Closed as not planned
Closed as not planned
@sternj

Description

@sternj

Code

use serde::Deserialize;
use serde_hex::{SerHex, StrictPfx};
#[derive(Debug, Deserialize)]
struct Record {
    #[serde(with = "SerHex")]
    ip: u64,
    #[serde(with = "SerHex")]
    address: u64,
    time: f64,
    binary: String,
}

Meta

rustc 1.63.0-nightly (50b00252a 2022-06-06)
binary: rustc
commit-hash: 50b00252aeb77b10db04d65dc9e12ce758def4b5
commit-date: 2022-06-06
host: x86_64-apple-darwin
release: 1.63.0-nightly
LLVM version: 14.0.5

Error output and Backtrace

The backtrace was printed without any separate intervention

thread 'rustc' panicked at 'range end index 2 out of range for slice of length 1', library/core/src/slice/index.rs:73:5
stack backtrace:
   0:        0x10c33ed64 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hc89063644c052ad4
   1:        0x10c39996b - core::fmt::write::h7ea2bdea9a10d1a8
   2:        0x10c3314d8 - std::io::Write::write_fmt::h1d8ae03b7292d109
   3:        0x10c34202d - std::panicking::default_hook::{{closure}}::h402b6672d49f4784
   4:        0x10c341d84 - std::panicking::default_hook::hb4d3c4b6307575c7
   5:        0x10385966a - rustc_driver[54f5c17c2b2b05e8]::DEFAULT_HOOK::{closure#0}::{closure#0}
   6:        0x10c34268b - std::panicking::rust_panic_with_hook::ha18d8c2b5e51b259
   7:        0x10c342503 - std::panicking::begin_panic_handler::{{closure}}::h265c75dbbf82ee77
   8:        0x10c33f1e7 - std::sys_common::backtrace::__rust_end_short_backtrace::h95607c75f284c98b
   9:        0x10c3421da - _rust_begin_unwind
  10:        0x10c3c3353 - core::panicking::panic_fmt::h3a30b48c0a9b1a86
  11:        0x10c39c35a - core::slice::index::slice_end_index_len_fail_rt::h88ec97ebaa430367
  12:        0x10c38dd19 - core::ops::function::FnOnce::call_once::hfe7c4744afe9fc30
  13:        0x10c3949a9 - core::intrinsics::const_eval_select::hdc34b18b7c69b05d
  14:        0x10c3c3469 - core::slice::index::slice_end_index_len_fail::h99b310fa033526ac
  15:        0x107b6e759 - <rustc_infer[fb52d34cd6baa133]::infer::error_reporting::need_type_info::FindInferSourceVisitor as rustc_hir[5359db412d29770]::intravisit::Visitor>::visit_expr
  16:        0x107b6cea0 - <rustc_infer[fb52d34cd6baa133]::infer::error_reporting::need_type_info::FindInferSourceVisitor as rustc_hir[5359db412d29770]::intravisit::Visitor>::visit_expr
  17:        0x107b8f091 - rustc_hir[5359db412d29770]::intravisit::walk_expr::<rustc_infer[fb52d34cd6baa133]::infer::error_reporting::need_type_info::FindInferSourceVisitor>
  18:        0x107b6ceb1 - <rustc_infer[fb52d34cd6baa133]::infer::error_reporting::need_type_info::FindInferSourceVisitor as rustc_hir[5359db412d29770]::intravisit::Visitor>::visit_expr
  19:        0x107b8f36c - rustc_hir[5359db412d29770]::intravisit::walk_expr::<rustc_infer[fb52d34cd6baa133]::infer::error_reporting::need_type_info::FindInferSourceVisitor>
  20:        0x107b6ceb1 - <rustc_infer[fb52d34cd6baa133]::infer::error_reporting::need_type_info::FindInferSourceVisitor as rustc_hir[5359db412d29770]::intravisit::Visitor>::visit_expr
  21:        0x107b6ce8c - <rustc_infer[fb52d34cd6baa133]::infer::error_reporting::need_type_info::FindInferSourceVisitor as rustc_hir[5359db412d29770]::intravisit::Visitor>::visit_expr
  22:        0x107b6ceb1 - <rustc_infer[fb52d34cd6baa133]::infer::error_reporting::need_type_info::FindInferSourceVisitor as rustc_hir[5359db412d29770]::intravisit::Visitor>::visit_expr
  23:        0x107af7378 - <rustc_infer[fb52d34cd6baa133]::infer::InferCtxt>::emit_inference_failure_err
  24:        0x1079c88bf - <rustc_infer[fb52d34cd6baa133]::infer::InferCtxt as rustc_trait_selection[ecf02b1f56d5e38b]::traits::error_reporting::InferCtxtPrivExt>::maybe_report_ambiguity
  25:        0x1079b7ac3 - <rustc_infer[fb52d34cd6baa133]::infer::InferCtxt as rustc_trait_selection[ecf02b1f56d5e38b]::traits::error_reporting::InferCtxtExt>::report_fulfillment_errors
  26:        0x106269487 - <rustc_typeck[e984c2326e98f893]::check::fn_ctxt::FnCtxt>::select_all_obligations_or_error
  27:        0x10639d499 - <rustc_infer[fb52d34cd6baa133]::infer::InferCtxtBuilder>::enter::<&rustc_middle[1d8729473c017695]::ty::context::TypeckResults, <rustc_typeck[e984c2326e98f893]::check::inherited::InheritedBuilder>::enter<rustc_typeck[e984c2326e98f893]::check::typeck_with_fallback<rustc_typeck[e984c2326e98f893]::check::typeck::{closure#0}>::{closure#1}, &rustc_middle[1d8729473c017695]::ty::context::TypeckResults>::{closure#0}>
  28:        0x1062f5fb1 - rustc_typeck[e984c2326e98f893]::check::typeck
  29:        0x1070a423b - <rustc_query_system[f827b5c39d072f4a]::dep_graph::graph::DepGraph<rustc_middle[1d8729473c017695]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[1d8729473c017695]::ty::context::TyCtxt, rustc_span[8954c1abf418f007]::def_id::LocalDefId, &rustc_middle[1d8729473c017695]::ty::context::TypeckResults>
  30:        0x106df88a5 - rustc_query_system[f827b5c39d072f4a]::query::plumbing::try_execute_query::<rustc_query_impl[b150fa50613c8d66]::plumbing::QueryCtxt, rustc_query_system[f827b5c39d072f4a]::query::caches::DefaultCache<rustc_span[8954c1abf418f007]::def_id::LocalDefId, &rustc_middle[1d8729473c017695]::ty::context::TypeckResults>>
  31:        0x106ef8bbe - rustc_query_system[f827b5c39d072f4a]::query::plumbing::get_query::<rustc_query_impl[b150fa50613c8d66]::queries::typeck, rustc_query_impl[b150fa50613c8d66]::plumbing::QueryCtxt>
  32:        0x106465203 - <rustc_middle[1d8729473c017695]::hir::map::Map>::par_body_owners::<rustc_typeck[e984c2326e98f893]::check::typeck_item_bodies::{closure#0}>
  33:        0x1062fb495 - rustc_typeck[e984c2326e98f893]::check::typeck_item_bodies
  34:        0x1070d9fe4 - <rustc_query_system[f827b5c39d072f4a]::dep_graph::graph::DepGraph<rustc_middle[1d8729473c017695]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[1d8729473c017695]::ty::context::TyCtxt, (), ()>
  35:        0x106e5f8ae - rustc_query_system[f827b5c39d072f4a]::query::plumbing::try_execute_query::<rustc_query_impl[b150fa50613c8d66]::plumbing::QueryCtxt, rustc_query_system[f827b5c39d072f4a]::query::caches::DefaultCache<(), ()>>
  36:        0x106ecfa82 - rustc_query_system[f827b5c39d072f4a]::query::plumbing::get_query::<rustc_query_impl[b150fa50613c8d66]::queries::typeck_item_bodies, rustc_query_impl[b150fa50613c8d66]::plumbing::QueryCtxt>
  37:        0x1063d6332 - <rustc_session[9ffc5d0de607c1e9]::session::Session>::time::<(), rustc_typeck[e984c2326e98f893]::check_crate::{closure#7}>
  38:        0x10638e66d - rustc_typeck[e984c2326e98f893]::check_crate
  39:        0x10398830a - rustc_interface[3923b20b259bcf73]::passes::analysis
  40:        0x1070ceb27 - <rustc_query_system[f827b5c39d072f4a]::dep_graph::graph::DepGraph<rustc_middle[1d8729473c017695]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[1d8729473c017695]::ty::context::TyCtxt, (), core[e91578b5cdc4cff1]::result::Result<(), rustc_errors[81a355f7266b3082]::ErrorGuaranteed>>
  41:        0x106e51968 - rustc_query_system[f827b5c39d072f4a]::query::plumbing::try_execute_query::<rustc_query_impl[b150fa50613c8d66]::plumbing::QueryCtxt, rustc_query_system[f827b5c39d072f4a]::query::caches::DefaultCache<(), core[e91578b5cdc4cff1]::result::Result<(), rustc_errors[81a355f7266b3082]::ErrorGuaranteed>>>
  42:        0x106ef8f9f - rustc_query_system[f827b5c39d072f4a]::query::plumbing::get_query::<rustc_query_impl[b150fa50613c8d66]::queries::analysis, rustc_query_impl[b150fa50613c8d66]::plumbing::QueryCtxt>
  43:        0x1038151e2 - <rustc_interface[3923b20b259bcf73]::passes::QueryContext>::enter::<rustc_driver[54f5c17c2b2b05e8]::run_compiler::{closure#1}::{closure#2}::{closure#3}, core[e91578b5cdc4cff1]::result::Result<(), rustc_errors[81a355f7266b3082]::ErrorGuaranteed>>
  44:        0x1037f49a7 - <rustc_interface[3923b20b259bcf73]::interface::Compiler>::enter::<rustc_driver[54f5c17c2b2b05e8]::run_compiler::{closure#1}::{closure#2}, core[e91578b5cdc4cff1]::result::Result<core[e91578b5cdc4cff1]::option::Option<rustc_interface[3923b20b259bcf73]::queries::Linker>, rustc_errors[81a355f7266b3082]::ErrorGuaranteed>>
  45:        0x1037defb8 - rustc_span[8954c1abf418f007]::with_source_map::<core[e91578b5cdc4cff1]::result::Result<(), rustc_errors[81a355f7266b3082]::ErrorGuaranteed>, rustc_interface[3923b20b259bcf73]::interface::create_compiler_and_run<core[e91578b5cdc4cff1]::result::Result<(), rustc_errors[81a355f7266b3082]::ErrorGuaranteed>, rustc_driver[54f5c17c2b2b05e8]::run_compiler::{closure#1}>::{closure#1}>
  46:        0x1037f55f9 - <scoped_tls[5f20211687dfe940]::ScopedKey<rustc_span[8954c1abf418f007]::SessionGlobals>>::set::<rustc_interface[3923b20b259bcf73]::interface::run_compiler<core[e91578b5cdc4cff1]::result::Result<(), rustc_errors[81a355f7266b3082]::ErrorGuaranteed>, rustc_driver[54f5c17c2b2b05e8]::run_compiler::{closure#1}>::{closure#0}, core[e91578b5cdc4cff1]::result::Result<(), rustc_errors[81a355f7266b3082]::ErrorGuaranteed>>
  47:        0x103817ca9 - std[bdf93b31554fe369]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[3923b20b259bcf73]::util::run_in_thread_pool_with_globals<rustc_interface[3923b20b259bcf73]::interface::run_compiler<core[e91578b5cdc4cff1]::result::Result<(), rustc_errors[81a355f7266b3082]::ErrorGuaranteed>, rustc_driver[54f5c17c2b2b05e8]::run_compiler::{closure#1}>::{closure#0}, core[e91578b5cdc4cff1]::result::Result<(), rustc_errors[81a355f7266b3082]::ErrorGuaranteed>>::{closure#0}, core[e91578b5cdc4cff1]::result::Result<(), rustc_errors[81a355f7266b3082]::ErrorGuaranteed>>
  48:        0x103818641 - <<std[bdf93b31554fe369]::thread::Builder>::spawn_unchecked_<rustc_interface[3923b20b259bcf73]::util::run_in_thread_pool_with_globals<rustc_interface[3923b20b259bcf73]::interface::run_compiler<core[e91578b5cdc4cff1]::result::Result<(), rustc_errors[81a355f7266b3082]::ErrorGuaranteed>, rustc_driver[54f5c17c2b2b05e8]::run_compiler::{closure#1}>::{closure#0}, core[e91578b5cdc4cff1]::result::Result<(), rustc_errors[81a355f7266b3082]::ErrorGuaranteed>>::{closure#0}, core[e91578b5cdc4cff1]::result::Result<(), rustc_errors[81a355f7266b3082]::ErrorGuaranteed>>::{closure#1} as core[e91578b5cdc4cff1]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  49:        0x10c34b917 - std::sys::unix::thread::Thread::new::thread_start::hfbde891c18847358
  50:     0x7fff6eabe109 - __pthread_start

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/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.63.0-nightly (50b00252a 2022-06-06) running on x86_64-apple-darwin

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

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

query stack during panic:
#0 [typeck] type-checking `_::<impl at src/main.rs:54:17: 54:28>::deserialize::<impl at src/main.rs:54:17: 54:28>::visit_seq::<impl at src/main.rs:54:17: 54:28>::deserialize`
#1 [typeck_item_bodies] type-checking all item bodies
#2 [analysis] running analysis passes on this crate
end of query stack

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