Closed matthiaskrgr closed 1 year ago
Regression in https://github.com/rust-lang/rust/pull/111097 :sweat_smile: cc @oli-obk
bwahaha, oh yea, code assuming layout computation can't fail... uh... we should change the sites where that happens to calling abort_if_errors
instead of bug!
tbh I find it a bit concerning that this did not trigger anything in our ci :/ The code originally is from https://github.com/rust-lang/rust/issues/22919 which was fixed in 2015
Our code coverage of rustc via its test suite is probably not very high in the error cases.
Do you have ideas for changing this fundamentally? I guess step 0 would be to actually generate coverage information
hm, ./src/tools/miri/tests/fail/layout_cycle.rs
would have failed if we had built it regularly with rustc, I guess the test pr that fixed https://github.com/rust-lang/rust/issues/22919 could also have added more tests.
I guess we could test all miri tests against miri and against rustc
@rustbot claim
(I think) this is the trait method that needs to change (most implementors directly return !
or just propagates the LayoutError). I'm not quite sure how to best change this. Perhaps just change it to no return?
you can make the !
returners always invoke span_fatal
, irrespective of the LayoutError
variant.
Code
Meta
rustc --version --verbose
:Error output
Backtrace
``` error[E0391]: cycle detected when computing layout of `S
>` | = note: ...which requires computing layout of `as Tr>::I`... = note: ...which again requires computing layout of `S>`, completing the cycle error: internal compiler error: compiler/rustc_codegen_llvm/src/context.rs:974:13: failed to get layout for `S>`: a cycle occurred during layout computation thread 'rustc' panicked at 'Box', /rustc/129195f57c02c8a8e4cfc4b766d4ff7a3a837882/compiler/rustc_errors/src/lib.rs:994:33
stack backtrace:
0: 0x7f4c65369441 - std::backtrace_rs::backtrace::libunwind::trace::hb9be772067563b53
at /rustc/129195f57c02c8a8e4cfc4b766d4ff7a3a837882/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
1: 0x7f4c65369441 - std::backtrace_rs::backtrace::trace_unsynchronized::h031da30dc183647f
at /rustc/129195f57c02c8a8e4cfc4b766d4ff7a3a837882/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
2: 0x7f4c65369441 - std::sys_common::backtrace::_print_fmt::h71eced90df8827aa
at /rustc/129195f57c02c8a8e4cfc4b766d4ff7a3a837882/library/std/src/sys_common/backtrace.rs:65:5
3: 0x7f4c65369441 - ::fmt::hae72971f9b1c0375
at /rustc/129195f57c02c8a8e4cfc4b766d4ff7a3a837882/library/std/src/sys_common/backtrace.rs:44:22
4: 0x7f4c653ca0df - core::fmt::rt::Argument::fmt::h8155c503d36c9b86
at /rustc/129195f57c02c8a8e4cfc4b766d4ff7a3a837882/library/core/src/fmt/rt.rs:138:9
5: 0x7f4c653ca0df - core::fmt::write::hbbb4251c2513c3ef
at /rustc/129195f57c02c8a8e4cfc4b766d4ff7a3a837882/library/core/src/fmt/mod.rs:1094:21
6: 0x7f4c6535c591 - std::io::Write::write_fmt::hdcff7ff4dad8c59b
at /rustc/129195f57c02c8a8e4cfc4b766d4ff7a3a837882/library/std/src/io/mod.rs:1712:15
7: 0x7f4c65369255 - std::sys_common::backtrace::_print::hb8bd80d5dffe8016
at /rustc/129195f57c02c8a8e4cfc4b766d4ff7a3a837882/library/std/src/sys_common/backtrace.rs:47:5
8: 0x7f4c65369255 - std::sys_common::backtrace::print::hd57b6e007b7d9859
at /rustc/129195f57c02c8a8e4cfc4b766d4ff7a3a837882/library/std/src/sys_common/backtrace.rs:34:9
9: 0x7f4c6536bee7 - std::panicking::default_hook::{{closure}}::h92b5b1db37900f49
10: 0x7f4c6536bcd4 - std::panicking::default_hook::h33b32947a165ebfe
at /rustc/129195f57c02c8a8e4cfc4b766d4ff7a3a837882/library/std/src/panicking.rs:288:9
11: 0x7f4c685707b5 - >::call_once::{shim:vtable#0}
12: 0x7f4c6536c607 - as core::ops::function::Fn>::call::h65038aad28115701
at /rustc/129195f57c02c8a8e4cfc4b766d4ff7a3a837882/library/alloc/src/boxed.rs:1999:9
13: 0x7f4c6536c607 - std::panicking::rust_panic_with_hook::h6818a1a7c65e9cdd
at /rustc/129195f57c02c8a8e4cfc4b766d4ff7a3a837882/library/std/src/panicking.rs:695:13
14: 0x7f4c68402f91 - std[7223d5cfbaf62610]::panicking::begin_panic::::{closure#0}
15: 0x7f4c68401c26 - std[7223d5cfbaf62610]::sys_common::backtrace::__rust_end_short_backtrace::::{closure#0}, !>
16: 0x7f4c68401ac6 - std[7223d5cfbaf62610]::panicking::begin_panic::
17: 0x7f4c683f6802 - ::span_bug::
18: 0x7f4c683f5f46 - ::span_bug::
19: 0x7f4c683faedd - rustc_middle[faa0e51d0d5710e5]::util::bug::opt_span_bug_fmt::::{closure#0}
20: 0x7f4c683faf0a - rustc_middle[faa0e51d0d5710e5]::ty::context::tls::with_opt::::{closure#0}, !>::{closure#0}
21: 0x7f4c683faaba - rustc_middle[faa0e51d0d5710e5]::ty::context::tls::with_context_opt::::{closure#0}, !>::{closure#0}, !>
22: 0x7f4c66d96d44 - rustc_middle[faa0e51d0d5710e5]::util::bug::span_bug_fmt::
23: 0x7f4c6840d400 - ::handle_layout_err
24: 0x7f4c6840d312 - ::spanned_layout_of::{closure#0}
25: 0x7f4c66db0a4e - ::spanned_layout_of
26: 0x7f4c66da905f - >::codegen_rvalue_operand
27: 0x7f4c66d756bc - rustc_codegen_ssa[ec866eaa3e7fa1d8]::mir::codegen_mir::
28: 0x7f4c67a12312 - rustc_codegen_llvm[f6e646cf3297fbe4]::base::compile_codegen_unit::module_codegen
29: 0x7f4c67a11160 - rustc_codegen_llvm[f6e646cf3297fbe4]::base::compile_codegen_unit
30: 0x7f4c67c55486 - rustc_codegen_ssa[ec866eaa3e7fa1d8]::base::codegen_crate::
31: 0x7f4c67c54d52 - ::codegen_crate
32: 0x7f4c67803e90 - rustc_interface[145311d2418df64f]::passes::start_codegen
33: 0x7f4c677fef07 - ::enter::<::ongoing_codegen::{closure#0}::{closure#0}, core[65ac48eb02ee08bd]::result::Result, rustc_span[418048bff763fbc6]::ErrorGuaranteed>>
34: 0x7f4c677fe4e8 - ::ongoing_codegen
35: 0x7f4c677fdc23 - ::enter::, rustc_span[418048bff763fbc6]::ErrorGuaranteed>>
36: 0x7f4c677fb38f - std[7223d5cfbaf62610]::sys_common::backtrace::__rust_begin_short_backtrace::, rustc_driver_impl[2c3cd2b22615ac74]::run_compiler::{closure#1}>::{closure#0}, core[65ac48eb02ee08bd]::result::Result<(), rustc_span[418048bff763fbc6]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[65ac48eb02ee08bd]::result::Result<(), rustc_span[418048bff763fbc6]::ErrorGuaranteed>>
37: 0x7f4c67e59e9e - <::spawn_unchecked_, rustc_driver_impl[2c3cd2b22615ac74]::run_compiler::{closure#1}>::{closure#0}, core[65ac48eb02ee08bd]::result::Result<(), rustc_span[418048bff763fbc6]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[65ac48eb02ee08bd]::result::Result<(), rustc_span[418048bff763fbc6]::ErrorGuaranteed>>::{closure#1} as core[65ac48eb02ee08bd]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
38: 0x7f4c65376ad5 - as core::ops::function::FnOnce>::call_once::haa143886c5139467
at /rustc/129195f57c02c8a8e4cfc4b766d4ff7a3a837882/library/alloc/src/boxed.rs:1985:9
39: 0x7f4c65376ad5 - as core::ops::function::FnOnce>::call_once::ha0b7575cc93abe25
at /rustc/129195f57c02c8a8e4cfc4b766d4ff7a3a837882/library/alloc/src/boxed.rs:1985:9
40: 0x7f4c65376ad5 - std::sys::unix::thread::Thread::new::thread_start::ha9600bcb75fadfd8
at /rustc/129195f57c02c8a8e4cfc4b766d4ff7a3a837882/library/std/src/sys/unix/thread.rs:108:17
41: 0x7f4c65112bb5 -
42: 0x7f4c65194d90 -
43: 0x0 -
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.71.0-nightly (129195f57 2023-05-04) running on x86_64-unknown-linux-gnu
query stack during panic:
end of query stack
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0391`.
```