about summary refs log tree commit diff
path: root/compiler/rustc_ty_utils/src/layout.rs
AgeCommit message (Collapse)AuthorLines
2023-04-08Move SIMD layout errors to `SessionDiagnostic`Matthew Jasper-20/+19
2023-04-04Use `FieldIdx` in `FieldsShape`Scott McMurray-47/+40
Finally got to the main motivating example from the MCP :)
2023-03-30Update `ty::VariantDef` to use `IndexVec<FieldIdx, FieldDef>`Scott McMurray-2/+3
And while doing the updates for that, also uses `FieldIdx` in `ProjectionKind::Field` and `TypeckResults::field_indices`. There's more places that could use it (like `rustc_const_eval` and `LayoutS`), but I tried to keep this PR from exploding to *even more* places. Part 2/? of https://github.com/rust-lang/compiler-team/issues/606
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-03-13Layout of `&dyn Trait<[type error]>` is still wideMichael Goulet-1/+5
2023-02-24Rename many interner functions.Nicholas Nethercote-20/+20
(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-22Remove type-traversal trait aliasesAlan Egerton-1/+1
2023-02-18make first component of dyn* use pointer layout+type, and adjust DynStar commentRalf Jung-1/+1
2023-02-16remove bound_type_of query; make type_of return EarlyBinder; change type_of ↵Kyle Matsuda-1/+1
in metadata
2023-02-16change usages of type_of to bound_type_ofKyle Matsuda-3/+4
2023-02-15Rollup merge of #107163 - mikebenfield:parameters-pr, r=TaKO8KiDylan DPC-11/+11
Remove some superfluous type parameters from layout.rs. Specifically remove V, which can always be VariantIdx, and F, which can always be Layout.
2023-02-14s/eval_usize/eval_target_usize/ for clarityOli Scherer-1/+2
2023-02-13layout: deal with placeholders, ICE on bound typeslcnr-5/+2
a placeholder type is the same as a param as they represent "this could be any type". A bound type represents a type inside of a `for<T>` or `exists<T>`. When entering a forall or exists `T` should be instantiated as a existential (inference var) or universal (placeholder). You should never observe a bound variable without its binder.
2023-02-05Sort Generator `print-type-sizes` according to their yield pointsArpad Borsos-1/+10
Especially when trying to diagnose runaway future sizes, it might be more intuitive to sort the variants according to the control flow (aka their yield points) rather than the size of the variants.
2023-01-31Extend `-Z print-type-sizes` to distinguish generator upvars and locals from ↵Felix S. Klock II-1/+4
"normal" ADT fields.
2023-01-27Remember where a type was kept in MIR.Camille GILLOT-2/+2
2023-01-27Introduce GeneratorWitnessMIR.Camille GILLOT-1/+4
2023-01-22abi: add `AddressSpace` field to `Primitive::Pointer`Erik Desjardins-4/+4
...and remove it from `PointeeInfo`, which isn't meant for this. There are still various places (marked with FIXMEs) that assume all pointers have the same size and alignment. Fixing this requires parsing non-default address spaces in the data layout string, which will be done in a followup.
2023-01-21Remove some superfluous type parameters from layout.rs.Michael Benfield-11/+11
Specifically remove V, which can always be VariantIdx, and F, which can always be Layout.
2023-01-04layout_of: `T: Thin` implies `sizeof(&T) == sizeof(usize)`Michael Goulet-8/+28
2022-12-20rustc: Remove needless lifetimesJeremy Stucki-2/+2
2022-12-15Rollup merge of #105623 - compiler-errors:generator-type-size-fix, r=NilstriebMatthias Krüger-7/+23
Fix `-Z print-type-sizes` for generators with discriminant field ordered first Fixes #105589 Fixes #105591
2022-12-14Consider discriminant fields that are ordered before variant fieldsMichael Goulet-7/+23
2022-12-13Combine identical alias armsMichael Goulet-1/+1
2022-12-13Combine projection and opaque into aliasMichael Goulet-1/+1
2022-12-08Pull out logic into distinct functionsMichael Goulet-184/+165
2022-12-07Properly print generator interior type sizesMichael Goulet-86/+188
2022-12-07Compute generator sizes with -Zprint_type_sizesMichael Goulet-0/+6
2022-11-25Some manual formatting of let..else statementsOli Scherer-14/+14
2022-11-24move things from rustc_target::abi to rustc_abihkalbasi-1/+1
2022-11-24move some layout logic to rustc_target::abi::layouthkalbasi-940/+32
2022-11-24make rustc_target usable outside of rustchkalbasi-13/+13
2022-11-22also sort fields by niche sizes to retain optimizationsThe 8472-3/+16
2022-11-22group fields based on largest power of two dividing its sizeThe 8472-7/+3
2022-11-22optimize field ordering by grouping power-of-two arrays with larger typesThe 8472-4/+13
2022-11-20Factor out conservative_is_privately_uninhabitedCameron Steffen-2/+1
2022-11-13add is_sized method on Abi and Layout, and use itRalf Jung-1/+1
2022-10-27Accept `TyCtxt` instead of `TyCtxtAt` in `Ty::is_*` functionsMaybe Waffle-3/+2
Functions in answer: - `Ty::is_freeze` - `Ty::is_sized` - `Ty::is_unpin` - `Ty::is_copy_modulo_regions`
2022-10-04It's not about types or consts, but the lack of regionsOli Scherer-2/+2
2022-10-03Move utils from rustc_middle to rustc_ty_utilsCameron Steffen-0/+1804