Closed
Description
This is as minimized as I could get:
Code
// mod r#impl;
#[derive(Debug)]
pub struct Parser<'src> {
src: &'src str,
pos: usize,
// depth: usize,
state: ParseState,
}
impl<'src> Parser<'src> {
pub fn new(src: &'src str) -> Self {
Self {
src,
pos: 0,
// depth: 0,
state: ParseState::WantNode,
}
}
}
#[derive(Debug, PartialEq, Eq)]
enum ParseState {
WantNode,
WantChild,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Event<'src> {
BeginNode {
slashdash: bool,
type_annotation: Option<Identifier<'src>>,
name: Identifier<'src>,
},
Argument {
type_annotation: Option<Identifier<'src>>,
value: &'src str,
},
Property {
name: Identifier<'src>,
type_annotation: Option<Identifier<'src>>,
value: &'src str,
},
Children,
End,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Identifier<'src> {
Bare(&'src str),
Escaped(&'src str),
Raw(&'src str),
}
cargo build
- Delete the comment on line 1 OR both lines 7 and 16
cargo build
- ICE
Meta
This is not happening on nightly. But load bearing comments is scary enough I wanted to report this anyway.
rustc --version --verbose
:
rustc 1.59.0-beta.5 (28c8a34e1 2022-01-27)
binary: rustc
commit-hash: 28c8a34e18fc05277c81328d1bbf5ed931f4d22e
commit-date: 2022-01-27
host: x86_64-pc-windows-msvc
release: 1.59.0-beta.5
LLVM version: 13.0.0
Error output
thread 'rustc' panicked at 'index out of bounds: the len is 51 but the index is 51', compiler\rustc_query_impl\src\on_disk_cache.rs:726:18
stack backtrace:
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/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md
note: rustc 1.59.0-beta.5 (28c8a34e1 2022-01-27) running on x86_64-pc-windows-msvc
note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental --crate-type lib
note: some of the compiler flags provided by cargo are hidden
query stack during panic:
#0 [codegen_fulfill_obligation] checking if `core::fmt::Debug` fulfills its obligations
#1 [resolve_instance] resolving instance `<&core::option::Option<Identifier> as core::fmt::Debug>::fmt`
#2 [vtable_entries] finding all vtable entries for trait core::fmt::Debug
#3 [collect_and_partition_mono_items] collect_and_partition_mono_items
#4 [exported_symbols] exported_symbols
end of query stack
Backtrace
stack backtrace:
0: 0x7ffdad975fdf - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hcb4b39deedfbc6bf
1: 0x7ffdad9a559a - core::fmt::write::he96346b765e36572
2: 0x7ffdad967408 - <std::io::IoSliceMut as core::fmt::Debug>::fmt::h98885d2743aadc81
3: 0x7ffdad979a0b - std::panicking::take_hook::h721111918dfcd5c5
4: 0x7ffdad979504 - std::panicking::take_hook::h721111918dfcd5c5
5: 0x7ffd486c39f9 - <rustc_middle[e8be7f10e3e30399]::ty::SymbolName as core[1d83072e00ca4c26]::fmt::Debug>::fmt
6: 0x7ffdad97a136 - std::panicking::rust_panic_with_hook::h2757289713985cd7
7: 0x7ffdad979f3b - <std::panicking::begin_panic_handler::StrPanicPayload as core::panic::BoxMeUp>::get::h49a8ba1714a1d465
8: 0x7ffdad976927 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hcb4b39deedfbc6bf
9: 0x7ffdad979c39 - rust_begin_unwind
10: 0x7ffdad9d7ef0 - core::panicking::panic_fmt::h28161e1bada08bd1
11: 0x7ffdad9d7eb7 - core::panicking::panic_bounds_check::hffc92e70f59f16e6
12: 0x7ffd4bf3490b - <rustc_span[550e41ecb909559f]::span_encoding::Span as rustc_serialize[7a7d8c4496902bcc]::serialize::Decodable<rustc_query_impl[131a58ac89a902d8]::on_disk_cache::CacheDecoder>>::decode
13: 0x7ffd4bee794c - <&[(rustc_middle[e8be7f10e3e30399]::ty::Predicate, rustc_span[550e41ecb909559f]::span_encoding::Span)] as rustc_serialize[7a7d8c4496902bcc]::serialize::Decodable<rustc_query_impl[131a58ac89a902d8]::on_disk_cache::CacheDecoder>>::decode
14: 0x7ffd4bdc7fba - rustc_query_impl[131a58ac89a902d8]::query_callbacks::diagnostic_hir_wf_check
15: 0x7ffd4bd67003 - <rustc_middle[e8be7f10e3e30399]::ty::adt::AdtSizedConstraint as rustc_query_impl[131a58ac89a902d8]::values::Value>::from_cycle_error
16: 0x7ffd4bd43c54 - <rustc_query_impl[131a58ac89a902d8]::Queries as rustc_middle[e8be7f10e3e30399]::ty::query::QueryEngine>::try_mark_green
17: 0x7ffd4bed84a9 - <&[(rustc_middle[e8be7f10e3e30399]::ty::Predicate, rustc_span[550e41ecb909559f]::span_encoding::Span)] as rustc_serialize[7a7d8c4496902bcc]::serialize::Decodable<rustc_query_impl[131a58ac89a902d8]::on_disk_cache::CacheDecoder>>::decode
18: 0x7ffd4bddd7cc - <rustc_query_impl[131a58ac89a902d8]::on_disk_cache::OnDiskCache>::load_side_effects
19: 0x7ffd4bed8598 - <&[(rustc_middle[e8be7f10e3e30399]::ty::Predicate, rustc_span[550e41ecb909559f]::span_encoding::Span)] as rustc_serialize[7a7d8c4496902bcc]::serialize::Decodable<rustc_query_impl[131a58ac89a902d8]::on_disk_cache::CacheDecoder>>::decode
20: 0x7ffd4bd8c3fa - RNvXsd_NtCs1DGqIPIOvr0_16rustc_query_impl13on_disk_cacheRINtNtNtNtCs7aJtBMv7B6j_3std11collections4hash3set7HashSetNtNtCs7iKsVne8byR_10rustc_span6def_id10LocalDefIdINtNtCs2x5CUVA4D6k_4core4hash18BuildHasherDefaultNtCshQqtYeJfeAw_10rustc_hash8FxHasherEEINtN
21: 0x7ffd4bd8db6c - RNvXsd_NtCs1DGqIPIOvr0_16rustc_query_impl13on_disk_cacheRINtNtNtNtCs7aJtBMv7B6j_3std11collections4hash3set7HashSetNtNtCs7iKsVne8byR_10rustc_span6def_id10LocalDefIdINtNtCs2x5CUVA4D6k_4core4hash18BuildHasherDefaultNtCshQqtYeJfeAw_10rustc_hash8FxHasherEEINtN
22: 0x7ffd4bed86a3 - <&[(rustc_middle[e8be7f10e3e30399]::ty::Predicate, rustc_span[550e41ecb909559f]::span_encoding::Span)] as rustc_serialize[7a7d8c4496902bcc]::serialize::Decodable<rustc_query_impl[131a58ac89a902d8]::on_disk_cache::CacheDecoder>>::decode
23: 0x7ffd4bd44346 - <rustc_query_impl[131a58ac89a902d8]::Queries as rustc_middle[e8be7f10e3e30399]::ty::query::QueryEngine>::try_mark_green
24: 0x7ffd4bed84a9 - <&[(rustc_middle[e8be7f10e3e30399]::ty::Predicate, rustc_span[550e41ecb909559f]::span_encoding::Span)] as rustc_serialize[7a7d8c4496902bcc]::serialize::Decodable<rustc_query_impl[131a58ac89a902d8]::on_disk_cache::CacheDecoder>>::decode
25: 0x7ffd4bddd7cc - <rustc_query_impl[131a58ac89a902d8]::on_disk_cache::OnDiskCache>::load_side_effects
26: 0x7ffd4bed8598 - <&[(rustc_middle[e8be7f10e3e30399]::ty::Predicate, rustc_span[550e41ecb909559f]::span_encoding::Span)] as rustc_serialize[7a7d8c4496902bcc]::serialize::Decodable<rustc_query_impl[131a58ac89a902d8]::on_disk_cache::CacheDecoder>>::decode
27: 0x7ffd4bd8c3fa - RNvXsd_NtCs1DGqIPIOvr0_16rustc_query_impl13on_disk_cacheRINtNtNtNtCs7aJtBMv7B6j_3std11collections4hash3set7HashSetNtNtCs7iKsVne8byR_10rustc_span6def_id10LocalDefIdINtNtCs2x5CUVA4D6k_4core4hash18BuildHasherDefaultNtCshQqtYeJfeAw_10rustc_hash8FxHasherEEINtN
28: 0x7ffd4bd8dcc3 - RNvXsd_NtCs1DGqIPIOvr0_16rustc_query_impl13on_disk_cacheRINtNtNtNtCs7aJtBMv7B6j_3std11collections4hash3set7HashSetNtNtCs7iKsVne8byR_10rustc_span6def_id10LocalDefIdINtNtCs2x5CUVA4D6k_4core4hash18BuildHasherDefaultNtCshQqtYeJfeAw_10rustc_hash8FxHasherEEINtN
29: 0x7ffd4bee4065 - <&[(rustc_middle[e8be7f10e3e30399]::ty::Predicate, rustc_span[550e41ecb909559f]::span_encoding::Span)] as rustc_serialize[7a7d8c4496902bcc]::serialize::Decodable<rustc_query_impl[131a58ac89a902d8]::on_disk_cache::CacheDecoder>>::decode
30: 0x7ffd4bd789cd - <rustc_middle[e8be7f10e3e30399]::mir::interpret::GlobalId as rustc_query_impl[131a58ac89a902d8]::keys::Key>::default_span
31: 0x7ffd4bdd5feb - <rustc_query_impl[131a58ac89a902d8]::on_disk_cache::OnDiskCache>::load_side_effects
32: 0x7ffd4bb133f4 - <rustc_mir_dataflow[752d4053f08c2531]::impls::storage_liveness::MaybeRequiresStorage as rustc_mir_dataflow[752d4053f08c2531]::framework::AnalysisDomain>::initialize_start_block
33: 0x7ffd4bc45037 - <rustc_mir_dataflow[752d4053f08c2531]::impls::storage_liveness::MaybeRequiresStorage as rustc_mir_dataflow[752d4053f08c2531]::framework::AnalysisDomain>::initialize_start_block
34: 0x7ffd4bd05c53 - <rustc_query_impl[131a58ac89a902d8]::Queries>::as_dyn
35: 0x7ffd4bca568a - <rustc_mir_dataflow[752d4053f08c2531]::impls::storage_liveness::MaybeRequiresStorage as rustc_mir_dataflow[752d4053f08c2531]::framework::AnalysisDomain>::initialize_start_block
36: 0x7ffd4bd3e404 - <rustc_query_impl[131a58ac89a902d8]::Queries as rustc_middle[e8be7f10e3e30399]::ty::query::QueryEngine>::try_mark_green
37: 0x7ffd4b221a09 - rustc_ty_utils[3781a4ad9059bb0d]::instance::provide
38: 0x7ffd4b220286 - rustc_ty_utils[3781a4ad9059bb0d]::instance::provide
39: 0x7ffd4bd4d163 - <rustc_query_impl[131a58ac89a902d8]::Queries as rustc_middle[e8be7f10e3e30399]::ty::query::QueryEngine>::try_mark_green
40: 0x7ffd4bc1efec - <rustc_mir_dataflow[752d4053f08c2531]::impls::storage_liveness::MaybeRequiresStorage as rustc_mir_dataflow[752d4053f08c2531]::framework::AnalysisDomain>::initialize_start_block
41: 0x7ffd4bd05822 - <rustc_query_impl[131a58ac89a902d8]::Queries>::as_dyn
42: 0x7ffd4bc8241d - <rustc_mir_dataflow[752d4053f08c2531]::impls::storage_liveness::MaybeRequiresStorage as rustc_mir_dataflow[752d4053f08c2531]::framework::AnalysisDomain>::initialize_start_block
43: 0x7ffd4bd3f661 - <rustc_query_impl[131a58ac89a902d8]::Queries as rustc_middle[e8be7f10e3e30399]::ty::query::QueryEngine>::try_mark_green
44: 0x7ffd4cbd67c9 - <rustc_middle[e8be7f10e3e30399]::ty::instance::Instance>::resolve_opt_const_arg
45: 0x7ffd4cbc839b - <rustc_middle[e8be7f10e3e30399]::ty::instance::Instance>::resolve_for_vtable
46: 0x7ffd4c94d78f - <rustc_trait_selection[1b9055e1c4f657df]::traits::auto_trait::RegionDeps as core[1d83072e00ca4c26]::fmt::Debug>::fmt
47: 0x7ffd4c8ff4ec - rustc_trait_selection[1b9055e1c4f657df]::traits::impossible_predicates
48: 0x7ffd4c8fe6d4 - rustc_trait_selection[1b9055e1c4f657df]::traits::impossible_predicates
49: 0x7ffd4bd4d961 - <rustc_query_impl[131a58ac89a902d8]::Queries as rustc_middle[e8be7f10e3e30399]::ty::query::QueryEngine>::try_mark_green
50: 0x7ffd4bc2098d - <rustc_mir_dataflow[752d4053f08c2531]::impls::storage_liveness::MaybeRequiresStorage as rustc_mir_dataflow[752d4053f08c2531]::framework::AnalysisDomain>::initialize_start_block
51: 0x7ffd4bd0ea62 - <rustc_query_impl[131a58ac89a902d8]::Queries>::as_dyn
52: 0x7ffd4bc7a054 - <rustc_mir_dataflow[752d4053f08c2531]::impls::storage_liveness::MaybeRequiresStorage as rustc_mir_dataflow[752d4053f08c2531]::framework::AnalysisDomain>::initialize_start_block
53: 0x7ffd4bd3e343 - <rustc_query_impl[131a58ac89a902d8]::Queries as rustc_middle[e8be7f10e3e30399]::ty::query::QueryEngine>::try_mark_green
54: 0x7ffd4ac52a34 - <rustc_monomorphize[2d7a027cec0a5735]::collector::MirNeighborCollector as rustc_middle[e8be7f10e3e30399]::mir::visit::Visitor>::visit_operand
55: 0x7ffd4ac506fe - <rustc_monomorphize[2d7a027cec0a5735]::collector::MirNeighborCollector as rustc_middle[e8be7f10e3e30399]::mir::visit::Visitor>::visit_rvalue
56: 0x7ffd4ac54759 - <rustc_monomorphize[2d7a027cec0a5735]::collector::RootCollector as rustc_hir[7e355ad7be8a675b]::itemlikevisit::ItemLikeVisitor>::visit_impl_item
57: 0x7ffd4ac4d7ae - <rustc_monomorphize[2d7a027cec0a5735]::partitioning::MonoItemPlacement as core[1d83072e00ca4c26]::fmt::Debug>::fmt
58: 0x7ffd4ac3701e - <core[1d83072e00ca4c26]::option::Option<rustc_middle[e8be7f10e3e30399]::middle::privacy::AccessLevel> as rustc_privacy[75773fc7197fff26]::VisibilityLike>::new_min
59: 0x7ffd4ac4bd03 - <rustc_monomorphize[2d7a027cec0a5735]::partitioning::MonoItemPlacement as core[1d83072e00ca4c26]::fmt::Debug>::fmt
60: 0x7ffd4ac47aa3 - <rustc_monomorphize[2d7a027cec0a5735]::partitioning::default::DefaultPartitioning as rustc_monomorphize[2d7a027cec0a5735]::partitioning::Partitioner>::internalize_symbols
61: 0x7ffd4bd4c0e3 - <rustc_query_impl[131a58ac89a902d8]::Queries as rustc_middle[e8be7f10e3e30399]::ty::query::QueryEngine>::try_mark_green
62: 0x7ffd4be87703 - <&[rustc_ast[406c67bf1af5d1f0]::ast::InlineAsmTemplatePiece] as rustc_serialize[7a7d8c4496902bcc]::serialize::Decodable<rustc_query_impl[131a58ac89a902d8]::on_disk_cache::CacheDecoder>>::decode
63: 0x7ffd4bd295cc - <rustc_query_impl[131a58ac89a902d8]::Queries>::as_dyn
64: 0x7ffd4bc18e6f - <rustc_mir_dataflow[752d4053f08c2531]::impls::storage_liveness::MaybeRequiresStorage as rustc_mir_dataflow[752d4053f08c2531]::framework::AnalysisDomain>::initialize_start_block
65: 0x7ffd4bce2b20 - <rustc_mir_dataflow[752d4053f08c2531]::impls::storage_liveness::MaybeRequiresStorage as rustc_mir_dataflow[752d4053f08c2531]::framework::AnalysisDomain>::initialize_start_block
66: 0x7ffd4bdb47d7 - rustc_query_impl[131a58ac89a902d8]::query_callbacks::collect_and_partition_mono_items
67: 0x7ffd4cb17bc3 - <rustc_middle[e8be7f10e3e30399]::ty::context::TyCtxt as rustc_query_system[da7f1cc4b8055ce2]::dep_graph::DepContext>::try_force_from_dep_node
68: 0x7ffd4beae53b - <&[rustc_ast[406c67bf1af5d1f0]::ast::InlineAsmTemplatePiece] as rustc_serialize[7a7d8c4496902bcc]::serialize::Decodable<rustc_query_impl[131a58ac89a902d8]::on_disk_cache::CacheDecoder>>::decode
69: 0x7ffd4beae1aa - <&[rustc_ast[406c67bf1af5d1f0]::ast::InlineAsmTemplatePiece] as rustc_serialize[7a7d8c4496902bcc]::serialize::Decodable<rustc_query_impl[131a58ac89a902d8]::on_disk_cache::CacheDecoder>>::decode
70: 0x7ffd4bc3e56d - <rustc_mir_dataflow[752d4053f08c2531]::impls::storage_liveness::MaybeRequiresStorage as rustc_mir_dataflow[752d4053f08c2531]::framework::AnalysisDomain>::initialize_start_block
71: 0x7ffd4bd0f3c2 - <rustc_query_impl[131a58ac89a902d8]::Queries>::as_dyn
72: 0x7ffd4bbe680b - <rustc_mir_dataflow[752d4053f08c2531]::impls::storage_liveness::MaybeRequiresStorage as rustc_mir_dataflow[752d4053f08c2531]::framework::AnalysisDomain>::initialize_start_block
73: 0x7ffd4bc7f093 - <rustc_mir_dataflow[752d4053f08c2531]::impls::storage_liveness::MaybeRequiresStorage as rustc_mir_dataflow[752d4053f08c2531]::framework::AnalysisDomain>::initialize_start_block
74: 0x7ffd4c243bb3 - <rustc_metadata[5db6f7f4bfa8fe45]::rmeta::encoder::EncodeContext as rustc_middle[e8be7f10e3e30399]::ty::codec::TyEncoder>::encode_alloc_id
75: 0x7ffd4c25b940 - rustc_metadata[5db6f7f4bfa8fe45]::rmeta::encoder::encode_metadata
76: 0x7ffd4c2b7325 - <u32 as rustc_metadata[5db6f7f4bfa8fe45]::rmeta::table::FixedSizeEncoding>::write_to_bytes_at
77: 0x7ffd4c25aff3 - rustc_metadata[5db6f7f4bfa8fe45]::rmeta::encoder::encode_metadata
78: 0x7ffd487c8b6c - <rustc_interface[31ce9d8f7019e821]::queries::Queries>::ongoing_codegen
79: 0x7ffd4867563f - <rustc_driver[45305811ac36932b]::args::Error as core[1d83072e00ca4c26]::fmt::Debug>::fmt
80: 0x7ffd486524e5 - <sha2[b9a4e930306da819]::sha512::Sha512 as std[538cbe44b3125595]::io::Write>::flush
81: 0x7ffd48672f91 - <sha2[b9a4e930306da819]::sha512::Sha512 as std[538cbe44b3125595]::io::Write>::flush
82: 0x7ffd48655ac7 - <sha2[b9a4e930306da819]::sha512::Sha512 as std[538cbe44b3125595]::io::Write>::flush
83: 0x7ffd4865470c - <sha2[b9a4e930306da819]::sha512::Sha512 as std[538cbe44b3125595]::io::Write>::flush
84: 0x7ffd48678f08 - <rustc_middle[e8be7f10e3e30399]::ty::SymbolName as core[1d83072e00ca4c26]::fmt::Debug>::fmt
85: 0x7ffdad98a0ac - std::sys::windows::thread::Thread::new::h221b319dbb2805a7
86: 0x7ffdea3f7034 - BaseThreadInitThunk
87: 0x7ffdeb322651 - RtlUserThreadStart
Metadata
Metadata
Assignees
Labels
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
CAD97 commentedon Feb 2, 2022
If I had to guess, #93066 seems very relevant as what could've fixed this.
the blamed line:
rust/compiler/rustc_query_impl/src/on_disk_cache.rs
Line 726 in 0426998
Context
rust/compiler/rustc_query_impl/src/on_disk_cache.rs
Lines 694 to 731 in 0426998
Current
rust/compiler/rustc_query_impl/src/on_disk_cache.rs
Lines 683 to 720 in 27f5d83
The reason for it to not panic anymore isn't localized here, so I can't track it down. cc @nnethercote, any ideas what could've caused this change?
nnethercote commentedon Feb 2, 2022
I can't see how #93066 would affect this. The only likely behavioural changes that PR would cause is that if problems occurred with metadata decoding (e.g. corrupted metadata) then rustc would panic a bit earlier than it did previously.
@Aaron1011 You've been looking a lot at incremental issues lately, any ideas about this one?
Aaron1011 commentedon Feb 3, 2022
I don't think this is caused by the comment itself, but by the change in line numbers triggered by adding/removing lines.
CAD97 commentedon Feb 3, 2022
It does seem to be due to span data changing, but it's interesting in how inconsistent it is; changes in some places are fine, and some aren't.
(And if you're keeping it rustfmtd, it translates to load bearing comments keeping it from reformatting into an ICE.)
In any case, this has been incidentally fixed (suppressed?) by changes between beta and nightly, so I don't know how much investigation this is actually worth. At least it's an ICE rather than a miscomp. Incremental issues spook me.
CAD97 commentedon May 2, 2022
Given that this no longer occurs, I'm going to go ahead and close this.