Open Millione opened 1 week ago
Corresponded PR: https://github.com/rust-lang/rust/pull/132613
cc @khuey but we really need a reproduction for this otherwise there's not much we can do here, it'll be guess work at best which is not very actionable.
We could fix the ICE pretty easily (by dropping debug information when we hit this case). But it would be good to verify that this really is a case with a proc-macro that ends up with the same function inlined into it a huge number of times first.
@Millione If you get some time to work on the minimization here, it will significantly improve the odds that we can fix this without losing debuginfo unnecessarily, and in general interesting reproduction cases make rustc's test suite more resilient.
Hi everyone, I have constructed a minimal code base to reproduce this bug. This bug must be triggered by a function call with more than 4096 lines of code and containing macro expansion in the parameters. Because the code file is long, I submitted it to this repository: https://github.com/buaazp/rust-bug. The repository contains the replica code and generation script for comparison testing. Once the function is less than or equal to 4096 lines, rustc will not panic. You can give it a try and contact me anytime if you have any questions.
Thanks, I'll take a look. That this happens without a proc-macro is unexpected.
Ok, it's unexpected to me because I misunderstood how macro Spans work. I'll write a PR.
@rustbot claim
Code
Can not reproduce it with minimized code for now, and the whole repository is private.
Update: Thanks for @buaazp providing a minimal reproduce codebase https://github.com/buaazp/rust-bug.
Meta
rustc --version --verbose
:Error output
Backtrace
``` stack backtrace: 0: 0x7f9ccd2b0ada -::fmt::h2f1c5db75869eef0
1: 0x7f9ccda47126 - core::fmt::write::h43b2df425572a034
2: 0x7f9ccea4c991 - std::io::Write::write_fmt::h77e35077f9fad7c4
3: 0x7f9ccd2b0932 - std::sys::backtrace::BacktraceLock::print::h0c19526194593f74
4: 0x7f9ccd2b2e36 - std::panicking::default_hook::{{closure}}::h865cf38b8deeb5bb
5: 0x7f9ccd2b2c80 - std::panicking::default_hook::h69c14be83dcb49b3
6: 0x7f9ccc329849 - std[3c0d0ff6ea8c1a1f]::panicking::update_hook::>::{closure#0}
7: 0x7f9ccd2b3548 - std::panicking::rust_panic_with_hook::h583f6aaba9a390bd
8: 0x7f9ccd2b331a - std::panicking::begin_panic_handler::{{closure}}::h02a363aabf2442f1
9: 0x7f9ccd2b0f89 - std::sys::backtrace::__rust_end_short_backtrace::h84ecae8072aa78ac
10: 0x7f9ccd2b2fdc - rust_begin_unwind
11: 0x7f9cc9d15640 - core::panicking::panic_fmt::h514b8325f5f2609d
12: 0x7f9cca2aa44b - core::option::expect_failed::h3eb9ea9a180694f7
13: 0x7f9cca085139 - rustc_codegen_llvm[163141f4e00b7ecb]::debuginfo::create_scope_map::make_mir_scope
14: 0x7f9cce998306 - rustc_codegen_ssa[b2545927768e4a09]::mir::codegen_mir::
15: 0x7f9cce995b85 - rustc_codegen_llvm[163141f4e00b7ecb]::base::compile_codegen_unit::module_codegen
16: 0x7f9cce96c4d1 - ::compile_codegen_unit
17: 0x7f9ccc1619ca - rayon[c458d3a2004a12bf]::iter::plumbing::bridge_producer_consumer::helper::, rayon[c458d3a2004a12bf]::iter::filter_map::FilterMapConsumer, (usize, (rustc_codegen_ssa[b2545927768e4a09]::ModuleCodegen, u64)), std[3c0d0ff6ea8c1a1f]::collections::hash::map::HashMap, u64), rustc_hash[8e68038b4b9c783c]::FxBuildHasher>, rustc_codegen_ssa[b2545927768e4a09]::base::codegen_crate::{closure#6}::{closure#1}>::{closure#0}::{closure#0}>>
18: 0x7f9cce96a340 - ::codegen_crate
19: 0x7f9ccec310e7 - ::codegen_and_build_linker
20: 0x7f9cce907f6a - rustc_interface[fd324feaaa946fb2]::interface::run_compiler::, rustc_driver_impl[83ab483273712ee2]::run_compiler::{closure#0}>::{closure#1}
21: 0x7f9ccc33497d - , ::in_worker_cold<::install, rustc_driver_impl[83ab483273712ee2]::run_compiler::{closure#0}>::{closure#1}, core[3a5812f1f6fa4837]::result::Result<(), rustc_span[8e1c5aac56eafb7b]::ErrorGuaranteed>>::{closure#3}::{closure#0}::{closure#1}::{closure#0}, core[3a5812f1f6fa4837]::result::Result<(), rustc_span[8e1c5aac56eafb7b]::ErrorGuaranteed>>::{closure#0}, core[3a5812f1f6fa4837]::result::Result<(), rustc_span[8e1c5aac56eafb7b]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[3a5812f1f6fa4837]::result::Result<(), rustc_span[8e1c5aac56eafb7b]::ErrorGuaranteed>> as rayon_core[b1c0e86ef95b0e5b]::job::Job>::execute
22: 0x7f9ccbe081ae - ::wait_until_cold
23: 0x7f9ccbe05c17 - ::run
24: 0x7f9ccc32c4e6 - <::spawn<::build_scoped, rustc_driver_impl[83ab483273712ee2]::run_compiler::{closure#0}>::{closure#1}, core[3a5812f1f6fa4837]::result::Result<(), rustc_span[8e1c5aac56eafb7b]::ErrorGuaranteed>>::{closure#3}::{closure#0}::{closure#0}, rustc_interface[fd324feaaa946fb2]::util::run_in_thread_pool_with_globals, rustc_driver_impl[83ab483273712ee2]::run_compiler::{closure#0}>::{closure#1}, core[3a5812f1f6fa4837]::result::Result<(), rustc_span[8e1c5aac56eafb7b]::ErrorGuaranteed>>::{closure#3}::{closure#0}::{closure#1}, core[3a5812f1f6fa4837]::result::Result<(), rustc_span[8e1c5aac56eafb7b]::ErrorGuaranteed>>::{closure#0}::{closure#0}::{closure#0}, ()>::{closure#0} as core[3a5812f1f6fa4837]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
25: 0x7f9ccc32099e - std[3c0d0ff6ea8c1a1f]::sys::backtrace::__rust_begin_short_backtrace:: + core[3a5812f1f6fa4837]::marker::Send>, ()>
26: 0x7f9ccc32c012 - <::spawn_unchecked_ + core[3a5812f1f6fa4837]::marker::Send>, ()>::{closure#1} as core[3a5812f1f6fa4837]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
27: 0x7f9cce973839 - std::sys::pal::unix::thread::Thread::new::thread_start::h664ba273de986494
28: 0x7f9cc8c10fa3 - start_thread
at /build/reproducible-path/glibc-2.28/nptl/pthread_create.c:486:8
29: 0x7f9cc8b4206f - __GI___clone
at /build/reproducible-path/glibc-2.28/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:95
30: 0x0 -
```
rustc-ice-2024-11-11T12_30_37-1345317.txt