summary refs log tree commit diff
path: root/compiler/rustc_ty_utils/src/layout.rs
AgeCommit message (Collapse)AuthorLines
2024-08-14Auto merge of #128812 - nnethercote:shrink-TyKind-FnPtr, r=compiler-errorsbors-1/+1
Shrink `TyKind::FnPtr`. By splitting the `FnSig` within `TyKind::FnPtr` into `FnSigTys` and `FnHeader`, which can be packed more efficiently. This reduces the size of the hot `TyKind` type from 32 bytes to 24 bytes on 64-bit platforms. This reduces peak memory usage by a few percent on some benchmarks. It also reduces cache misses and page faults similarly, though this doesn't translate to clear cycles or wall-time improvements on CI. r? `@compiler-errors`
2024-08-11Remove struct_tail_no_normalizationMichael Goulet-1/+5
2024-08-09Shrink `TyKind::FnPtr`.Nicholas Nethercote-1/+1
By splitting the `FnSig` within `TyKind::FnPtr` into `FnSigTys` and `FnHeader`, which can be packed more efficiently. This reduces the size of the hot `TyKind` type from 32 bytes to 24 bytes on 64-bit platforms. This reduces peak memory usage by a few percent on some benchmarks. It also reduces cache misses and page faults similarly, though this doesn't translate to clear cycles or wall-time improvements on CI.
2024-08-08Rename struct_tail_erasing_lifetimes to struct_tail_for_codegenMichael Goulet-1/+1
2024-07-30Auto merge of #128083 - Mark-Simulacrum:bump-bootstrap, r=albertlarsan68bors-3/+1
Bump bootstrap compiler to new beta https://forge.rust-lang.org/release/process.html#master-bootstrap-update-t-2-day-tuesday
2024-07-29Reformat `use` declarations.Nicholas Nethercote-3/+3
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-07-28step cfg(bootstrap)Mark Rousskov-3/+1
2024-06-01Uplift TypeRelation and RelateMichael Goulet-1/+2
2024-05-23Remove `#[macro_use] extern crate tracing` from `rustc_ty_utils`.Nicholas Nethercote-0/+1
2024-05-13Remove `extern crate rustc_middle` from `rustc_ty_utils`.Nicholas Nethercote-0/+1
2024-05-06Refactor float `Primitive`s to a separate `Float` typebeetrees-7/+2
2024-04-09Handle const generic pattern typesSantiago Pastorino-2/+6
2024-04-08Actually create ranged int types in the type system.Oli Scherer-0/+33
2024-04-04Rollup merge of #123464 - fmease:rn-has-proj-to-has-aliases, r=compiler-errorsJacob Pratt-2/+2
Cleanup: Rename `HAS_PROJECTIONS` to `HAS_ALIASES` etc. The name of the bitflag `HAS_PROJECTIONS` and of its corresponding method `has_projections` is quite historical dating back to a time when projections were the only kind of alias type. I think it's time to update it to clear up any potential confusion for newcomers and to reduce unnecessary friction during contributor onboarding. r? types
2024-04-04Rename HAS_PROJECTIONS to HAS_ALIASES etc.León Orell Valerian Liehr-2/+2
2024-04-04Rollup merge of #121546 - gurry:121473-ice-sizeof-mir-op, r=oli-obkMatthias Krüger-1/+37
Error out of layout calculation if a non-last struct field is unsized Fixes #121473 Fixes #123152
2024-04-04Error out of layout calculation if a non-last struct field is unsizedGurinder Singh-1/+37
Fixes an ICE that occurs when a struct with an unsized field at a non-last position is const evaluated.
2024-04-03rustc_index: Add a `ZERO` constant to index typesVadim Petrochenkov-1/+1
It is commonly used.
2024-03-24Require coroutine kind type to be passed to TyCtxt::coroutine_layoutMichael Goulet-2/+2
2024-03-24Always use tcx.coroutine_layout over calling optimized_mir directlyMichael Goulet-1/+1
2024-03-22-Zprint-type-sizes: print the types of awaitees and unnamed coroutine locals.Kevin Reid-1/+9
This should assist comprehending the size of coroutines. In particular, whenever a future is suspended while awaiting another future, the latter is given the special name `__awaitee`, and now the type of the awaited future will be printed, allowing identifying caller/callee — er, I mean, poller/pollee — relationships. It would be possible to include the type name in more cases, but I thought that that might be overly verbose (`print-type-sizes` is already a lot of text) and ordinary named fields or variables are easier for readers to discover the types of.
2024-03-22Programmatically convert some of the pat ctorsMichael Goulet-1/+1
2024-02-28Add `f16` and `f128` to `rustc_type_ir::FloatTy` and `rustc_abi::Primitive`Trevor Gross-0/+2
Make changes necessary to support these types in the compiler.
2024-02-21Convert `delayed_bug`s to `bug`s.Nicholas Nethercote-2/+1
I have a suspicion that quite a few delayed bug paths are impossible to reach, so I did an experiment. I converted every `delayed_bug` to a `bug`, ran the full test suite, then converted back every `bug` that was hit. A surprising number were never hit. The next commit will convert some more back, based on human judgment.
2024-02-12Dejargnonize substShoyu Vanilla-3/+3
2024-02-06Add CoroutineClosure to TyKind, AggregateKind, UpvarArgsMichael Goulet-0/+11
2024-01-15Rollup merge of #119971 - compiler-errors:zip-eq, r=nnethercoteMatthias Krüger-1/+3
Use `zip_eq` to enforce that things being zipped have equal sizes Some `zip`s are best enforced to be equal, since size mismatches suggest deeper bugs in the compiler.
2024-01-14Use zip_eq to enforce that things being zipped have equal sizesMichael Goulet-1/+3
2024-01-10Add `DiagCtxt::delayed_bug`.Nicholas Nethercote-8/+3
We have `span_delayed_bug` and often pass it a `DUMMY_SP`. This commit adds `delayed_bug`, which matches pairs like `err`/`span_err` and `warn`/`span_warn`.
2023-12-28Remove movability from TyKind::CoroutineMichael Goulet-2/+2
2023-12-24Remove `Session` methods that duplicate `DiagCtxt` methods.Nicholas Nethercote-9/+9
Also add some `dcx` methods to types that wrap `TyCtxt`, for easier access.
2023-12-12Coroutine variant fields can be uninitializedTomasz Miąsko-1/+4
Wrap coroutine variant fields in MaybeUninit to indicate that they might be uninitialized. Otherwise an uninhabited field will make the entire variant uninhabited and introduce undefined behaviour. The analogous issue in the prefix of coroutine layout was addressed by 6fae7f807146e400fa2bbd1c44768d9bcaa57c4c.
2023-12-11Auto merge of #117116 - calebzulawski:repr-simd-packed, r=workingjubileebors-2/+16
Implement repr(packed) for repr(simd) This allows creating vectors with non-power-of-2 lengths that do not have padding. See rust-lang/portable-simd#319
2023-12-10remove redundant importssurechen-3/+1
detects redundant imports that can be eliminated. for #117772 : In order to facilitate review and modification, split the checking code and removing redundant imports code into two PR.
2023-12-02Implement repr(packed) for repr(simd)Caleb Zulawski-2/+16
2023-12-02Rename `HandlerInner::delay_span_bug` as `HandlerInner::span_delayed_bug`.Nicholas Nethercote-4/+4
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-11-20Inline and remove `record_layout_for_printing`.Nicholas Nethercote-15/+5
It has a single call site.
2023-11-20Reduce exposure of some items.Nicholas Nethercote-1/+1
2023-11-13Compute layout with spans for better cycle errors in coroutinesMichael Goulet-5/+5
2023-10-20s/generator/coroutine/Oli Scherer-24/+24
2023-10-20s/Generator/Coroutine/Oli Scherer-14/+14
2023-10-13Format all the let chains in compilerMichael Goulet-21/+19
2023-10-02Implement Deref<LayoutS> for LayoutLukas Wirth-1/+1
2023-09-23Remove GeneratorWitness and rename GeneratorWitnessMIR.Camille GILLOT-5/+1
2023-09-18Explain `with_reveal_all_normalized` usageOli Scherer-0/+3
2023-09-11Disentangle `Debug` and `Display` for `Ty`.Nicholas Nethercote-1/+2
The `Debug` impl for `Ty` just calls the `Display` impl for `Ty`. This is surprising and annoying. In particular, it means `Debug` doesn't show as much information as `Debug` for `TyKind` does. And `Debug` is used in some user-facing error messages, which seems bad. This commit changes the `Debug` impl for `Ty` to call the `Debug` impl for `TyKind`. It also does a number of follow-up changes to preserve existing output, many of which involve inserting `with_no_trimmed_paths!` calls. It also adds `Display` impls for `UserType` and `Canonical`. Some tests have changes to expected output: - Those that use the `rustc_abi(debug)` attribute. - Those that use the `EMIT_MIR` annotation. In each case the output is slightly uglier than before. This isn't ideal, but it's pretty weird (particularly for the attribute) that the output is using `Debug` in the first place. They're fairly obscure attributes (I hadn't heard of them) so I'm not worried by this. For `async-is-unwindsafe.stderr`, there is one line that now lacks a full path. This is a consistency improvement, because all the other mentions of `Context` in this test lack a path.
2023-08-29some more is_zst that should be is_1zstRalf Jung-1/+1
2023-08-01Use upvar_tys in more places, make it a listMichael Goulet-2/+6
2023-07-27Don't attempt to compute layout of type referencing errorMichael Goulet-2/+13