about summary refs log tree commit diff
path: root/compiler/rustc_middle/src/ty/adt.rs
AgeCommit message (Collapse)AuthorLines
2023-12-02Rename `HandlerInner::delay_span_bug` as `HandlerInner::span_delayed_bug`.Nicholas Nethercote-1/+1
Because the corresponding `Level` is `DelayedBug` and `span_delayed_bug` follows the pattern used everywhere else: `span_err`, `span_warning`, etc.
2023-11-21Fix `clippy::needless_borrow` in the compilerNilstrieb-2/+2
`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-09-26Don't store lazyness in DefKindMichael Goulet-1/+1
2023-09-14move required_consts check to general post-mono-check functionRalf Jung-2/+2
2023-08-07Store the laziness of type aliases in the DefKindLeón Orell Valerian Liehr-1/+1
2023-08-01Fix a commentMichael Goulet-10/+2
2023-08-01Convert adt_sized_constraint to early-binder, use listMichael Goulet-2/+2
2023-05-29EarlyBinder::new -> EarlyBinder::bindlcnr-1/+1
2023-05-28Replace EarlyBinder(x) with EarlyBinder::new(x)Kyle Matsuda-1/+1
2023-05-19Add extra debug assertions for equality for Adt/Variant/FieldDefMichael Goulet-3/+21
2023-05-07Use smaller ints for bitflagsNilstrieb-1/+1
2023-04-28Remove some unnecessary derives.Nicholas Nethercote-1/+1
I was curious about how many `Encodable`/`Decodable` derives we have. Some grepping revealed that it's over 500 of each, but the number of `Encodable` ones was higher, which was weird. Most of the `Encodable`-only ones were in `hir.rs`. This commit removes them all, plus some other unnecessary derives in that file and others that I found via trial and error.
2023-04-24Split `{Idx, IndexVec, IndexSlice}` into their own modulesMaybe Waffle-1/+1
2023-04-02Use `&IndexSlice` instead of `&IndexVec` where possibleScott McMurray-2/+2
All the same reasons as for `[T]`: more general, less pointer chasing, and `&mut IndexSlice` emphasizes that it doesn't change *length*.
2023-03-25Refactor: `VariantIdx::from_u32(0)` -> `FIRST_VARIANT`Scott McMurray-5/+5
Since structs are always `VariantIdx(0)`, there's a bunch of files where the only reason they had `VariantIdx` or `vec::Idx` imported at all was to get the first variant. So this uses a constant for that, and adds some doc-comments to `VariantIdx` while I'm there, since it doesn't have any today.
2023-02-24Rename many interner functions.Nicholas Nethercote-1/+1
(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-02-12Enable CopyProp by default, tune the impl a bitBen Kimock-0/+1
2023-01-27Impl HashStable/Encodable/Decodable for ObligationCause.Camille GILLOT-1/+1
2022-11-24move some layout logic to rustc_target::abi::layouthkalbasi-4/+2
2022-11-21Unreserve braced enum variants in value namespaceVadim Petrochenkov-8/+6
2022-11-16cleanup and dedupe CTFE and Miri error reportingRalf Jung-3/+1
2022-10-12Rollup merge of #102890 - camsteffen:adt-sized-representability, r=cjgillotDylan DPC-4/+1
Check representability in adt_sized_constraint Now that representability is a query, we can use it to preemptively avoid a cycle in `adt_sized_constraint`. I moved the representability check into `check_mod_type_wf` to avoid a scenario where rustc quits before checking all the types for representability. This also removes the check from rustdoc, which is alright AFAIK. r? ``@cjgillot``
2022-10-10Check representability in adt_sized_constraintCameron Steffen-4/+1
2022-10-10Fix compiler docsGuillaume Gomez-2/+2
2022-10-07Rewrite representabilityCameron Steffen-0/+7
2022-10-03Add diagnostic struct for const eval error in `rustc_middle`pierwill-5/+3
Co-authored-by: Michael Goulet <michael@errs.io>
2022-09-29Shrink `hir::def::Res`.Nicholas Nethercote-1/+2
`Res::SelfTy` currently has two `Option`s. When the second one is `Some` the first one is never consulted. So we can split it into two variants, `Res::SelfTyParam` and `Res::SelfTyAlias`, reducing the size of `Res` from 24 bytes to 12. This then shrinks `hir::Path` and `hir::PathSegment`, which are the HIR types that take up the most space.
2022-08-03Change sized_constraints to return EarlyBinderJack Huey-2/+2
2022-07-13Rollup merge of #99011 - oli-obk:UnsoundCell, r=eddybDylan DPC-0/+11
`UnsafeCell` blocks niches inside its nested type from being available outside fixes #87341 This implements the plan by `@eddyb` in https://github.com/rust-lang/rust/issues/87341#issuecomment-886083646 Somewhat related PR (not strictly necessary, but that cleanup made this PR simpler): #94527
2022-07-07Miscellaneous inlining improvementsTomasz Miąsko-0/+5
Add `#[inline]` to a few trivial non-generic methods from a perf report that otherwise wouldn't be candidates for inlining.
2022-07-07`UnsafeCell` now has no niches, ever.Oli Scherer-0/+11
2022-05-10only_local: always check for misuselcnr-2/+1
2022-05-02fix most compiler/ doctestsElliot Roberts-1/+1
2022-04-05trivial cfg(bootstrap) changesPietro Albini-1/+1
2022-03-16rustc_error: make ErrorReported impossible to constructmark-2/+1
There are a few places were we have to construct it, though, and a few places that are more invasive to change. To do this, we create a constructor with a long obvious name.
2022-03-11Improve `AdtDef` interning.Nicholas Nethercote-73/+102
This commit makes `AdtDef` use `Interned`. Much the commit is tedious changes to introduce getter functions. The interesting changes are in `compiler/rustc_middle/src/ty/adt.rs`.
2022-03-02rename ErrorReported -> ErrorGuaranteedmark-2/+2
2022-02-12change to a struct variantEllen-1/+1
2022-02-09Ensure that queries only return Copy types.Camille GILLOT-1/+1
2022-01-05Ensure that `Fingerprint` caching respects hashing configurationAaron Hill-2/+4
Fixes #92266 In some `HashStable` impls, we use a cache to avoid re-computing the same `Fingerprint` from the same structure (e.g. an `AdtDef`). However, the `StableHashingContext` used can be configured to perform hashing in different ways (e.g. skipping `Span`s). This configuration information is not included in the cache key, which will cause an incorrect `Fingerprint` to be used if we hash the same structure with different `StableHashingContext` settings. To fix this, the configuration settings of `StableHashingContext` are split out into a separate `HashingControls` struct. This struct is used as part of the cache key, ensuring that our caches always produce the correct result for the given settings. With this in place, we now turn off `Span` hashing during the entire process of computing the hash included in legacy symbols. This current has no effect, but will matter when a future PR starts hashing more `Span`s that we currently skip.
2021-12-15Fully serialize AdtDefAaron Hill-13/+10
This avoids needing to invoke the `adt_def` query during the decoding of another query's result.
2021-12-04Rollup merge of #90538 - camelid:doc-recur-ty, r=estebankMatthias Krüger-0/+24
Document how recursion is handled for `ty::Ty` Based on this forum discussion: https://internals.rust-lang.org/t/recursive-type-representation-in-rustc/15235/4 cc `@estebank`
2021-12-03Document how recursion is handled for `ty::Ty`Noah Lev-0/+24
Based on this forum discussion: https://internals.rust-lang.org/t/recursive-type-representation-in-rustc/15235/4
2021-12-01Disallow non-c-like but "fieldless" ADTs from being casted to integer...Gary Guo-1/+17
... if they use arbitrary enum discriminant. Code like ```rust enum Enum { Foo = 1, Bar(), Baz{} } ``` seems to be unintentionally allowed so we couldn't disallow them now, but we could disallow them if arbitrary enum discriminant is used before 1.56 hits stable.
2021-10-03Remove re-export.Camille GILLOT-1/+1
2021-09-09Const droppingDeadbeef-0/+5
2021-08-22Fix typos “a”→“an”Frank Steffahn-1/+1
2021-03-10Moved all Adt* types to adt.rsNicholas-Baron-0/+482