Open cehteh opened 12 months ago
Unrelated question:
Having a constfn that takes a reference to another function containing &mut references as in:
will complain that &mut
references are not allowed in constfns. Even if the constfn never calls the passed function (meant to attach it in a builder pattern). Is this intentional or a bug?
This became a post-mono error (so it just has a really bad span) in #111580, but no longer ICEs
Code
Minimal Example:
https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=d93a36587d78f6351cf687e2a8f00ace
Meta
rustc --version --verbose
:Same ICE on nightly and beta.
Error output
Backtrace
``` thread 'rustc' panicked at 'Box', /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/compiler/rustc_errors/src/lib.rs:995:33
stack backtrace:
0: 0x7fdc86f62b51 - std::backtrace_rs::backtrace::libunwind::trace::h66dc1c6acf794faa
at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
1: 0x7fdc86f62b51 - std::backtrace_rs::backtrace::trace_unsynchronized::ha80d20099a67f790
at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
2: 0x7fdc86f62b51 - std::sys_common::backtrace::_print_fmt::h7b959d43f35f16d4
at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/sys_common/backtrace.rs:65:5
3: 0x7fdc86f62b51 - ::fmt::hdaa196410d9ee0b9
at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/sys_common/backtrace.rs:44:22
4: 0x7fdc86fc96ff - core::fmt::rt::Argument::fmt::h0ddfbbe8be3f80d0
at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/core/src/fmt/rt.rs:138:9
5: 0x7fdc86fc96ff - core::fmt::write::h66b3c629f3d623e4
at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/core/src/fmt/mod.rs:1094:21
6: 0x7fdc86f55497 - std::io::Write::write_fmt::hb6d80fba4115e0c2
at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/io/mod.rs:1714:15
7: 0x7fdc86f62965 - std::sys_common::backtrace::_print::h1a49cfb0cf3cce17
at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/sys_common/backtrace.rs:47:5
8: 0x7fdc86f62965 - std::sys_common::backtrace::print::hca95c2d0055e42a2
at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/sys_common/backtrace.rs:34:9
9: 0x7fdc86f65743 - std::panicking::default_hook::{{closure}}::hc03c01c56bca600c
at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/panicking.rs:269:22
10: 0x7fdc86f654d4 - std::panicking::default_hook::hb2cb5315b6634f1c
at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/panicking.rs:288:9
11: 0x7fdc8a26b60b - rustc_driver_impl[e91af841be79713a]::install_ice_hook::{closure#0}
12: 0x7fdc86f65f6e - as core::ops::function::Fn>::call::hb3a915ffd78277c6
at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/alloc/src/boxed.rs:2007:9
13: 0x7fdc86f65f6e - std::panicking::rust_panic_with_hook::h75cd912a39a34e8a
at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/panicking.rs:709:13
14: 0x7fdc8a0fc041 - std[74d10c9f32099e86]::panicking::begin_panic::::{closure#0}
15: 0x7fdc8a0fbd66 - std[74d10c9f32099e86]::sys_common::backtrace::__rust_end_short_backtrace::::{closure#0}, !>
16: 0x7fdc8a0e0216 - std[74d10c9f32099e86]::panicking::begin_panic::
17: 0x7fdc8a0de732 - ::span_bug::
18: 0x7fdc8a0ddb76 - ::span_bug::
19: 0x7fdc8a0d8a7d - rustc_middle[fbd75b4db2cdb7e6]::util::bug::opt_span_bug_fmt::::{closure#0}
20: 0x7fdc8a0d8aaa - rustc_middle[fbd75b4db2cdb7e6]::ty::context::tls::with_opt::::{closure#0}, !>::{closure#0}
21: 0x7fdc8a0d738a - rustc_middle[fbd75b4db2cdb7e6]::ty::context::tls::with_context_opt::::{closure#0}, !>::{closure#0}, !>
22: 0x7fdc88b0ebc4 - rustc_middle[fbd75b4db2cdb7e6]::util::bug::span_bug_fmt::
23: 0x7fdc8a12ed1a - ::handle_layout_err
24: 0x7fdc8a128bda - ::spanned_layout_of::{closure#0}
25: 0x7fdc883d5d89 - as rustc_codegen_llvm[367182e9bda81d84]::type_of::LayoutLlvmExt>::llvm_type
26: 0x7fdc8863644e - as rustc_codegen_llvm[367182e9bda81d84]::abi::FnAbiLlvmExt>::llvm_type
27: 0x7fdc883d51b5 - as rustc_codegen_llvm[367182e9bda81d84]::type_of::LayoutLlvmExt>::llvm_type
28: 0x7fdc883d43a4 - as rustc_codegen_llvm[367182e9bda81d84]::type_of::LayoutLlvmExt>::llvm_type
29: 0x7fdc883d43a4 - as rustc_codegen_llvm[367182e9bda81d84]::type_of::LayoutLlvmExt>::llvm_type
30: 0x7fdc8863644e - as rustc_codegen_llvm[367182e9bda81d84]::abi::FnAbiLlvmExt>::llvm_type
31: 0x7fdc88634cfe - ::predefine_fn
32: 0x7fdc8984a945 - rustc_codegen_llvm[367182e9bda81d84]::base::compile_codegen_unit::module_codegen
33: 0x7fdc89848b35 - ::with_deps::<>::with_task>::{closure#0}::{closure#0}, rustc_codegen_ssa[d0f56ad1a06d95ee]::ModuleCodegen>
34: 0x7fdc8984831f - rustc_codegen_llvm[367182e9bda81d84]::base::compile_codegen_unit
35: 0x7fdc89845965 - rustc_codegen_ssa[d0f56ad1a06d95ee]::base::codegen_crate::
36: 0x7fdc89845266 - ::codegen_crate
37: 0x7fdc89729a72 - ::time::, rustc_interface[9522ab489a5f66e6]::passes::start_codegen::{closure#0}>
38: 0x7fdc897295bb - rustc_interface[9522ab489a5f66e6]::passes::start_codegen
39: 0x7fdc8972319a - ::enter::<::ongoing_codegen::{closure#0}, core[63ccc595abf60ca6]::result::Result, rustc_span[ca0c6fb73220b455]::ErrorGuaranteed>>
40: 0x7fdc897225e8 - ::enter::, rustc_span[ca0c6fb73220b455]::ErrorGuaranteed>>
41: 0x7fdc8971f7b5 - rustc_span[ca0c6fb73220b455]::set_source_map::, rustc_interface[9522ab489a5f66e6]::interface::run_compiler, rustc_driver_impl[e91af841be79713a]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
42: 0x7fdc8971f226 - >::set::, rustc_driver_impl[e91af841be79713a]::run_compiler::{closure#1}>::{closure#0}, core[63ccc595abf60ca6]::result::Result<(), rustc_span[ca0c6fb73220b455]::ErrorGuaranteed>>
43: 0x7fdc8971e7ec - std[74d10c9f32099e86]::sys_common::backtrace::__rust_begin_short_backtrace::, rustc_driver_impl[e91af841be79713a]::run_compiler::{closure#1}>::{closure#0}, core[63ccc595abf60ca6]::result::Result<(), rustc_span[ca0c6fb73220b455]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[63ccc595abf60ca6]::result::Result<(), rustc_span[ca0c6fb73220b455]::ErrorGuaranteed>>
44: 0x7fdc89aa53b5 - <::spawn_unchecked_, rustc_driver_impl[e91af841be79713a]::run_compiler::{closure#1}>::{closure#0}, core[63ccc595abf60ca6]::result::Result<(), rustc_span[ca0c6fb73220b455]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[63ccc595abf60ca6]::result::Result<(), rustc_span[ca0c6fb73220b455]::ErrorGuaranteed>>::{closure#1} as core[63ccc595abf60ca6]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
45: 0x7fdc86f70425 - as core::ops::function::FnOnce>::call_once::hde6e666388faa495
at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/alloc/src/boxed.rs:1993:9
46: 0x7fdc86f70425 - as core::ops::function::FnOnce>::call_once::h9b6389e489a4842f
at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/alloc/src/boxed.rs:1993:9
47: 0x7fdc86f70425 - std::sys::unix::thread::Thread::new::thread_start::hcab660740b858b1f
at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/sys/unix/thread.rs:108:17
48: 0x7fdc86d0d044 - start_thread
at ./nptl/pthread_create.c:442:8
49: 0x7fdc86d8d5fc - __GI___clone3
at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
50: 0x0 -
```