rust/compiler
bors aa95b9648a Auto merge of #138464 - compiler-errors:less-type-ir, r=lcnr
Use `rustc_type_ir` directly less in the codebase

cc https://github.com/rust-lang/rust/issues/138449

This is a somewhat opinionated bundle of changes that will make working on https://github.com/rust-lang/rust/issues/138449 more easy, since it cuts out the bulk of the changes that would be necessitated by the lint. Namely:

1. Fold `rustc_middle::ty::fold` and `rustc_middle::ty::visit` into `rustc_middle::ty`. This is because we already reexport some parts of these modules into `rustc_middle::ty`, and there's really no benefit from namespacing away the rest of these modules's functionality given how important folding and visiting is to the type layer.
2. Rename `{Decodable,Encodable}_Generic` to `{Decodable,Encodable}_NoContext`[^why], change it to be "perfect derive" (`synstructure::AddBounds::Fields`), use it throughout `rustc_type_ir` instead of `TyEncodable`/`TyDecodable`.
3. Make `TyEncodable` and `TyDecodable` derives use `::rustc_middle::ty::codec::TyEncoder` (etc) for its generated paths, and move the `rustc_type_ir::codec` module back to `rustc_middle::ty::codec` 🎉.
4. Stop using `rustc_type_ir` in crates that aren't "fundamental" to the type system, namely middle/infer/trait-selection. This amounted mostly to changing imports from `use rustc_type_ir::...` to `use rustc_middle::ty::...`, but also this means that we can't glob import `TyKind::*` since the reexport into `rustc_middle::ty::TyKind` is a type alias. Instead, use the prefixed variants like `ty::Str` everywhere -- IMO this is a good change, since it makes it more regularized with most of the rest of the compiler.

[^why]: `_NoContext` is the name for derive macros with no additional generic bounds and which do "perfect derive" by generating bounds based on field types. See `HashStable_NoContext`.

I'm happy to cut out some of these changes into separate PRs to make landing it a bit easier, though I don't expect to have much trouble with bitrot.

r? lcnr
2025-03-15 08:36:38 +00:00
..
rustc Revert "Use workspace lints for crates in compiler/ #138084" 2025-03-10 18:12:47 +08:00
rustc_abi Use {Decodable,Encodable}_NoContext in type_ir 2025-03-15 06:34:36 +00:00
rustc_arena Remove #![warn(unreachable_pub)] from all compiler/ crates. 2025-03-11 13:14:21 +11:00
rustc_ast Auto merge of #138414 - matthiaskrgr:rollup-9ablqdb, r=matthiaskrgr 2025-03-12 17:27:43 +00:00
rustc_ast_ir Use {Decodable,Encodable}_NoContext in type_ir 2025-03-15 06:34:36 +00:00
rustc_ast_lowering Rollup merge of #138482 - nnethercote:fix-hir-printing, r=compiler-errors 2025-03-15 00:18:25 +01:00
rustc_ast_passes Rollup merge of #138331 - nnethercote:use-RUSTC_LINT_FLAGS-more, r=onur-ozkan,jieyouxu 2025-03-12 10:19:30 -07:00
rustc_ast_pretty Rollup merge of #138331 - nnethercote:use-RUSTC_LINT_FLAGS-more, r=onur-ozkan,jieyouxu 2025-03-12 10:19:30 -07:00
rustc_attr_data_structures Rollup merge of #138331 - nnethercote:use-RUSTC_LINT_FLAGS-more, r=onur-ozkan,jieyouxu 2025-03-12 10:19:30 -07:00
rustc_attr_parsing Auto merge of #138414 - matthiaskrgr:rollup-9ablqdb, r=matthiaskrgr 2025-03-12 17:27:43 +00:00
rustc_baked_icu_data Add unreachable_pub to RUSTC_LINT_FLAGS for compiler/ crates. 2025-03-11 13:14:21 +11:00
rustc_borrowck Fold visit into ty 2025-03-15 06:34:36 +00:00
rustc_builtin_macros Auto merge of #138414 - matthiaskrgr:rollup-9ablqdb, r=matthiaskrgr 2025-03-12 17:27:43 +00:00
rustc_codegen_cranelift atomic intrinsics: clarify which types are supported and (if applicable) what happens with provenance 2025-03-13 08:14:34 +01:00
rustc_codegen_gcc intrinsics: remove unnecessary leading underscore from argument names 2025-03-12 08:04:09 +01:00
rustc_codegen_llvm Rollup merge of #138331 - nnethercote:use-RUSTC_LINT_FLAGS-more, r=onur-ozkan,jieyouxu 2025-03-12 10:19:30 -07:00
rustc_codegen_ssa Stop relying on rustc_type_ir in non-type-system crates 2025-03-15 06:42:48 +00:00
rustc_const_eval Stop relying on rustc_type_ir in non-type-system crates 2025-03-15 06:42:48 +00:00
rustc_data_structures Use {Decodable,Encodable}_NoContext in type_ir 2025-03-15 06:34:36 +00:00
rustc_driver Revert "Use workspace lints for crates in compiler/ #138084" 2025-03-10 18:12:47 +08:00
rustc_driver_impl Auto merge of #138416 - Manishearth:rollup-fejor9p, r=Manishearth 2025-03-13 01:37:26 +00:00
rustc_error_codes Rollup merge of #138331 - nnethercote:use-RUSTC_LINT_FLAGS-more, r=onur-ozkan,jieyouxu 2025-03-12 10:19:30 -07:00
rustc_error_messages Rollup merge of #138404 - bjorn3:sysroot_handling_cleanup, r=petrochenkov,jieyouxu 2025-03-13 11:28:35 +01:00
rustc_errors Do not suggest using -Zmacro-backtrace for builtin macros 2025-03-14 19:50:03 +00:00
rustc_expand Do not suggest using -Zmacro-backtrace for builtin macros 2025-03-14 19:50:03 +00:00
rustc_feature Rollup merge of #138331 - nnethercote:use-RUSTC_LINT_FLAGS-more, r=onur-ozkan,jieyouxu 2025-03-12 10:19:30 -07:00
rustc_fluent_macro Remove #![warn(unreachable_pub)] from all compiler/ crates. 2025-03-11 13:14:21 +11:00
rustc_fs_util Revert "Use workspace lints for crates in compiler/ #138084" 2025-03-10 18:12:47 +08:00
rustc_graphviz Remove #![warn(unreachable_pub)] from all compiler/ crates. 2025-03-11 13:14:21 +11:00
rustc_hashes Revert "Use workspace lints for crates in compiler/ #138084" 2025-03-10 18:12:47 +08:00
rustc_hir Rollup merge of #138109 - Kohei316:feat/rust-doc-precise-capturing-arg, r=aDotInTheVoid,compiler-errors 2025-03-13 11:28:26 +01:00
rustc_hir_analysis Stop relying on rustc_type_ir in non-type-system crates 2025-03-15 06:42:48 +00:00
rustc_hir_pretty Fix HIR param pretty printing some more. 2025-03-14 09:45:41 +11:00
rustc_hir_typeck Stop relying on rustc_type_ir in non-type-system crates 2025-03-15 06:42:48 +00:00
rustc_incremental Auto merge of #138416 - Manishearth:rollup-fejor9p, r=Manishearth 2025-03-13 01:37:26 +00:00
rustc_index Use {Decodable,Encodable}_NoContext in type_ir 2025-03-15 06:34:36 +00:00
rustc_index_macros Add unreachable_pub to RUSTC_LINT_FLAGS for compiler/ crates. 2025-03-11 13:14:21 +11:00
rustc_infer Fold visit into ty 2025-03-15 06:34:36 +00:00
rustc_interface Rollup merge of #138404 - bjorn3:sysroot_handling_cleanup, r=petrochenkov,jieyouxu 2025-03-13 11:28:35 +01:00
rustc_lexer Remove #![warn(unreachable_pub)] from all compiler/ crates. 2025-03-11 13:14:21 +11:00
rustc_lint Stop relying on rustc_type_ir in non-type-system crates 2025-03-15 06:42:48 +00:00
rustc_lint_defs Remove #![warn(unreachable_pub)] from all compiler/ crates. 2025-03-11 13:14:21 +11:00
rustc_llvm Rollup merge of #138420 - zmodem:cfifunctionindex_fix, r=durin42 2025-03-13 17:44:09 +01:00
rustc_log Revert "Use workspace lints for crates in compiler/ #138084" 2025-03-10 18:12:47 +08:00
rustc_macros Move codec module back into middle 2025-03-15 06:42:48 +00:00
rustc_metadata Stop relying on rustc_type_ir in non-type-system crates 2025-03-15 06:42:48 +00:00
rustc_middle Move codec module back into middle 2025-03-15 06:42:48 +00:00
rustc_mir_build Delegation: allow foreign fns reuse 2025-03-13 14:13:07 +03:00
rustc_mir_dataflow Auto merge of #138414 - matthiaskrgr:rollup-9ablqdb, r=matthiaskrgr 2025-03-12 17:27:43 +00:00
rustc_mir_transform Stop relying on rustc_type_ir in non-type-system crates 2025-03-15 06:42:48 +00:00
rustc_monomorphize Auto merge of #138414 - matthiaskrgr:rollup-9ablqdb, r=matthiaskrgr 2025-03-12 17:27:43 +00:00
rustc_next_trait_solver Use {Decodable,Encodable}_NoContext in type_ir 2025-03-15 06:34:36 +00:00
rustc_parse Rollup merge of #138511 - mohe2015:rustc-parse-pub-parse-expr-cond, r=oli-obk 2025-03-15 00:18:26 +01:00
rustc_parse_format Rollup merge of #138331 - nnethercote:use-RUSTC_LINT_FLAGS-more, r=onur-ozkan,jieyouxu 2025-03-12 10:19:30 -07:00
rustc_passes Auto merge of #138416 - Manishearth:rollup-fejor9p, r=Manishearth 2025-03-13 01:37:26 +00:00
rustc_pattern_analysis Remove #![warn(unreachable_pub)] from all compiler/ crates. 2025-03-11 13:14:21 +11:00
rustc_privacy Auto merge of #138416 - Manishearth:rollup-fejor9p, r=Manishearth 2025-03-13 01:37:26 +00:00
rustc_query_impl Move codec module back into middle 2025-03-15 06:42:48 +00:00
rustc_query_system Rollup merge of #138331 - nnethercote:use-RUSTC_LINT_FLAGS-more, r=onur-ozkan,jieyouxu 2025-03-12 17:59:08 +01:00
rustc_resolve Delegation: allow foreign fns reuse 2025-03-13 14:13:07 +03:00
rustc_sanitizers Squash fold into ty 2025-03-15 06:34:36 +00:00
rustc_serialize Use {Decodable,Encodable}_NoContext in type_ir 2025-03-15 06:34:36 +00:00
rustc_session Show valid crate types when the user passes unknown --crate-type value 2025-03-14 15:53:42 +08:00
rustc_smir Auto merge of #138416 - Manishearth:rollup-fejor9p, r=Manishearth 2025-03-13 01:37:26 +00:00
rustc_span Do not suggest using -Zmacro-backtrace for builtin macros 2025-03-14 19:50:03 +00:00
rustc_symbol_mangling Auto merge of #138414 - matthiaskrgr:rollup-9ablqdb, r=matthiaskrgr 2025-03-12 17:27:43 +00:00
rustc_target Rollup merge of #138056 - heiher:loong64v1.1-features, r=petrochenkov 2025-03-15 00:18:22 +01:00
rustc_trait_selection Fold visit into ty 2025-03-15 06:34:36 +00:00
rustc_traits Rollup merge of #138394 - lcnr:yeet-variant, r=compiler-errors 2025-03-12 10:19:32 -07:00
rustc_transmute Auto merge of #138414 - matthiaskrgr:rollup-9ablqdb, r=matthiaskrgr 2025-03-12 17:27:43 +00:00
rustc_ty_utils Stop relying on rustc_type_ir in non-type-system crates 2025-03-15 06:42:48 +00:00
rustc_type_ir Move codec module back into middle 2025-03-15 06:42:48 +00:00
rustc_type_ir_macros Fold visit into ty 2025-03-15 06:34:36 +00:00
stable_mir Revert "Use workspace lints for crates in compiler/ #138084" 2025-03-10 18:12:47 +08:00