about summary refs log tree commit diff
path: root/compiler/rustc_ty_utils
AgeCommit message (Collapse)AuthorLines
2025-02-10Rename rustc_middle::Ty::is_unsafe_ptr to is_raw_ptrBastian Kersting-2/+2
The wording unsafe pointer is less common and not mentioned in a lot of places, instead this is usually called a "raw pointer". For the sake of uniformity, we rename this method. This came up during the review of https://github.com/rust-lang/rust/pull/134424.
2025-02-09compiler: internally merge `Conv::PtxKernel` into `GpuKernel`Jubilee Young-1/+1
It is speculated that these two can be conceptually merged, and it can start by ripping out rustc's notion of the PtxKernel call convention. Leave the ExternAbi for now, but the nvptx target now should see it as just a different way to spell Conv::GpuKernel.
2025-02-08Rustfmtbjorn3-24/+39
2025-02-06Rollup merge of #136435 - Zalathar:thir-pat-stuff, r=NadrierilMatthias Krüger-1/+2
Simplify some code for lowering THIR patterns I've been playing around with some radically different ways of storing THIR patterns, and while those experiments haven't yet produced a clear win, I have noticed various smaller things in the existing code that can be made a bit nicer. Some of the more significant changes: - With a little bit of extra effort (and thoughtful use of Arc), we can completely remove an entire layer of `'pat` lifetimes from the intermediate data structures used for match lowering. - In several places, lists of THIR patterns were being double-boxed for no apparent reason.
2025-02-05Rollup merge of #133932 - bjorn3:fix_ptx_kernel_abi, r=wesleywiserJubilee-8/+3
Avoid using make_direct_deprecated() in extern "ptx-kernel" This method will be removed in the future as it produces a broken ABI that depends on cg_llvm implementation details. After this PR wasm32-unknown-unknown is the only remaining user of make_direct_deprecated(). Fixes https://github.com/rust-lang/rust/issues/117271 Blocks https://github.com/rust-lang/rust/issues/38788
2025-02-03Remove `'pat` lifetime from some match-lowering data structuresZalathar-1/+2
By storing `PatRange` in an Arc, and copying a few fields out of `Pat`, we can greatly simplify the lifetimes involved in match lowering.
2025-02-02Rollup merge of #136279 - Zalathar:ensure-ok, r=oli-obkMatthias Krüger-1/+1
Rename `tcx.ensure()` to `tcx.ensure_ok()`, and improve the associated docs This is all based on my archaeology for https://rust-lang.zulipchat.com/#narrow/channel/182449-t-compiler.2Fhelp/topic/.60TyCtxtEnsure.60. The main renamings are: - `tcx.ensure()` → `tcx.ensure_ok()` - `tcx.ensure_with_value()` → `tcx.ensure_done()` - Query modifier `ensure_forwards_result_if_red` → `return_result_from_ensure_ok` Hopefully these new names are a better fit for the *actual* function and purpose of these query call modes.
2025-02-01Rename `tcx.ensure()` to `tcx.ensure_ok()`Zalathar-1/+1
2025-01-31Implement MIR, CTFE, and codegen for unsafe bindersMichael Goulet-0/+8
2025-01-30introduce `ty::Value`Lukas Markeffsky-14/+11
Co-authored-by: FedericoBruzzone <federico.bruzzone.i@gmail.com>
2025-01-27Add `TooGeneric` variant to `LayoutError` and emit `Unknown` oneFedericoBruzzone-19/+50
- `check-pass` test for a MRE of #135020 - fail test for #135138 - switch to `TooGeneric` for checking CMSE fn signatures - switch to `TooGeneric` for compute `SizeSkeleton` (for transmute) - fix broken tests
2025-01-26Avoid using make_direct_deprecated() in extern "ptx-kernel"bjorn3-8/+3
This method will be removed in the future as it produces a broken ABI that depends on cg_llvm implementation details. After this PR wasm32-unknown-unknown is the only remaining user of make_direct_deprecated().
2025-01-23Split hir `TyKind` and `ConstArgKind` in two and update `hir::Visitor`Boxy-2/+2
2025-01-17new solver: prefer trivial builtin impls over where-clausesRémy Rakic-1/+1
for now, only builtin `Sized` impls are tracked as being `Trivial`
2025-01-17Auto merge of #135047 - Flakebi:amdgpu-kernel-cc, r=workingjubileebors-0/+1
Add gpu-kernel calling convention The amdgpu-kernel calling convention was reverted in commit f6b21e90d1ec01081bc2619efb68af6788a63d65 (#120495 and https://github.com/rust-lang/rust-analyzer/pull/16463) due to inactivity in the amdgpu target. Introduce a `gpu-kernel` calling convention that translates to `ptx_kernel` or `amdgpu_kernel`, depending on the target that rust compiles for. Tracking issue: #135467 amdgpu target tracking issue: #135024
2025-01-16Add gpu-kernel calling conventionFlakebi-0/+1
The amdgpu-kernel calling convention was reverted in commit f6b21e90d1ec01081bc2619efb68af6788a63d65 due to inactivity in the amdgpu target. Introduce a `gpu-kernel` calling convention that translates to `ptx_kernel` or `amdgpu_kernel`, depending on the target that rust compiles for.
2025-01-14Consider more erroneous layouts as LayoutError::ReferencesError to suppress ↵Michael Goulet-12/+20
spurious errors
2025-01-11rename `BitSet` to `DenseBitSet`Rémy Rakic-12/+12
This should make it clearer that this bitset is dense, with the advantages and disadvantages that it entails.
2025-01-10Rollup merge of #133088 - the8472:randomize-me-harder, r=workingjubileeMatthias Krüger-0/+10
`-Zrandomize-layout` harder. `Foo<T> != Foo<U>` Tracking issue: #106764 Previously randomize-layout only used a deterministic shuffle based on the seed stored in an Adt's ReprOptions, meaning that `Foo<T>` and `Foo<U>` were shuffled by the same seed. This change adds a similar seed to each calculated LayoutData so that a struct can be randomized both based on the layout of its fields and its per-type seed. Primitives start with simple seed derived from some of their properties. Though some types can no longer be distinguished at that point, e.g. usize and u64 will still be treated the same.
2025-01-10Foo<T> != Foo<U> under layout randomizationThe 8472-0/+10
previously field ordering was using the same seed for all instances of Foo, now we pass seed values through the layout tree so that not only the struct itself affects layout but also its fields
2025-01-09Remove the now-useless `Result` from `lit_to_const`Oli Scherer-7/+2
2025-01-09Use error constant instead of explicit error handlingOli Scherer-1/+0
2025-01-02nit: Make get_infer_ret_ty name more consistent with is_suggestable_infer_tyMichael Goulet-1/+1
2024-12-22Begin to implement type system layer of unsafe bindersMichael Goulet-1/+14
2024-12-18make no-variant types a dedicated Variants variantRalf Jung-19/+15
2024-12-18Variants::Single: do not use invalid VariantIdx for uninhabited enumsRalf Jung-58/+78
2024-12-18Re-export more `rustc_span::symbol` things from `rustc_span`.Nicholas Nethercote-3/+2
`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-12-10Implement projection and shim for AFIDTMichael Goulet-0/+26
2024-12-06Remove polymorphizationBen Kimock-17/+2
2024-12-06Only allow PassMode::Direct for aggregates on wasm when using the C ABIbjorn3-10/+20
For the Rust ABI we don't have any ABI compat reasons to allow PassMode::Direct for aggregates.
2024-12-04fn_sig_for_fn_abi should return a ty::FnSig, no need for a binderMichael Goulet-80/+50
2024-12-03Rollup merge of #133681 - RalfJung:niches, r=wesleywiserMatthias Krüger-4/+14
improve TagEncoding::Niche docs, sanity check, and UB checks Turns out the `niche_variants` range can actually contain the `untagged_variant`. We should report this as UB in Miri, so this PR implements that. Also rename `partially_check_layout` to `layout_sanity_check` for better consistency with how similar functions are called in other parts of the compiler. Turns out my adjustments to the transmutation logic also fix https://github.com/rust-lang/rust/issues/126267.
2024-12-02remove `Ty::is_copy_modulo_regions`lcnr-1/+1
2024-11-30report UB when the niche value refers to the untagged variantRalf Jung-1/+1
2024-11-30improve TagEncoding::Niche docs and sanity checkRalf Jung-3/+13
2024-11-30Move refinement check out of compare_impl_itemMichael Goulet-0/+2
2024-11-30Make compare_impl_item into a queryMichael Goulet-7/+5
2024-11-28support revealing defined opaque post borrowcklcnr-1/+2
2024-11-28uplift fold_regions to rustc_type_irlcnr-2/+5
2024-11-23rebaselcnr-3/+3
2024-11-23remove remaining references to `Reveal`lcnr-5/+7
2024-11-23no more Reveal :(lcnr-7/+8
2024-11-21Stop being so bail-y in candidate assemblyMichael Goulet-5/+1
2024-11-20reduce false positives of tail-expr-drop-order from consumed valuesDing Xiang Fei-13/+55
take 2 open up coroutines tweak the wordings the lint works up until 2021 We were missing one case, for ADTs, which was causing `Result` to yield incorrect results. only include field spans with significant types deduplicate and eliminate field spans switch to emit spans to impl Drops Co-authored-by: Niko Matsakis <nikomat@amazon.com> collect drops instead of taking liveness diff apply some suggestions and add explantory notes small fix on the cache let the query recurse through coroutine new suggestion format with extracted variable name fine-tune the drop span and messages bugfix on runtime borrows tweak message wording filter out ecosystem types earlier apply suggestions clippy check lint level at session level further restrict applicability of the lint translate bid into nop for stable mir detect cycle in type structure
2024-11-19resolve_instance: stop relying on `Reveal`lcnr-17/+17
2024-11-19move `fn is_item_raw` to `TypingEnv`lcnr-20/+15
2024-11-18use `TypingEnv` when no `infcx` is availablelcnr-72/+88
the behavior of the type system not only depends on the current assumptions, but also the currentnphase of the compiler. This is mostly necessary as we need to decide whether and how to reveal opaque types. We track this via the `TypingMode`.
2024-11-07Make fn_abi_sanity_check a bit stricterbjorn3-30/+51
The Rust ABI must ignore all ZST arguments, all ignored arguments must be either ZST or uninhabited. And finally ScalarPair should never be passed as PassMode::Direct.
2024-11-04ty::BrK -> ty::BoundRegionKind::KMichael Goulet-10/+12
2024-11-04ty::KContainer -> ty::AssocItemContainer::KMichael Goulet-5/+5