Skip to content

Chore/move more types to ir#152706

Draft
Jamesbarford wants to merge 3 commits intorust-lang:mainfrom
Jamesbarford:chore/move-more-types-to-ir
Draft

Chore/move more types to ir#152706
Jamesbarford wants to merge 3 commits intorust-lang:mainfrom
Jamesbarford:chore/move-more-types-to-ir

Conversation

@Jamesbarford
Copy link
Contributor

r? ghost

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rust-analyzer Relevant to the rust-analyzer team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) labels Feb 16, 2026
@Jamesbarford Jamesbarford force-pushed the chore/move-more-types-to-ir branch from 3ef4cf0 to c64839d Compare February 16, 2026 12:35
@rust-log-analyzer
Copy link
Collaborator

The job aarch64-gnu-llvm-20-1 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
REPOSITORY                                   TAG       IMAGE ID       CREATED       SIZE
ghcr.io/dependabot/dependabot-updater-core   latest    afc745c7535d   2 weeks ago   783MB
=> Removing docker images...
Deleted Images:
untagged: ghcr.io/dependabot/dependabot-updater-core:latest
untagged: ghcr.io/dependabot/dependabot-updater-core@sha256:faae3d3a1dedd24cde388bb506bbacc0f7ed1eae99ebac129af66acd8540c84a
deleted: sha256:afc745c7535da1bb12f92c273b9a7e9c52c3f12c5873714b2542da259c6d9769
deleted: sha256:64e147d5e54d9be8b8aa322e511cda02296eda4b8b8d063c6a314833aca50e29
deleted: sha256:5cba409bb463f4e7fa1a19f695450170422582c1bc7c0e934d893b4e5f558bc6
deleted: sha256:cddc6ebd344b0111eaab170ead1dfda24acdfe865ed8a12599a34d338fa8e28b
deleted: sha256:2412c3f334d79134573cd45e657fb6cc0abd75bef3881458b0d498d936545c8d
---
[RUSTC-TIMING] wasm_encoder test:false 1.387
   Compiling sharded-slab v0.1.7
[RUSTC-TIMING] build_script_build test:false 0.286

thread 'rustc' (5565) panicked at /rustc-dev/9b1f8ff42d110b0ca138116745be921df5dc97e7/compiler/rustc_errors/src/lib.rs:727:17:
`trimmed_def_paths` called, diagnostics were expected but none were emitted. Use `with_no_trimmed_paths` for debugging. This happened in the following `must_produce_diag` call's backtrace:
   0: std::backtrace_rs::backtrace::libunwind::trace
             at /rustc/9b1f8ff42d110b0ca138116745be921df5dc97e7/library/std/src/../../backtrace/src/backtrace/libunwind.rs:117:9
   1: std::backtrace_rs::backtrace::trace_unsynchronized
             at /rustc/9b1f8ff42d110b0ca138116745be921df5dc97e7/library/std/src/../../backtrace/src/backtrace/mod.rs:66:14
   2: std::backtrace::Backtrace::create
             at /rustc/9b1f8ff42d110b0ca138116745be921df5dc97e7/library/std/src/backtrace.rs:331:13
   3: <rustc_errors::DiagCtxtHandle>::set_must_produce_diag
   4: <rustc_session::session::Session>::record_trimmed_def_paths
   5: rustc_middle::ty::print::pretty::trimmed_def_paths
   6: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::trimmed_def_paths::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
   7: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 8]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
   8: rustc_query_impl::query_impl::trimmed_def_paths::get_query_non_incr::__rust_end_short_backtrace
   9: <rustc_middle::ty::print::pretty::FmtPrinter as rustc_middle::ty::print::Printer>::print_def_path
  10: <rustc_middle::ty::print::pretty::FmtPrinter as rustc_middle::ty::print::Printer>::print_path_with_generic_args::<<rustc_middle::ty::print::pretty::FmtPrinter as rustc_middle::ty::print::Printer>::default_print_def_path::{closure#0}>
  11: <rustc_middle::ty::print::pretty::FmtPrinter as rustc_middle::ty::print::Printer>::print_def_path
  12: <rustc_middle::ty::context::TyCtxt>::def_path_str_with_args::<rustc_span::def_id::DefId>
  13: <rustc_lint::pass_by_value::PassByValue as rustc_lint::passes::LateLintPass>::check_ty
  14: <rustc_lint::late::LateContextAndPass<rustc_lint::late::RuntimeCombinedLateLintPass> as rustc_hir::intravisit::Visitor>::visit_ty
  15: <rustc_lint::late::LateContextAndPass<rustc_lint::late::RuntimeCombinedLateLintPass> as rustc_hir::intravisit::Visitor>::visit_fn_decl
  16: <rustc_lint::late::LateContextAndPass<rustc_lint::late::RuntimeCombinedLateLintPass> as rustc_hir::intravisit::Visitor>::visit_fn
  17: <rustc_lint::late::LateContextAndPass<rustc_lint::late::RuntimeCombinedLateLintPass> as rustc_hir::intravisit::Visitor>::visit_nested_item
  18: rustc_lint::lint_mod
  19: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::lint_mod::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 0]>>
  20: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::DefaultCache<rustc_span::def_id::LocalModDefId, rustc_middle::query::erase::Erased<[u8; 0]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
  21: rustc_query_impl::query_impl::lint_mod::get_query_non_incr::__rust_end_short_backtrace
  22: rustc_lint::late::check_crate::{closure#1}
  23: rustc_lint::late::check_crate
  24: rustc_interface::passes::analysis
  25: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 0]>>
  26: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 0]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
  27: rustc_query_impl::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  28: <rustc_interface::passes::create_and_enter_global_ctxt<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>::{closure#2} as core::ops::function::FnOnce<(&rustc_session::session::Session, rustc_middle::ty::context::CurrentGcx, alloc::sync::Arc<rustc_data_structures::jobserver::Proxy>, &std::sync::once_lock::OnceLock<rustc_middle::ty::context::GlobalCtxt>, &rustc_data_structures::sync::worker_local::WorkerLocal<rustc_middle::arena::Arena>, &rustc_data_structures::sync::worker_local::WorkerLocal<rustc_hir::Arena>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2})>>::call_once::{shim:vtable#0}
  29: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
  30: std::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  31: <std::thread::lifecycle::spawn_unchecked<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  32: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
             at /rustc/9b1f8ff42d110b0ca138116745be921df5dc97e7/library/alloc/src/boxed.rs:2206:9
  33: std::sys::thread::unix::Thread::new::thread_start
             at /rustc/9b1f8ff42d110b0ca138116745be921df5dc97e7/library/std/src/sys/thread/unix.rs:127:17
  34: <unknown>
  35: <unknown>
---
warning: the ICE couldn't be written to `/checkout/rustc-ice-2026-02-16T12_40_43-5563.txt`: Read-only file system (os error 30)

note: rustc 1.94.0-beta.1 (9b1f8ff42 2026-01-19) running on aarch64-unknown-linux-gnu

note: compiler flags: --crate-type rlib -C opt-level=3 -C embed-bitcode=no -C debug-assertions=on -C symbol-mangling-version=v0 -Z randomize-layout -Z unstable-options -Z macro-backtrace -C split-debuginfo=off -C llvm-args=-import-instr-limit=10 -C link-args=-Wl,-z,origin -C link-args=-Wl,-rpath,$ORIGIN/../lib -Z on-broken-pipe=kill -Z binary-dep-depinfo -Z tls-model=initial-exec -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] rustc_type_ir test:false 3.229
error: could not compile `rustc_type_ir` (lib)

Caused by:
  process didn't exit successfully: `sccache /checkout/obj/build/bootstrap/debug/rustc --crate-name rustc_type_ir --edition=2024 compiler/rustc_type_ir/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C embed-bitcode=no -C debug-assertions=on --cfg 'feature="default"' --cfg 'feature="nightly"' --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values("default", "nightly"))' -C metadata=a9057acafd1aec44 -C extra-filename=-6bebfacdeb3ad0fe --out-dir /checkout/obj/build/aarch64-unknown-linux-gnu/stage1-rustc/aarch64-unknown-linux-gnu/release/deps --target aarch64-unknown-linux-gnu -L dependency=/checkout/obj/build/aarch64-unknown-linux-gnu/stage1-rustc/aarch64-unknown-linux-gnu/release/deps -L dependency=/checkout/obj/build/aarch64-unknown-linux-gnu/stage1-rustc/release/deps --extern arrayvec=/checkout/obj/build/aarch64-unknown-linux-gnu/stage1-rustc/aarch64-unknown-linux-gnu/release/deps/libarrayvec-3d0f7fe10d0b214c.rmeta --extern bitflags=/checkout/obj/build/aarch64-unknown-linux-gnu/stage1-rustc/aarch64-unknown-linux-gnu/release/deps/libbitflags-30dea2d0b3bcd7ea.rmeta --extern derive_where=/checkout/obj/build/aarch64-unknown-linux-gnu/stage1-rustc/release/deps/libderive_where-c361bb38b14c956f.so --extern ena=/checkout/obj/build/aarch64-unknown-linux-gnu/stage1-rustc/aarch64-unknown-linux-gnu/release/deps/libena-d236f08e6e997f1b.rmeta --extern indexmap=/checkout/obj/build/aarch64-unknown-linux-gnu/stage1-rustc/aarch64-unknown-linux-gnu/release/deps/libindexmap-f3bb351c2e9bc00b.rmeta --extern rustc_hash=/checkout/obj/build/aarch64-unknown-linux-gnu/stage1-rustc/aarch64-unknown-linux-gnu/release/deps/librustc_hash-a03afac0670b7bab.rmeta --extern rustc_ast_ir=/checkout/obj/build/aarch64-unknown-linux-gnu/stage1-rustc/aarch64-unknown-linux-gnu/release/deps/librustc_ast_ir-677b138632f11698.rmeta --extern rustc_data_structures=/checkout/obj/build/aarch64-unknown-linux-gnu/stage1-rustc/aarch64-unknown-linux-gnu/release/deps/librustc_data_structures-84856ed35c80ec3a.rmeta --extern rustc_error_messages=/checkout/obj/build/aarch64-unknown-linux-gnu/stage1-rustc/aarch64-unknown-linux-gnu/release/deps/librustc_error_messages-6cc676e2e60362dd.rmeta --extern rustc_index=/checkout/obj/build/aarch64-unknown-linux-gnu/stage1-rustc/aarch64-unknown-linux-gnu/release/deps/librustc_index-553e5b34c7d8c0a6.rmeta --extern rustc_macros=/checkout/obj/build/aarch64-unknown-linux-gnu/stage1-rustc/release/deps/librustc_macros-fa82ecfe10284854.so --extern rustc_serialize=/checkout/obj/build/aarch64-unknown-linux-gnu/stage1-rustc/aarch64-unknown-linux-gnu/release/deps/librustc_serialize-a4536806296d7dc0.rmeta --extern rustc_span=/checkout/obj/build/aarch64-unknown-linux-gnu/stage1-rustc/aarch64-unknown-linux-gnu/release/deps/librustc_span-3b6da4e10d4cd7aa.rmeta --extern rustc_type_ir_macros=/checkout/obj/build/aarch64-unknown-linux-gnu/stage1-rustc/release/deps/librustc_type_ir_macros-ecd4a1d76da57e15.so --extern smallvec=/checkout/obj/build/aarch64-unknown-linux-gnu/stage1-rustc/aarch64-unknown-linux-gnu/release/deps/libsmallvec-dd7a478ff89ac833.rmeta --extern thin_vec=/checkout/obj/build/aarch64-unknown-linux-gnu/stage1-rustc/aarch64-unknown-linux-gnu/release/deps/libthin_vec-8fdee658b0b6dd2b.rmeta --extern tracing=/checkout/obj/build/aarch64-unknown-linux-gnu/stage1-rustc/aarch64-unknown-linux-gnu/release/deps/libtracing-8c124fb8e5051faf.rmeta --cfg=windows_raw_dylib -Csymbol-mangling-version=v0 -Zrandomize-layout -Zunstable-options '--check-cfg=cfg(bootstrap)' -Zmacro-backtrace -Csplit-debuginfo=off -Cllvm-args=-import-instr-limit=10 -Clink-args=-Wl,-z,origin '-Clink-args=-Wl,-rpath,$ORIGIN/../lib' -Zon-broken-pipe=kill --cfg=bootstrap -Z binary-dep-depinfo -L native=/checkout/obj/build/aarch64-unknown-linux-gnu/stage1-rustc/aarch64-unknown-linux-gnu/release/build/psm-8937a87a3448e391/out -L native=/checkout/obj/build/aarch64-unknown-linux-gnu/stage1-rustc/aarch64-unknown-linux-gnu/release/build/blake3-a997a58ac085302d/out` (exit status: 101)
warning: build failed, waiting for other jobs to finish...
[RUSTC-TIMING] thorin test:false 1.849
[RUSTC-TIMING] sharded_slab test:false 0.444
Bootstrap failed while executing `--stage 2 test --skip compiler --skip src`
Build completed unsuccessfully in 0:00:29

@lcnr lcnr self-assigned this Feb 16, 2026
write!(p, ")")?;
if let Some(ty) = return_ty.skip_binder().as_type() {
if !ty.is_unit() {
if !matches!(ty.kind(), ty::Tuple(tys) if tys.is_empty()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

why?

where
F: FnOnce(&mut Self) -> R;
pub trait TyEncoder<'tcx>: ir_codec::TyEncoder<'tcx, Interner = TyCtxt<'tcx>> {}
impl<'tcx, T> TyEncoder<'tcx> for T where T: ir_codec::TyEncoder<'tcx, Interner = TyCtxt<'tcx>> {}
Copy link
Contributor

Choose a reason for hiding this comment

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

why does this trait have to be moved? This is surprising to me

Might be good to write in the PR description what you're moving and why.

As in, sth like

  • moving Ty
  • also uses other types X which now need to be moved
  • has function which relies on tcx, add method fn XXX to trait Interner

/// `Decodable` can still be implemented in cases where `Decodable` is required
/// by a trait bound.
pub trait RefDecodable<'tcx, D: TyDecoder<'tcx>>: PointeeSized {
pub trait RefDecodable<'tcx, D: TyDecoder<'tcx>>: std::marker::PointeeSized {
Copy link
Contributor

Choose a reason for hiding this comment

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

?

feature = "nightly",
derive(Encodable_NoContext, Decodable_NoContext, HashStable_NoContext)
)]
#[cfg_attr(feature = "nightly", derive(HashStable_NoContext))]
Copy link
Contributor

Choose a reason for hiding this comment

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

?

#[rustc_diagnostic_item = "Ty"]
#[rustc_pass_by_value]
#[rustc_has_incoherent_inherent_impls]
pub struct Ty<I: Interner>(pub I::Interned<WithCachedTypeInfo<TyKind<I>>>);
Copy link
Contributor

Choose a reason for hiding this comment

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

should be in a mod ty or mod sty to mirror rustc_middle

#[cfg_attr(feature = "nightly", derive(HashStable_NoContext))]
#[rustc_diagnostic_item = "Ty"]
#[rustc_pass_by_value]
#[rustc_has_incoherent_inherent_impls]
Copy link
Contributor

Choose a reason for hiding this comment

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

dubious :3 i guess that's a way to simply the migration. Removing this before merge/add a TODO rn

#[inline]
pub fn interned(self) -> I::Interned<WithCachedTypeInfo<TyKind<I>>> {
self.0
}
Copy link
Contributor

Choose a reason for hiding this comment

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

where is this used?

}

#[inline]
#[allow(rustc::pass_by_value)]
Copy link
Contributor

Choose a reason for hiding this comment

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

why by ref?


impl<I: Interner> TypeSuperVisitable<I> for Ty<I>
where
I::Interned<WithCachedTypeInfo<TyKind<I>>>: Deref<Target = WithCachedTypeInfo<TyKind<I>>>,
Copy link
Contributor

Choose a reason for hiding this comment

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

should be item bound of I::Interned, same with all other where-bounds here

I::Region: TypeFoldable<I> + TypeVisitable<I>,
I::Term: From<Ty<I>>,
I::Tys: TypeFoldable<I> + TypeVisitable<I>,
I::Interned<WithCachedTypeInfo<TyKind<I>>>:
Copy link
Contributor

Choose a reason for hiding this comment

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

all item bounds of Interned

/// This offset is also chosen so that the first byte is never < 0x80.
pub const SHORTHAND_OFFSET: usize = 0x80;

pub trait TyEncoder<'tcx>: SpanEncoder {
Copy link
Contributor

Choose a reason for hiding this comment

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

this feels rustc specific and is not used by r-a afaik, so I'd prefer keeping this in rustc_middle for now

}

pub trait Interned<T>: Clone + Copy + Hash + PartialEq + Eq + Debug {
fn new_unchecked(t: &T) -> Self;
Copy link
Contributor

Choose a reason for hiding this comment

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

🤔 where is that used, surprising that we'd ever want to use this in rustc_next_trait_solver

+ Hash
+ Eq
+ PartialEq
+ Deref<Target = T>;
Copy link
Contributor

Choose a reason for hiding this comment

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

should be a super trait bounds of a single Interned trait

#![cfg_attr(feature = "nightly", rustc_diagnostic_item = "type_ir")]
// tidy-alphabetical-start
#![allow(rustc::direct_use_of_rustc_type_ir)]
#![allow(rustc::pass_by_value)]
Copy link
Contributor

Choose a reason for hiding this comment

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

please don't

Copy link
Contributor

@lcnr lcnr left a comment

Choose a reason for hiding this comment

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

changes to rustc_next_trait_solver look as expected

don't need to change rust-analyzer for now as they don't directly depend on rustc. We need ot change it to test that it's correct, but I'd wait on actually getting rustc to work for this

View changes since this review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rust-analyzer Relevant to the rust-analyzer team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants