summary refs log tree commit diff
path: root/compiler/rustc_middle/src/ty/codec.rs
AgeCommit message (Collapse)AuthorLines
2025-02-13intern valtreesLukas Markeffsky-6/+9
2025-02-11Simplify intra-crate qualifiers.Nicholas Nethercote-3/+2
The following is a weird pattern for a file within `rustc_middle`: ``` use rustc_middle::aaa; use crate::bbb; ``` More sensible and standard would be this: ``` use crate::{aaa, bbb}; ``` I.e. we generally prefer using `crate::` to using a crate's own name. (Exceptions are things like in macros where `crate::` doesn't work because the macro is used in multiple crates.) This commit fixes a bunch of these weird qualifiers.
2024-12-18Re-export more `rustc_span::symbol` things from `rustc_span`.Nicholas Nethercote-1/+1
`rustc_span::symbol` defines some things that are re-exported from `rustc_span`, such as `Symbol` and `sym`. But it doesn't re-export some closely related things such as `Ident` and `kw`. So you can do `use rustc_span::{Symbol, sym}` but you have to do `use rustc_span::symbol::{Ident, kw}`, which is inconsistent for no good reason. This commit re-exports `Ident`, `kw`, and `MacroRulesNormalizedIdent`, and changes many `rustc_span::symbol::` qualifiers in `compiler/` to `rustc_span::`. This is a 200+ net line of code reduction, mostly because many files with two `use rustc_span` items can be reduced to one.
2024-11-23no more Reveal :(lcnr-3/+1
2024-11-12Querify MonoItem collectionBen Kimock-0/+11
2024-11-03compiler: Directly use rustc_abi in metadata and middleJubilee Young-1/+1
Stop reexporting ReprOptions from middle::ty
2024-10-24Implement const effect predicate in new solverMichael Goulet-0/+11
2024-09-10const-eval interning: accpt interior mutable pointers in final value (but ↵Ralf Jung-6/+3
keep rejecting mutable references)
2024-08-28coverage: `CodeRegion` is never stored in an arenaZalathar-1/+0
This might have been left over when coverage regions were stored in individual MIR statements, instead of a separate table attached to the MIR body.
2024-07-29Reformat `use` declarations.Nicholas Nethercote-13/+11
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-06-05Basic removal of `Ty` from places (boring)Boxy-2/+2
2024-05-21Uplift binderMichael Goulet-51/+7
2024-04-08Auto merge of #122077 - oli-obk:eager_opaque_checks4, r=lcnrbors-0/+6
Pass list of defineable opaque types into canonical queries This eliminates `DefiningAnchor::Bubble` for good and brings the old solver closer to the new one wrt cycles and nested obligations. At that point the difference between `DefiningAnchor::Bind([])` and `DefiningAnchor::Error` was academic. We only used the difference for some sanity checks, which actually had to be worked around in places, so I just removed `DefiningAnchor` entirely and just stored the list of opaques that may be defined. fixes #108498 fixes https://github.com/rust-lang/rust/issues/116877 * [x] run crater - https://github.com/rust-lang/rust/pull/122077#issuecomment-2013293931
2024-04-08Eliminate `DefiningAnchor` now that is just a single-variant enumOli Scherer-0/+6
2024-04-08Actually create ranged int types in the type system.Oli Scherer-0/+12
2024-04-04cache type info for ParamEnvLukas Markeffsky-2/+4
2024-04-03Remove MIR unsafe checkMatthew Jasper-1/+0
This also remove safety information from MIR.
2024-03-11Make `DefiningAnchor::Bind` only store the opaque types that may be ↵Oli Scherer-0/+10
constrained, instead of the current infcx root item. This makes `Bind` almost always be empty, so we can start forwarding it to queries, allowing us to remove `Bubble` entirely
2023-12-07ctfe interpreter: extend provenance so that it can track whether a pointer ↵Ralf Jung-0/+17
is immutable
2023-11-21Fix `clippy::needless_borrow` in the compilerNilstrieb-1/+1
`x clippy compiler -Aclippy::all -Wclippy::needless_borrow --fix`. Then I had to remove a few unnecessary parens and muts that were exposed now.
2023-10-31Enums in offset_of: update based on est31, scottmcm & llogiq reviewGeorge Bateman-6/+8
2023-10-31Support enum variants in offset_of!George Bateman-1/+11
2023-10-20Uplift ClauseKind and PredicateKindMichael Goulet-2/+2
2023-10-03Optimize some `alloc_from_iter` call sites.Nicholas Nethercote-6/+8
There's no need to collect an iterator into a `Vec`, or to call `into_iter` at the call sites.
2023-09-23Enable drop_tracking_mir by default.Camille GILLOT-1/+0
2023-07-27Remove `constness` from `ParamEnv`Deadbeef-3/+1
2023-07-14refactor(rustc_middle): Substs -> GenericArgMahdi Dibaiee-4/+4
2023-07-04Replace `mk_const` with `Const::new_x` methodsBoxy-1/+1
2023-06-26Migrate predicates_of and caller_bounds to ClauseMichael Goulet-14/+4
2023-06-22migrate inferred_outlives_of to ClauseMichael Goulet-10/+0
2023-06-22Expect clause moreMichael Goulet-1/+1
2023-06-22Migrate item_bounds to ty::ClauseMichael Goulet-0/+21
2023-06-19s/Clause/ClauseKindMichael Goulet-1/+3
2023-05-29Rename `tcx.mk_re_*` => `Region::new_*`Maybe Waffle-1/+1
2023-05-04Remove unneeded encode/decode methods.Nicholas Nethercote-5/+0
In #110927 the encode/decode methods for `i8`, `char`, `bool`, and `str` were made inherent. This commit removes some unnecessary implementations of these methods that were missed in that PR.
2023-05-04Reorder some `MemDecoder` methods.Nicholas Nethercote-6/+6
So they match the order in the `Decoder` trait.
2023-04-26Remove QueryEngine traitJohn Kåre Alsaker-1/+0
2023-04-26Auto merge of #110634 - saethlin:pointy-decoder, r=cjgillotbors-0/+10
Rewrite MemDecoder around pointers not a slice This is basically https://github.com/rust-lang/rust/pull/109910 but I'm being a lot more aggressive. The pointer-based structure means that it makes a lot more sense to absorb more complexity into `MemDecoder`, most of the diff is just complexity moving from one place to another. The primary argument for this structure is that we only incur a single bounds check when doing multi-byte reads from a `MemDecoder`. With the slice-based implementation we need to do those with `data[position..position + len]` , which needs to account for `position + len` wrapping. It would be possible to dodge the first bounds check if we stored a slice that starts at `position`, but that would require updating the pointer and length on every read. This PR also embeds the failure path in a separate function, which means that this PR should subsume all the perf wins observed in https://github.com/rust-lang/rust/pull/109867.
2023-04-23Rewrite MemDecoder around pointers not a sliceBen Kimock-0/+10
2023-04-21intern offsetof fieldsDrMeepster-0/+11
2023-04-06Remove f32 & f64 from MemDecoder/MemEncoderScott McMurray-2/+0
2023-02-24Add `mk_canonical_var_infos_from_iter`.Nicholas Nethercote-3/+3
It's missing, and is useful in two places.
2023-02-24Rename `mk_{ty,region}` as `mk_{ty,region}_from_kind`.Nicholas Nethercote-2/+2
To discourage accidental use -- there are more specific `mk_*` functions for all `Ty` and `Region` kinds.
2023-02-24Rename many interner functions.Nicholas Nethercote-14/+16
(This is a large commit. The changes to `compiler/rustc_middle/src/ty/context.rs` are the most important ones.) The current naming scheme is a mess, with a mix of `_intern_`, `intern_` and `mk_` prefixes, with little consistency. In particular, in many cases it's easy to use an iterator interner when a (preferable) slice interner is available. The guiding principles of the new naming system: - No `_intern_` prefixes. - The `intern_` prefix is for internal operations. - The `mk_` prefix is for external operations. - For cases where there is a slice interner and an iterator interner, the former is `mk_foo` and the latter is `mk_foo_from_iter`. Also, `slice_interners!` and `direct_interners!` can now be `pub` or non-`pub`, which helps enforce the internal/external operations division. It's not perfect, but I think it's a clear improvement. The following lists show everything that was renamed. slice_interners - const_list - mk_const_list -> mk_const_list_from_iter - intern_const_list -> mk_const_list - substs - mk_substs -> mk_substs_from_iter - intern_substs -> mk_substs - check_substs -> check_and_mk_substs (this is a weird one) - canonical_var_infos - intern_canonical_var_infos -> mk_canonical_var_infos - poly_existential_predicates - mk_poly_existential_predicates -> mk_poly_existential_predicates_from_iter - intern_poly_existential_predicates -> mk_poly_existential_predicates - _intern_poly_existential_predicates -> intern_poly_existential_predicates - predicates - mk_predicates -> mk_predicates_from_iter - intern_predicates -> mk_predicates - _intern_predicates -> intern_predicates - projs - intern_projs -> mk_projs - place_elems - mk_place_elems -> mk_place_elems_from_iter - intern_place_elems -> mk_place_elems - bound_variable_kinds - mk_bound_variable_kinds -> mk_bound_variable_kinds_from_iter - intern_bound_variable_kinds -> mk_bound_variable_kinds direct_interners - region - intern_region (unchanged) - const - mk_const_internal -> intern_const - const_allocation - intern_const_alloc -> mk_const_alloc - layout - intern_layout -> mk_layout - adt_def - intern_adt_def -> mk_adt_def_from_data (unusual case, hard to avoid) - alloc_adt_def(!) -> mk_adt_def - external_constraints - intern_external_constraints -> mk_external_constraints Other - type_list - mk_type_list -> mk_type_list_from_iter - intern_type_list -> mk_type_list - tup - mk_tup -> mk_tup_from_iter - intern_tup -> mk_tup
2023-01-27Impl HashStable/Encodable/Decodable for ObligationCause.Camille GILLOT-2/+31
2022-12-16Rename ConstS to ConstDataOli Scherer-1/+1
2022-11-29Make inferred_outlives_crate return ClauseSantiago Pastorino-0/+8
2022-11-25Add empty ConstKind::Abstractkadmin-19/+8
Initial pass at expr/abstract const/s Address comments Switch to using a list instead of &[ty::Const], rm `AbstractConst` Remove try_unify_abstract_consts Update comments Add edits Recurse more More edits Prevent equating associated consts Move failing test to ui Changes this test from incremental to ui, and mark it as failing and a known bug. Does not cause the compiler to ICE, so should be ok.
2022-11-19drive-by: PolyExistentialPredicateMichael Goulet-2/+2
2022-11-04Refactor tcx mk_const parameters.Mateusz-1/+2