Closed
Description
Code
rustc -Zsanitizer=cfi -Clto -Zvalidate-mir file.rs
struct Cursor {}
struct TokenTree {}
impl Iterator for Cursor {
type Item = TokenTree;
fn next(&mut self) -> Option<TokenTree> {
None
}
}
fn tokenstream_probably_equal_for_proc_macro() {
fn break_tokens(_tree: TokenTree) -> impl Iterator {
let token_trees: Vec<TokenTree> = vec![];
token_trees.into_iter()
}
let c1 = Cursor {};
let c2 = Cursor {};
let mut t1 = c1.flat_map(break_tokens);
let mut t2 = c2.flat_map(break_tokens);
for (_t1, _t2) in t1.by_ref().zip(t2.by_ref()) {}
}
fn main() {
tokenstream_probably_equal_for_proc_macro();
}
Meta
rustc --version --verbose
:
rustc 1.73.0-nightly (0be115231 2023-07-27)
binary: rustc
commit-hash: 0be11523110a8354120068cd5c69434fdec2dc87
commit-date: 2023-07-27
host: x86_64-unknown-linux-gnu
release: 1.73.0-nightly
LLVM version: 16.0.5
Error output
<output>
Backtrace
error: internal compiler error: compiler/rustc_middle/src/ty/normalize_erasing_regions.rs:195:90: Failed to normalize std::option::Option<(<&mut std::iter::FlatMap<Cursor, std::vec::IntoIter<TokenTree>, fn(TokenTree) -> impl std::iter::Iterator {tokenstream_probably_equal_for_proc_macro::break_tokens}> as std::iter::Iterator>::Item, <&mut std::iter::FlatMap<Cursor, std::vec::IntoIter<TokenTree>, fn(TokenTree) -> impl std::iter::Iterator {tokenstream_probably_equal_for_proc_macro::break_tokens}> as std::iter::Iterator>::Item)>, maybe try to call `try_normalize_erasing_regions` instead
thread 'rustc' panicked at 'Box<dyn Any>', /rustc/0be11523110a8354120068cd5c69434fdec2dc87/compiler/rustc_errors/src/lib.rs:1645:9
stack backtrace:
0: 0x7fe26c162fc1 - std::backtrace_rs::backtrace::libunwind::trace::h11251a01d1f7368f
at /rustc/0be11523110a8354120068cd5c69434fdec2dc87/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
1: 0x7fe26c162fc1 - std::backtrace_rs::backtrace::trace_unsynchronized::h8c7e9c161dec6ceb
at /rustc/0be11523110a8354120068cd5c69434fdec2dc87/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
2: 0x7fe26c162fc1 - std::sys_common::backtrace::_print_fmt::h3dbd85d6c7b23aee
at /rustc/0be11523110a8354120068cd5c69434fdec2dc87/library/std/src/sys_common/backtrace.rs:65:5
3: 0x7fe26c162fc1 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h0d3e596e8094daf5
at /rustc/0be11523110a8354120068cd5c69434fdec2dc87/library/std/src/sys_common/backtrace.rs:44:22
4: 0x7fe26c1c949c - core::fmt::rt::Argument::fmt::h4fcb9ccc4ae8b178
at /rustc/0be11523110a8354120068cd5c69434fdec2dc87/library/core/src/fmt/rt.rs:138:9
5: 0x7fe26c1c949c - core::fmt::write::hde6b07169611e983
at /rustc/0be11523110a8354120068cd5c69434fdec2dc87/library/core/src/fmt/mod.rs:1094:21
6: 0x7fe26c1557ae - std::io::Write::write_fmt::hadeda9f51824c419
at /rustc/0be11523110a8354120068cd5c69434fdec2dc87/library/std/src/io/mod.rs:1714:15
7: 0x7fe26c162dd5 - std::sys_common::backtrace::_print::h16e96fa77560cf6c
at /rustc/0be11523110a8354120068cd5c69434fdec2dc87/library/std/src/sys_common/backtrace.rs:47:5
8: 0x7fe26c162dd5 - std::sys_common::backtrace::print::hd2b25c630669a41b
at /rustc/0be11523110a8354120068cd5c69434fdec2dc87/library/std/src/sys_common/backtrace.rs:34:9
9: 0x7fe26c165e2a - std::panicking::panic_hook_with_disk_dump::{{closure}}::h820f75f8c35ebc61
at /rustc/0be11523110a8354120068cd5c69434fdec2dc87/library/std/src/panicking.rs:278:22
10: 0x7fe26c165ac3 - std::panicking::panic_hook_with_disk_dump::h254fc8cd4ac07a17
at /rustc/0be11523110a8354120068cd5c69434fdec2dc87/library/std/src/panicking.rs:312:9
11: 0x7fe26f383859 - <rustc_driver_impl[23d24208d96aabf1]::install_ice_hook::{closure#0} as core[446b5c3084867e6e]::ops::function::FnOnce<(&core[446b5c3084867e6e]::panic::panic_info::PanicInfo,)>>::call_once::{shim:vtable#0}
12: 0x7fe26c1666d0 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h6b21a74b9087088a
at /rustc/0be11523110a8354120068cd5c69434fdec2dc87/library/alloc/src/boxed.rs:2021:9
13: 0x7fe26c1666d0 - std::panicking::rust_panic_with_hook::h88d69e7f62e6ab00
at /rustc/0be11523110a8354120068cd5c69434fdec2dc87/library/std/src/panicking.rs:733:13
14: 0x7fe26f904621 - std[f8657784229daa3e]::panicking::begin_panic::<rustc_errors[fda530a411b01ce3]::ExplicitBug>::{closure#0}
15: 0x7fe26f9028b6 - std[f8657784229daa3e]::sys_common::backtrace::__rust_end_short_backtrace::<std[f8657784229daa3e]::panicking::begin_panic<rustc_errors[fda530a411b01ce3]::ExplicitBug>::{closure#0}, !>
16: 0x7fe26f8bf676 - std[f8657784229daa3e]::panicking::begin_panic::<rustc_errors[fda530a411b01ce3]::ExplicitBug>
17: 0x7fe26f95ebb4 - <rustc_errors[fda530a411b01ce3]::HandlerInner>::bug::<alloc[da36cf216491d02e]::string::String>
18: 0x7fe26f95ea38 - <rustc_errors[fda530a411b01ce3]::Handler>::bug::<alloc[da36cf216491d02e]::string::String>
19: 0x7fe26f98264c - rustc_middle[9ff9a8da46dab689]::util::bug::opt_span_bug_fmt::<rustc_span[ae27aa9cbbacfb85]::span_encoding::Span>::{closure#0}
20: 0x7fe26f98144a - rustc_middle[9ff9a8da46dab689]::ty::context::tls::with_opt::<rustc_middle[9ff9a8da46dab689]::util::bug::opt_span_bug_fmt<rustc_span[ae27aa9cbbacfb85]::span_encoding::Span>::{closure#0}, !>::{closure#0}
21: 0x7fe26f981418 - rustc_middle[9ff9a8da46dab689]::ty::context::tls::with_context_opt::<rustc_middle[9ff9a8da46dab689]::ty::context::tls::with_opt<rustc_middle[9ff9a8da46dab689]::util::bug::opt_span_bug_fmt<rustc_span[ae27aa9cbbacfb85]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
22: 0x7fe26de3d7c0 - rustc_middle[9ff9a8da46dab689]::util::bug::bug_fmt
23: 0x7fe26d582736 - <rustc_middle[9ff9a8da46dab689]::ty::normalize_erasing_regions::NormalizeAfterErasingRegionsFolder as rustc_type_ir[bdd47b881fb85426]::fold::TypeFolder<rustc_middle[9ff9a8da46dab689]::ty::context::TyCtxt>>::fold_ty
24: 0x7fe26dc53ba7 - <&rustc_middle[9ff9a8da46dab689]::ty::list::List<rustc_middle[9ff9a8da46dab689]::ty::Ty> as rustc_type_ir[bdd47b881fb85426]::fold::TypeFoldable<rustc_middle[9ff9a8da46dab689]::ty::context::TyCtxt>>::try_fold_with::<rustc_middle[9ff9a8da46dab689]::ty::normalize_erasing_regions::NormalizeAfterErasingRegionsFolder>
25: 0x7fe26dc55c35 - rustc_ty_utils[cae53f24ff15ba1]::abi::fn_abi_new_uncached
26: 0x7fe26dc52eaf - rustc_ty_utils[cae53f24ff15ba1]::abi::fn_abi_of_instance
27: 0x7fe26d41e19f - rustc_query_impl[9659d37ffb281dd2]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[9659d37ffb281dd2]::query_impl::fn_abi_of_instance::dynamic_query::{closure#2}::{closure#0}, rustc_middle[9ff9a8da46dab689]::query::erase::Erased<[u8; 16usize]>>
28: 0x7fe26e17959e - rustc_query_system[f67fa4e91318ac5a]::query::plumbing::try_execute_query::<rustc_query_impl[9659d37ffb281dd2]::DynamicConfig<rustc_query_system[f67fa4e91318ac5a]::query::caches::DefaultCache<rustc_middle[9ff9a8da46dab689]::ty::ParamEnvAnd<(rustc_middle[9ff9a8da46dab689]::ty::instance::Instance, &rustc_middle[9ff9a8da46dab689]::ty::list::List<rustc_middle[9ff9a8da46dab689]::ty::Ty>)>, rustc_middle[9ff9a8da46dab689]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[9659d37ffb281dd2]::plumbing::QueryCtxt, false>
29: 0x7fe26e17918a - rustc_query_impl[9659d37ffb281dd2]::query_impl::fn_abi_of_instance::get_query_non_incr::__rust_end_short_backtrace
30: 0x7fe26fe37402 - rustc_symbol_mangling[db9110d89b8803cd]::typeid::typeid_itanium_cxx_abi::typeid_for_instance
31: 0x7fe26dbafd9c - <rustc_codegen_llvm[9be676f5ea734376]::context::CodegenCx as rustc_codegen_ssa[4f9ac761dca802d4]::traits::declare::PreDefineMethods>::predefine_fn
32: 0x7fe26e46f67c - rustc_codegen_llvm[9be676f5ea734376]::base::compile_codegen_unit::module_codegen
33: 0x7fe26e46d2d9 - rustc_codegen_llvm[9be676f5ea734376]::base::compile_codegen_unit
34: 0x7fe26e469ac4 - rustc_codegen_ssa[4f9ac761dca802d4]::base::codegen_crate::<rustc_codegen_llvm[9be676f5ea734376]::LlvmCodegenBackend>
35: 0x7fe26e4694bb - <rustc_codegen_llvm[9be676f5ea734376]::LlvmCodegenBackend as rustc_codegen_ssa[4f9ac761dca802d4]::traits::backend::CodegenBackend>::codegen_crate
36: 0x7fe26e5ac5a2 - <rustc_session[fd244e4ad4d5b785]::session::Session>::time::<alloc[da36cf216491d02e]::boxed::Box<dyn core[446b5c3084867e6e]::any::Any>, rustc_interface[107315fc4480df53]::passes::start_codegen::{closure#0}>
37: 0x7fe26e5ac11b - rustc_interface[107315fc4480df53]::passes::start_codegen
38: 0x7fe26e5a6daa - <rustc_middle[9ff9a8da46dab689]::ty::context::GlobalCtxt>::enter::<<rustc_interface[107315fc4480df53]::queries::Queries>::ongoing_codegen::{closure#0}, core[446b5c3084867e6e]::result::Result<alloc[da36cf216491d02e]::boxed::Box<dyn core[446b5c3084867e6e]::any::Any>, rustc_span[ae27aa9cbbacfb85]::ErrorGuaranteed>>
39: 0x7fe26e5a5de3 - <rustc_interface[107315fc4480df53]::interface::Compiler>::enter::<rustc_driver_impl[23d24208d96aabf1]::run_compiler::{closure#1}::{closure#2}, core[446b5c3084867e6e]::result::Result<core[446b5c3084867e6e]::option::Option<rustc_interface[107315fc4480df53]::queries::Linker>, rustc_span[ae27aa9cbbacfb85]::ErrorGuaranteed>>
40: 0x7fe26e59ee38 - std[f8657784229daa3e]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[107315fc4480df53]::util::run_in_thread_pool_with_globals<rustc_interface[107315fc4480df53]::interface::run_compiler<core[446b5c3084867e6e]::result::Result<(), rustc_span[ae27aa9cbbacfb85]::ErrorGuaranteed>, rustc_driver_impl[23d24208d96aabf1]::run_compiler::{closure#1}>::{closure#0}, core[446b5c3084867e6e]::result::Result<(), rustc_span[ae27aa9cbbacfb85]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[446b5c3084867e6e]::result::Result<(), rustc_span[ae27aa9cbbacfb85]::ErrorGuaranteed>>
41: 0x7fe26e59e5be - <<std[f8657784229daa3e]::thread::Builder>::spawn_unchecked_<rustc_interface[107315fc4480df53]::util::run_in_thread_pool_with_globals<rustc_interface[107315fc4480df53]::interface::run_compiler<core[446b5c3084867e6e]::result::Result<(), rustc_span[ae27aa9cbbacfb85]::ErrorGuaranteed>, rustc_driver_impl[23d24208d96aabf1]::run_compiler::{closure#1}>::{closure#0}, core[446b5c3084867e6e]::result::Result<(), rustc_span[ae27aa9cbbacfb85]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[446b5c3084867e6e]::result::Result<(), rustc_span[ae27aa9cbbacfb85]::ErrorGuaranteed>>::{closure#1} as core[446b5c3084867e6e]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
42: 0x7fe26c170dc5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h9a82d72b2d10ea03
at /rustc/0be11523110a8354120068cd5c69434fdec2dc87/library/alloc/src/boxed.rs:2007:9
43: 0x7fe26c170dc5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h9f222f89042b2a16
at /rustc/0be11523110a8354120068cd5c69434fdec2dc87/library/alloc/src/boxed.rs:2007:9
44: 0x7fe26c170dc5 - std::sys::unix::thread::Thread::new::thread_start::ha2f5b7c44359c19a
at /rustc/0be11523110a8354120068cd5c69434fdec2dc87/library/std/src/sys/unix/thread.rs:108:17
45: 0x7fe26bf0244b - <unknown>
46: 0x7fe26bf85e40 - <unknown>
47: 0x0 - <unknown>
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: please attach the file at `/tmp/im/rustc-ice-2023-07-28T05:24:43.909419548Z-1954426.txt` to your bug report
note: compiler flags: -Z sanitizer=cfi -C lto -Z mir-opt-level=0 -Z validate-mir
query stack during panic:
#0 [fn_abi_of_instance] computing call ABI of `<core::iter::adapters::zip::Zip<&mut core::iter::adapters::flatten::FlatMap<Cursor, alloc::vec::into_iter::IntoIter<TokenTree>, tokenstream_probably_equal_for_proc_macro::break_tokens>, &mut core::iter::adapters::flatten::FlatMap<Cursor, alloc::vec::into_iter::IntoIter<TokenTree>, tokenstream_probably_equal_for_proc_macro::break_tokens>> as core::iter::traits::iterator::Iterator>::next`
end of query stack
error: aborting due to previous error
Metadata
Metadata
Assignees
Labels
Unstable option: MIR validationArea: Sanitizers for correctness and code qualityCategory: This is a bug.Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Project group: Exploit mitigationsRelevant to the compiler team, which will review and decide on the PR/issue.This issue requires a nightly compiler in some way.