Skip to content

Start using pattern types in libcore #136006

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

oli-obk
Copy link
Contributor

@oli-obk oli-obk commented Jan 24, 2025

cc #135996

blocked on rust-analyzer getting support for computing the right layout for pattern types

cc @Veykril no rush here, as long as we can't replace NonNull, there's no point in doing this change just yet

@rustbot

This comment was marked as outdated.

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Jan 24, 2025
@oli-obk oli-obk added S-blocked Status: Blocked on something else such as an RFC or other implementation work. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 24, 2025
@rust-log-analyzer

This comment has been minimized.

Copy link
Member

@compiler-errors compiler-errors left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well r=me when/if it does get unblocked.

@rust-log-analyzer

This comment has been minimized.

#[repr(transparent)]
$(#[$m])*
#[cfg(not(bootstrap))]
$vis struct $name(pattern_type!($int is $low..=$high));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unsure: at least for the NonZeroBlahInner ones, it'd be nicer if these could just be type $name = pattern_type!($int is $low..=$high);, without the extra wrapper. Is that feasible, or are the trait implementations too far off?

(Relatedly, I'd love to be able to just derive traits on these again, particularly to not have to manually StructuralPartialEq.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea... I wanna get there, but directly using pattern types is not a great experience at present

@rust-log-analyzer

This comment has been minimized.

@rustbot
Copy link
Collaborator

rustbot commented Jan 27, 2025

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

@Veykril
Copy link
Member

Veykril commented Jan 27, 2025

Re rust-analyzer blocker, as it turns out to implement pattern types (to a degree that would unblock this) it comes down to the same architecture changes required as for rust-lang/rust-analyzer#7434 (which I am currently looking into), so that will take a bit.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rustbot
Copy link
Collaborator

rustbot commented Jan 27, 2025

Some changes occurred to the CTFE machinery

cc @rust-lang/wg-const-eval

Some changes occurred to the CTFE / Miri interpreter

cc @rust-lang/miri

@rust-log-analyzer

This comment has been minimized.

@oli-obk
Copy link
Contributor Author

oli-obk commented May 7, 2025

libcore is now rustc_layout_scalar_valid_range-free

@rust-log-analyzer

This comment has been minimized.

@oli-obk oli-obk force-pushed the push-tzonluoyuwkq branch from 34f252a to a53ab8e Compare May 8, 2025 09:17
@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Collaborator

bors commented May 10, 2025

☔ The latest upstream changes (presumably #140895) made this pull request unmergeable. Please resolve the merge conflicts.

@oli-obk oli-obk force-pushed the push-tzonluoyuwkq branch from a53ab8e to 78978b1 Compare June 3, 2025 14:29
@rustbot rustbot added the A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. label Jun 3, 2025
@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Collaborator

bors commented Jun 4, 2025

☔ The latest upstream changes (presumably #141984) made this pull request unmergeable. Please resolve the merge conflicts.

@oli-obk oli-obk force-pushed the push-tzonluoyuwkq branch 2 times, most recently from 273e347 to 60ff307 Compare June 5, 2025 11:17
@oli-obk oli-obk force-pushed the push-tzonluoyuwkq branch from 60ff307 to 3b1a4e0 Compare June 6, 2025 08:25
@rust-log-analyzer

This comment has been minimized.

@oli-obk oli-obk force-pushed the push-tzonluoyuwkq branch from 3b1a4e0 to a0b3c54 Compare June 6, 2025 13:55
@rust-log-analyzer

This comment has been minimized.

@oli-obk
Copy link
Contributor Author

oli-obk commented Jun 6, 2025

Will fix the ICE in #142124

@bors
Copy link
Collaborator

bors commented Jun 7, 2025

☔ The latest upstream changes (presumably #142133) made this pull request unmergeable. Please resolve the merge conflicts.

@oli-obk oli-obk force-pushed the push-tzonluoyuwkq branch from a0b3c54 to b329461 Compare June 11, 2025 08:46
@rust-log-analyzer
Copy link
Collaborator

The job mingw-check-2 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
[RUSTC-TIMING] seq_compare test:true 0.508
[RUSTC-TIMING] thread test:true 0.776
[RUSTC-TIMING] slice_from_array_issue_113238 test:true 0.207
[RUSTC-TIMING] builtin_clone test:true 0.289
error: internal compiler error: /checkout/compiler/rustc_codegen_ssa/src/base.rs:329:14: coerce_unsized_into: invalid coercion pattern_type!(*const alloc::sync::ArcInner<usize> is !null) -> pattern_type!(*const alloc::sync::ArcInner<dyn [Binder { value: Trait(std::any::Any), bound_vars: [] }, Binder { value: AutoTrait(DefId(2:3638 ~ core[f050]::marker::Sync)), bound_vars: [] }, Binder { value: AutoTrait(DefId(2:38155 ~ core[f050]::marker::Send)), bound_vars: [] }] + '{erased}> is !null)


thread 'rustc' panicked at /checkout/compiler/rustc_codegen_ssa/src/base.rs:329:14:
Box<dyn Any>
stack backtrace:
   0:     0x7f858d9fe822 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h6bed9dc66a5cec52
   1:     0x7f858da4b0c3 - core::fmt::write::h7d74dd6e449cae1f
   2:     0x7f858d9f3333 - std::io::Write::write_fmt::h68b3bc9d54a39d7f
   3:     0x7f858d9fe672 - std::sys::backtrace::BacktraceLock::print::h6b5cffc33d0e9592
   4:     0x7f858da0234c - std::panicking::default_hook::{{closure}}::h5fc51e281b0877ca
   5:     0x7f858da0214f - std::panicking::default_hook::h03c499ee84a534f3
   6:     0x7f858943d902 - <alloc[fd9347d1b2560651]::boxed::Box<rustc_driver_impl[b7da9f8e34b982]::install_ice_hook::{closure#1}> as core[bdde32e857371a49]::ops::function::Fn<(&dyn for<'a, 'b> core[bdde32e857371a49]::ops::function::Fn<(&'a std[4ece947bc34e96db]::panic::PanicHookInfo<'b>,), Output = ()> + core[bdde32e857371a49]::marker::Sync + core[bdde32e857371a49]::marker::Send, &std[4ece947bc34e96db]::panic::PanicHookInfo)>>::call
   7:     0x7f858da02e33 - std::panicking::rust_panic_with_hook::ha891520ba817caf1
   8:     0x7f858d5d20f3 - std[4ece947bc34e96db]::panicking::begin_panic::<rustc_errors[a6962c0bf3ccd8ef]::ExplicitBug>::{closure#0}
   9:     0x7f858d5d1ba6 - std[4ece947bc34e96db]::sys::backtrace::__rust_end_short_backtrace::<std[4ece947bc34e96db]::panicking::begin_panic<rustc_errors[a6962c0bf3ccd8ef]::ExplicitBug>::{closure#0}, !>
  10:     0x7f8589333053 - std[4ece947bc34e96db]::panicking::begin_panic::<rustc_errors[a6962c0bf3ccd8ef]::ExplicitBug>
  11:     0x7f8589333112 - <rustc_errors[a6962c0bf3ccd8ef]::diagnostic::BugAbort as rustc_errors[a6962c0bf3ccd8ef]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  12:     0x7f858d412c05 - rustc_middle[2f5e5c5bfeb207fc]::util::bug::opt_span_bug_fmt::<rustc_span[1765e2c1b3349ba9]::span_encoding::Span>::{closure#0}
  13:     0x7f858d41286a - rustc_middle[2f5e5c5bfeb207fc]::ty::context::tls::with_opt::<rustc_middle[2f5e5c5bfeb207fc]::util::bug::opt_span_bug_fmt<rustc_span[1765e2c1b3349ba9]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  14:     0x7f858d412806 - rustc_middle[2f5e5c5bfeb207fc]::ty::context::tls::with_context_opt::<rustc_middle[2f5e5c5bfeb207fc]::ty::context::tls::with_opt<rustc_middle[2f5e5c5bfeb207fc]::util::bug::opt_span_bug_fmt<rustc_span[1765e2c1b3349ba9]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  15:     0x7f858931f582 - rustc_middle[2f5e5c5bfeb207fc]::util::bug::bug_fmt
  16:     0x7f858991179e - rustc_codegen_ssa[6ddf39060c892d4c]::base::coerce_unsized_into::<rustc_codegen_llvm[eacd75f00ffcf1d6]::builder::GenericBuilder<rustc_codegen_llvm[eacd75f00ffcf1d6]::context::FullCx>>
  17:     0x7f85899116d4 - rustc_codegen_ssa[6ddf39060c892d4c]::base::coerce_unsized_into::<rustc_codegen_llvm[eacd75f00ffcf1d6]::builder::GenericBuilder<rustc_codegen_llvm[eacd75f00ffcf1d6]::context::FullCx>>
  18:     0x7f85899116d4 - rustc_codegen_ssa[6ddf39060c892d4c]::base::coerce_unsized_into::<rustc_codegen_llvm[eacd75f00ffcf1d6]::builder::GenericBuilder<rustc_codegen_llvm[eacd75f00ffcf1d6]::context::FullCx>>
  19:     0x7f8589a105a7 - rustc_codegen_ssa[6ddf39060c892d4c]::mir::codegen_mir::<rustc_codegen_llvm[eacd75f00ffcf1d6]::builder::GenericBuilder<rustc_codegen_llvm[eacd75f00ffcf1d6]::context::FullCx>>
---
  25:     0x7f858995fcfd - <rustc_codegen_llvm[eacd75f00ffcf1d6]::LlvmCodegenBackend as rustc_codegen_ssa[6ddf39060c892d4c]::traits::backend::CodegenBackend>::codegen_crate
  26:     0x7f858972cf1f - <rustc_session[a4ee9cd8d7d1c069]::session::Session>::time::<alloc[fd9347d1b2560651]::boxed::Box<dyn core[bdde32e857371a49]::any::Any>, rustc_interface[257343c8d1a97383]::passes::start_codegen::{closure#0}>
  27:     0x7f85896cb180 - rustc_interface[257343c8d1a97383]::passes::start_codegen
  28:     0x7f8589744462 - <rustc_interface[257343c8d1a97383]::queries::Linker>::codegen_and_build_linker
  29:     0x7f85893a38ab - <std[4ece947bc34e96db]::thread::local::LocalKey<core[bdde32e857371a49]::cell::Cell<*const ()>>>::with::<rustc_middle[2f5e5c5bfeb207fc]::ty::context::tls::enter_context<<rustc_middle[2f5e5c5bfeb207fc]::ty::context::GlobalCtxt>::enter<rustc_interface[257343c8d1a97383]::passes::create_and_enter_global_ctxt<core[bdde32e857371a49]::option::Option<rustc_interface[257343c8d1a97383]::queries::Linker>, rustc_driver_impl[b7da9f8e34b982]::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}, core[bdde32e857371a49]::option::Option<rustc_interface[257343c8d1a97383]::queries::Linker>>::{closure#1}, core[bdde32e857371a49]::option::Option<rustc_interface[257343c8d1a97383]::queries::Linker>>::{closure#0}, core[bdde32e857371a49]::option::Option<rustc_interface[257343c8d1a97383]::queries::Linker>>
  30:     0x7f858946f3e4 - <rustc_middle[2f5e5c5bfeb207fc]::ty::context::TyCtxt>::create_global_ctxt::<core[bdde32e857371a49]::option::Option<rustc_interface[257343c8d1a97383]::queries::Linker>, rustc_interface[257343c8d1a97383]::passes::create_and_enter_global_ctxt<core[bdde32e857371a49]::option::Option<rustc_interface[257343c8d1a97383]::queries::Linker>, rustc_driver_impl[b7da9f8e34b982]::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}>
  31:     0x7f85893d56f5 - <rustc_interface[257343c8d1a97383]::passes::create_and_enter_global_ctxt<core[bdde32e857371a49]::option::Option<rustc_interface[257343c8d1a97383]::queries::Linker>, rustc_driver_impl[b7da9f8e34b982]::run_compiler::{closure#0}::{closure#2}>::{closure#2} as core[bdde32e857371a49]::ops::function::FnOnce<(&rustc_session[a4ee9cd8d7d1c069]::session::Session, rustc_middle[2f5e5c5bfeb207fc]::ty::context::CurrentGcx, alloc[fd9347d1b2560651]::sync::Arc<rustc_data_structures[adc595eda5ea087d]::jobserver::Proxy>, &std[4ece947bc34e96db]::sync::once_lock::OnceLock<rustc_middle[2f5e5c5bfeb207fc]::ty::context::GlobalCtxt>, &rustc_data_structures[adc595eda5ea087d]::sync::worker_local::WorkerLocal<rustc_middle[2f5e5c5bfeb207fc]::arena::Arena>, &rustc_data_structures[adc595eda5ea087d]::sync::worker_local::WorkerLocal<rustc_hir[6a946604dc3ce3e0]::Arena>, rustc_driver_impl[b7da9f8e34b982]::run_compiler::{closure#0}::{closure#2})>>::call_once::{shim:vtable#0}
  32:     0x7f858943d5e6 - <alloc[fd9347d1b2560651]::boxed::Box<dyn for<'a> core[bdde32e857371a49]::ops::function::FnOnce<(&'a rustc_session[a4ee9cd8d7d1c069]::session::Session, rustc_middle[2f5e5c5bfeb207fc]::ty::context::CurrentGcx, alloc[fd9347d1b2560651]::sync::Arc<rustc_data_structures[adc595eda5ea087d]::jobserver::Proxy>, &'a std[4ece947bc34e96db]::sync::once_lock::OnceLock<rustc_middle[2f5e5c5bfeb207fc]::ty::context::GlobalCtxt<'a>>, &'a rustc_data_structures[adc595eda5ea087d]::sync::worker_local::WorkerLocal<rustc_middle[2f5e5c5bfeb207fc]::arena::Arena<'a>>, &'a rustc_data_structures[adc595eda5ea087d]::sync::worker_local::WorkerLocal<rustc_hir[6a946604dc3ce3e0]::Arena<'a>>, rustc_driver_impl[b7da9f8e34b982]::run_compiler::{closure#0}::{closure#2}), Output = core[bdde32e857371a49]::option::Option<rustc_interface[257343c8d1a97383]::queries::Linker>>> as core[bdde32e857371a49]::ops::function::FnOnce<(&rustc_session[a4ee9cd8d7d1c069]::session::Session, rustc_middle[2f5e5c5bfeb207fc]::ty::context::CurrentGcx, alloc[fd9347d1b2560651]::sync::Arc<rustc_data_structures[adc595eda5ea087d]::jobserver::Proxy>, &std[4ece947bc34e96db]::sync::once_lock::OnceLock<rustc_middle[2f5e5c5bfeb207fc]::ty::context::GlobalCtxt>, &rustc_data_structures[adc595eda5ea087d]::sync::worker_local::WorkerLocal<rustc_middle[2f5e5c5bfeb207fc]::arena::Arena>, &rustc_data_structures[adc595eda5ea087d]::sync::worker_local::WorkerLocal<rustc_hir[6a946604dc3ce3e0]::Arena>, rustc_driver_impl[b7da9f8e34b982]::run_compiler::{closure#0}::{closure#2})>>::call_once
  33:     0x7f85893b44aa - rustc_interface[257343c8d1a97383]::passes::create_and_enter_global_ctxt::<core[bdde32e857371a49]::option::Option<rustc_interface[257343c8d1a97383]::queries::Linker>, rustc_driver_impl[b7da9f8e34b982]::run_compiler::{closure#0}::{closure#2}>
  34:     0x7f85893d8a11 - rustc_span[1765e2c1b3349ba9]::create_session_globals_then::<(), rustc_interface[257343c8d1a97383]::util::run_in_thread_with_globals<rustc_interface[257343c8d1a97383]::util::run_in_thread_pool_with_globals<rustc_interface[257343c8d1a97383]::interface::run_compiler<(), rustc_driver_impl[b7da9f8e34b982]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}::{closure#0}>
  35:     0x7f85893aeda9 - std[4ece947bc34e96db]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[257343c8d1a97383]::util::run_in_thread_with_globals<rustc_interface[257343c8d1a97383]::util::run_in_thread_pool_with_globals<rustc_interface[257343c8d1a97383]::interface::run_compiler<(), rustc_driver_impl[b7da9f8e34b982]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  36:     0x7f85893e5a63 - <<std[4ece947bc34e96db]::thread::Builder>::spawn_unchecked_<rustc_interface[257343c8d1a97383]::util::run_in_thread_with_globals<rustc_interface[257343c8d1a97383]::util::run_in_thread_pool_with_globals<rustc_interface[257343c8d1a97383]::interface::run_compiler<(), rustc_driver_impl[b7da9f8e34b982]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[bdde32e857371a49]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  37:     0x7f858da05e7b - std::sys::pal::unix::thread::Thread::new::thread_start::hd325dd57d8c72c6b
  38:     0x7f858866bac3 - <unknown>
  39:     0x7f85886fd850 - <unknown>
  40:                0x0 - <unknown>

note: using internal features is not supported and expected to cause internal compiler errors when used incorrectly

warning: the ICE couldn't be written to `/checkout/rustc-ice-2025-06-11T09_22_17-48210.txt`: Read-only file system (os error 30)

note: rustc 1.89.0-nightly (50bc6213c 2025-06-11) running on x86_64-unknown-linux-gnu

note: compiler flags: -C opt-level=3 -C embed-bitcode=no -C codegen-units=1 -C debug-assertions=on -C symbol-mangling-version=legacy -Z unstable-options -Z macro-backtrace -C split-debuginfo=off -C prefer-dynamic -Z validate-mir -Z mir-opt-level=3 -Z inline-mir -Z inline-mir-preserve-debug -Z mir_strip_debuginfo=locals-in-tiny-functions -C link-args=-Wl,-z,origin -C link-args=-Wl,-rpath,$ORIGIN/../lib -C embed-bitcode=yes -Z unstable-options -C force-frame-pointers=non-leaf -Z crate-attr=doc(html_root_url="https://doc.rust-lang.org/nightly/") -Z binary-dep-depinfo -Z force-unstable-if-unmarked

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
[RUSTC-TIMING] alloctests test:true 28.094
error: could not compile `alloctests` (test "alloctests")

Caused by:
  process didn't exit successfully: `/checkout/obj/build/bootstrap/debug/rustc /checkout/obj/build/bootstrap/debug/rustc --crate-name alloctests --edition=2021 library/alloctests/tests/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --emit=dep-info,link -C opt-level=3 -C embed-bitcode=no -C codegen-units=1 --warn=unexpected_cfgs --check-cfg 'cfg(no_global_oom_handling)' --check-cfg 'cfg(no_rc)' --check-cfg 'cfg(no_sync)' --check-cfg 'cfg(randomized_layouts)' -C debug-assertions=on --test --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values())' -C metadata=9ae8c3224a5777f1 -C extra-filename=-8f391857e2b940aa --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps --target x86_64-unknown-linux-gnu -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-std/release/deps --extern alloctests=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps/liballoctests-e8013ad64ddaacd5.rlib --extern rand=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps/librand-bab34b197d36432c.rlib --extern rand_xorshift=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps/librand_xorshift-481590750b037c44.rlib -Csymbol-mangling-version=legacy '--check-cfg=cfg(feature,values(any()))' -Zunstable-options -Zmacro-backtrace -Csplit-debuginfo=off -Cprefer-dynamic -Zvalidate-mir -Zmir-opt-level=3 -Zinline-mir -Zinline-mir-preserve-debug -Zmir_strip_debuginfo=locals-in-tiny-functions -Clink-args=-Wl,-z,origin '-Clink-args=-Wl,-rpath,$ORIGIN/../lib' -Alinker-messages -Cembed-bitcode=yes -Zunstable-options -Cforce-frame-pointers=non-leaf '-Zcrate-attr=doc(html_root_url="https://doc.rust-lang.org/nightly/")' -Z binary-dep-depinfo` (exit status: 101)
warning: build failed, waiting for other jobs to finish...
[RUSTC-TIMING] corebenches test:true 73.837
[RUSTC-TIMING] sync test:true 33.651
error: internal compiler error: /checkout/compiler/rustc_codegen_ssa/src/base.rs:329:14: coerce_unsized_into: invalid coercion pattern_type!(*const [i32; 3_usize] is !null) -> pattern_type!(*const [i32] is !null)


thread 'rustc' panicked at /checkout/compiler/rustc_codegen_ssa/src/base.rs:329:14:
Box<dyn Any>
stack backtrace:
   0:     0x7f29a63fe822 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h6bed9dc66a5cec52
   1:     0x7f29a644b0c3 - core::fmt::write::h7d74dd6e449cae1f
   2:     0x7f29a63f3333 - std::io::Write::write_fmt::h68b3bc9d54a39d7f
   3:     0x7f29a63fe672 - std::sys::backtrace::BacktraceLock::print::h6b5cffc33d0e9592
   4:     0x7f29a640234c - std::panicking::default_hook::{{closure}}::h5fc51e281b0877ca
   5:     0x7f29a640214f - std::panicking::default_hook::h03c499ee84a534f3
   6:     0x7f29a1e3d902 - <alloc[fd9347d1b2560651]::boxed::Box<rustc_driver_impl[b7da9f8e34b982]::install_ice_hook::{closure#1}> as core[bdde32e857371a49]::ops::function::Fn<(&dyn for<'a, 'b> core[bdde32e857371a49]::ops::function::Fn<(&'a std[4ece947bc34e96db]::panic::PanicHookInfo<'b>,), Output = ()> + core[bdde32e857371a49]::marker::Sync + core[bdde32e857371a49]::marker::Send, &std[4ece947bc34e96db]::panic::PanicHookInfo)>>::call
   7:     0x7f29a6402e33 - std::panicking::rust_panic_with_hook::ha891520ba817caf1
   8:     0x7f29a5fd20f3 - std[4ece947bc34e96db]::panicking::begin_panic::<rustc_errors[a6962c0bf3ccd8ef]::ExplicitBug>::{closure#0}
   9:     0x7f29a5fd1ba6 - std[4ece947bc34e96db]::sys::backtrace::__rust_end_short_backtrace::<std[4ece947bc34e96db]::panicking::begin_panic<rustc_errors[a6962c0bf3ccd8ef]::ExplicitBug>::{closure#0}, !>
  10:     0x7f29a1d33053 - std[4ece947bc34e96db]::panicking::begin_panic::<rustc_errors[a6962c0bf3ccd8ef]::ExplicitBug>
  11:     0x7f29a1d33112 - <rustc_errors[a6962c0bf3ccd8ef]::diagnostic::BugAbort as rustc_errors[a6962c0bf3ccd8ef]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  12:     0x7f29a5e12c05 - rustc_middle[2f5e5c5bfeb207fc]::util::bug::opt_span_bug_fmt::<rustc_span[1765e2c1b3349ba9]::span_encoding::Span>::{closure#0}
  13:     0x7f29a5e1286a - rustc_middle[2f5e5c5bfeb207fc]::ty::context::tls::with_opt::<rustc_middle[2f5e5c5bfeb207fc]::util::bug::opt_span_bug_fmt<rustc_span[1765e2c1b3349ba9]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  14:     0x7f29a5e12806 - rustc_middle[2f5e5c5bfeb207fc]::ty::context::tls::with_context_opt::<rustc_middle[2f5e5c5bfeb207fc]::ty::context::tls::with_opt<rustc_middle[2f5e5c5bfeb207fc]::util::bug::opt_span_bug_fmt<rustc_span[1765e2c1b3349ba9]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  15:     0x7f29a1d1f582 - rustc_middle[2f5e5c5bfeb207fc]::util::bug::bug_fmt
  16:     0x7f29a231179e - rustc_codegen_ssa[6ddf39060c892d4c]::base::coerce_unsized_into::<rustc_codegen_llvm[eacd75f00ffcf1d6]::builder::GenericBuilder<rustc_codegen_llvm[eacd75f00ffcf1d6]::context::FullCx>>
  17:     0x7f29a23116d4 - rustc_codegen_ssa[6ddf39060c892d4c]::base::coerce_unsized_into::<rustc_codegen_llvm[eacd75f00ffcf1d6]::builder::GenericBuilder<rustc_codegen_llvm[eacd75f00ffcf1d6]::context::FullCx>>
  18:     0x7f29a23116d4 - rustc_codegen_ssa[6ddf39060c892d4c]::base::coerce_unsized_into::<rustc_codegen_llvm[eacd75f00ffcf1d6]::builder::GenericBuilder<rustc_codegen_llvm[eacd75f00ffcf1d6]::context::FullCx>>
  19:     0x7f29a24105a7 - rustc_codegen_ssa[6ddf39060c892d4c]::mir::codegen_mir::<rustc_codegen_llvm[eacd75f00ffcf1d6]::builder::GenericBuilder<rustc_codegen_llvm[eacd75f00ffcf1d6]::context::FullCx>>
---
  25:     0x7f29a235fcfd - <rustc_codegen_llvm[eacd75f00ffcf1d6]::LlvmCodegenBackend as rustc_codegen_ssa[6ddf39060c892d4c]::traits::backend::CodegenBackend>::codegen_crate
  26:     0x7f29a212cf1f - <rustc_session[a4ee9cd8d7d1c069]::session::Session>::time::<alloc[fd9347d1b2560651]::boxed::Box<dyn core[bdde32e857371a49]::any::Any>, rustc_interface[257343c8d1a97383]::passes::start_codegen::{closure#0}>
  27:     0x7f29a20cb180 - rustc_interface[257343c8d1a97383]::passes::start_codegen
  28:     0x7f29a2144462 - <rustc_interface[257343c8d1a97383]::queries::Linker>::codegen_and_build_linker
  29:     0x7f29a1da38ab - <std[4ece947bc34e96db]::thread::local::LocalKey<core[bdde32e857371a49]::cell::Cell<*const ()>>>::with::<rustc_middle[2f5e5c5bfeb207fc]::ty::context::tls::enter_context<<rustc_middle[2f5e5c5bfeb207fc]::ty::context::GlobalCtxt>::enter<rustc_interface[257343c8d1a97383]::passes::create_and_enter_global_ctxt<core[bdde32e857371a49]::option::Option<rustc_interface[257343c8d1a97383]::queries::Linker>, rustc_driver_impl[b7da9f8e34b982]::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}, core[bdde32e857371a49]::option::Option<rustc_interface[257343c8d1a97383]::queries::Linker>>::{closure#1}, core[bdde32e857371a49]::option::Option<rustc_interface[257343c8d1a97383]::queries::Linker>>::{closure#0}, core[bdde32e857371a49]::option::Option<rustc_interface[257343c8d1a97383]::queries::Linker>>
  30:     0x7f29a1e6f3e4 - <rustc_middle[2f5e5c5bfeb207fc]::ty::context::TyCtxt>::create_global_ctxt::<core[bdde32e857371a49]::option::Option<rustc_interface[257343c8d1a97383]::queries::Linker>, rustc_interface[257343c8d1a97383]::passes::create_and_enter_global_ctxt<core[bdde32e857371a49]::option::Option<rustc_interface[257343c8d1a97383]::queries::Linker>, rustc_driver_impl[b7da9f8e34b982]::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}>
  31:     0x7f29a1dd56f5 - <rustc_interface[257343c8d1a97383]::passes::create_and_enter_global_ctxt<core[bdde32e857371a49]::option::Option<rustc_interface[257343c8d1a97383]::queries::Linker>, rustc_driver_impl[b7da9f8e34b982]::run_compiler::{closure#0}::{closure#2}>::{closure#2} as core[bdde32e857371a49]::ops::function::FnOnce<(&rustc_session[a4ee9cd8d7d1c069]::session::Session, rustc_middle[2f5e5c5bfeb207fc]::ty::context::CurrentGcx, alloc[fd9347d1b2560651]::sync::Arc<rustc_data_structures[adc595eda5ea087d]::jobserver::Proxy>, &std[4ece947bc34e96db]::sync::once_lock::OnceLock<rustc_middle[2f5e5c5bfeb207fc]::ty::context::GlobalCtxt>, &rustc_data_structures[adc595eda5ea087d]::sync::worker_local::WorkerLocal<rustc_middle[2f5e5c5bfeb207fc]::arena::Arena>, &rustc_data_structures[adc595eda5ea087d]::sync::worker_local::WorkerLocal<rustc_hir[6a946604dc3ce3e0]::Arena>, rustc_driver_impl[b7da9f8e34b982]::run_compiler::{closure#0}::{closure#2})>>::call_once::{shim:vtable#0}
  32:     0x7f29a1e3d5e6 - <alloc[fd9347d1b2560651]::boxed::Box<dyn for<'a> core[bdde32e857371a49]::ops::function::FnOnce<(&'a rustc_session[a4ee9cd8d7d1c069]::session::Session, rustc_middle[2f5e5c5bfeb207fc]::ty::context::CurrentGcx, alloc[fd9347d1b2560651]::sync::Arc<rustc_data_structures[adc595eda5ea087d]::jobserver::Proxy>, &'a std[4ece947bc34e96db]::sync::once_lock::OnceLock<rustc_middle[2f5e5c5bfeb207fc]::ty::context::GlobalCtxt<'a>>, &'a rustc_data_structures[adc595eda5ea087d]::sync::worker_local::WorkerLocal<rustc_middle[2f5e5c5bfeb207fc]::arena::Arena<'a>>, &'a rustc_data_structures[adc595eda5ea087d]::sync::worker_local::WorkerLocal<rustc_hir[6a946604dc3ce3e0]::Arena<'a>>, rustc_driver_impl[b7da9f8e34b982]::run_compiler::{closure#0}::{closure#2}), Output = core[bdde32e857371a49]::option::Option<rustc_interface[257343c8d1a97383]::queries::Linker>>> as core[bdde32e857371a49]::ops::function::FnOnce<(&rustc_session[a4ee9cd8d7d1c069]::session::Session, rustc_middle[2f5e5c5bfeb207fc]::ty::context::CurrentGcx, alloc[fd9347d1b2560651]::sync::Arc<rustc_data_structures[adc595eda5ea087d]::jobserver::Proxy>, &std[4ece947bc34e96db]::sync::once_lock::OnceLock<rustc_middle[2f5e5c5bfeb207fc]::ty::context::GlobalCtxt>, &rustc_data_structures[adc595eda5ea087d]::sync::worker_local::WorkerLocal<rustc_middle[2f5e5c5bfeb207fc]::arena::Arena>, &rustc_data_structures[adc595eda5ea087d]::sync::worker_local::WorkerLocal<rustc_hir[6a946604dc3ce3e0]::Arena>, rustc_driver_impl[b7da9f8e34b982]::run_compiler::{closure#0}::{closure#2})>>::call_once
  33:     0x7f29a1db44aa - rustc_interface[257343c8d1a97383]::passes::create_and_enter_global_ctxt::<core[bdde32e857371a49]::option::Option<rustc_interface[257343c8d1a97383]::queries::Linker>, rustc_driver_impl[b7da9f8e34b982]::run_compiler::{closure#0}::{closure#2}>
  34:     0x7f29a1dd8a11 - rustc_span[1765e2c1b3349ba9]::create_session_globals_then::<(), rustc_interface[257343c8d1a97383]::util::run_in_thread_with_globals<rustc_interface[257343c8d1a97383]::util::run_in_thread_pool_with_globals<rustc_interface[257343c8d1a97383]::interface::run_compiler<(), rustc_driver_impl[b7da9f8e34b982]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}::{closure#0}>
  35:     0x7f29a1daeda9 - std[4ece947bc34e96db]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[257343c8d1a97383]::util::run_in_thread_with_globals<rustc_interface[257343c8d1a97383]::util::run_in_thread_pool_with_globals<rustc_interface[257343c8d1a97383]::interface::run_compiler<(), rustc_driver_impl[b7da9f8e34b982]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  36:     0x7f29a1de5a63 - <<std[4ece947bc34e96db]::thread::Builder>::spawn_unchecked_<rustc_interface[257343c8d1a97383]::util::run_in_thread_with_globals<rustc_interface[257343c8d1a97383]::util::run_in_thread_pool_with_globals<rustc_interface[257343c8d1a97383]::interface::run_compiler<(), rustc_driver_impl[b7da9f8e34b982]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[bdde32e857371a49]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  37:     0x7f29a6405e7b - std::sys::pal::unix::thread::Thread::new::thread_start::hd325dd57d8c72c6b
  38:     0x7f29a106bac3 - <unknown>
  39:     0x7f29a10fd850 - <unknown>
  40:                0x0 - <unknown>

note: using internal features is not supported and expected to cause internal compiler errors when used incorrectly

warning: the ICE couldn't be written to `/checkout/rustc-ice-2025-06-11T09_22_06-48050.txt`: Read-only file system (os error 30)

note: rustc 1.89.0-nightly (50bc6213c 2025-06-11) running on x86_64-unknown-linux-gnu

note: compiler flags: -C opt-level=3 -C embed-bitcode=no -C codegen-units=1 -C debug-assertions=on -C symbol-mangling-version=legacy -Z unstable-options -Z macro-backtrace -C split-debuginfo=off -C prefer-dynamic -Z validate-mir -Z mir-opt-level=3 -Z inline-mir -Z inline-mir-preserve-debug -Z mir_strip_debuginfo=locals-in-tiny-functions -C link-args=-Wl,-z,origin -C link-args=-Wl,-rpath,$ORIGIN/../lib -C embed-bitcode=yes -Z unstable-options -C force-frame-pointers=non-leaf -Z crate-attr=doc(html_root_url="https://doc.rust-lang.org/nightly/") -Z binary-dep-depinfo -Z force-unstable-if-unmarked

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
[RUSTC-TIMING] coretests test:true 91.561
error: could not compile `coretests` (test "coretests")

Caused by:
  process didn't exit successfully: `/checkout/obj/build/bootstrap/debug/rustc /checkout/obj/build/bootstrap/debug/rustc --crate-name coretests --edition=2024 library/coretests/tests/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --emit=dep-info,link -C opt-level=3 -C embed-bitcode=no -C codegen-units=1 --warn=unexpected_cfgs --check-cfg 'cfg(target_has_reliable_f16)' --check-cfg 'cfg(target_has_reliable_f16_math)' --check-cfg 'cfg(target_has_reliable_f128)' --check-cfg 'cfg(target_has_reliable_f128_math)' -C debug-assertions=on --test --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values())' -C metadata=be4de002eb3b4c89 -C extra-filename=-4ab46dfdeca47260 --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps --target x86_64-unknown-linux-gnu -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-std/release/deps --extern coretests=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps/libcoretests-90d64acab960b8d3.rlib --extern rand=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps/librand-bab34b197d36432c.rlib --extern rand_xorshift=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps/librand_xorshift-481590750b037c44.rlib -Csymbol-mangling-version=legacy '--check-cfg=cfg(feature,values(any()))' -Zunstable-options -Zmacro-backtrace -Csplit-debuginfo=off -Cprefer-dynamic -Zvalidate-mir -Zmir-opt-level=3 -Zinline-mir -Zinline-mir-preserve-debug -Zmir_strip_debuginfo=locals-in-tiny-functions -Clink-args=-Wl,-z,origin '-Clink-args=-Wl,-rpath,$ORIGIN/../lib' -Alinker-messages -Cembed-bitcode=yes -Zunstable-options -Cforce-frame-pointers=non-leaf '-Zcrate-attr=doc(html_root_url="https://doc.rust-lang.org/nightly/")' -Z binary-dep-depinfo` (exit status: 101)
Build completed unsuccessfully in 0:02:54
  local time: Wed Jun 11 09:23:38 UTC 2025
  network time: Wed, 11 Jun 2025 09:23:38 GMT
##[error]Process completed with exit code 1.
Post job cleanup.

Comment on lines +270 to +272
ty::PatternKind::NotNull => {
self.tcx.types.unit.print(self)?;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pattern types temporarily reusing tuple encoding risk breakage due to symbol conflicts. For example, the following fails to compile with -Csymbol-mangling-version=v0:

#![feature(pattern_types)]
#![feature(pattern_type_macro)]
use std::hint::black_box;
use std::mem::size_of;
use std::pat::pattern_type;

fn main() {
    black_box(size_of::<pattern_type!(usize is 0..=1)> as fn() -> usize);
    black_box(size_of::<(usize, [(); 0], [(); 1])> as fn() -> usize);
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yea, I guess I need to change rustc-demangle first, then update our internal dependency on it, then update what we emit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. O-unix Operating system: Unix-like O-wasi Operating system: Wasi, Webassembly System Interface O-wasm Target: WASM (WebAssembly), http://webassembly.org/ S-blocked Status: Blocked on something else such as an RFC or other implementation work. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.