about summary refs log tree commit diff
path: root/compiler/rustc_ty_utils/src
AgeCommit message (Collapse)AuthorLines
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
2024-11-03Rollup merge of #132574 - workingjubilee:abi-in-compiler, r=compiler-errorsJubilee-21/+19
compiler: Directly use rustc_abi almost everywhere Use rustc_abi instead of rustc_target where applicable. This is mostly described by the following substitutions: ```rust match path_substring { rustc_target::spec::abi::Abi => rustc_abi::ExternAbi, rustc_target::abi::call => rustc_target::callconv, rustc_target::abi => rustc_abi, } ``` A number of spot-fixes make that not quite the whole story. The main exception is in 33edc68 where I get a lot more persnickety about how things are imported, especially in `rustc_middle::ty::layout`, not just from where. This includes putting an end to a reexport of `rustc_middle::ty::ReprOptions`, for the same reason that the rest of this change is happening: reexports mostly confound things. This notably omits rustc_passes and the ast crates, as I'm still examining a question I have about how they do stability checking of `extern "Abi"` strings and if I can simplify their logic. The rustc_abi and rustc_target crates also go untouched because they will be entangled in that cleanup. r? compiler-errors
2024-11-03compiler: Directly use rustc_abi in ty_utilsJubilee Young-21/+19
2024-11-03Rename the FIXMEs, remove a few that dont matter anymoreMichael Goulet-1/+0
2024-10-31Auto merge of #131186 - compiler-errors:precise-capturing-borrowck, r=estebankbors-4/+2
Try to point out when edition 2024 lifetime capture rules cause borrowck issues Lifetime capture rules in 2024 are modified to capture more lifetimes, which sometimes lead to some non-local borrowck errors. This PR attempts to link these back together with a useful note pointing out the capture rule changes. This is not a blocking concern, but I'd appreciate feedback (though, again, I'd like to stress that I don't want to block this PR on this): I'm worried about this note drowning in the sea of other diagnostics that borrowck emits. I was tempted to change the level of the note to `.span_warn` just so it would show up in a different color. Thoughts? Fixes #130545 Opening as a draft first since it's stacked on #131183. r? `@ghost`
2024-10-31Encode cross-crate opaque type originMichael Goulet-4/+2
2024-10-31Auto merge of #132377 - matthiaskrgr:rollup-3p1c6hs, r=matthiaskrgrbors-4/+0
Rollup of 3 pull requests Successful merges: - #132368 (Remove `do_not_const_check` from `Iterator` methods) - #132373 (Make sure `type_param_predicates` resolves correctly for RPITIT) - #132374 (Remove dead code stemming from the old effects desugaring) r? `@ghost` `@rustbot` modify labels: rollup
2024-10-30Remove dead code stemming from the old effects desugaringLeón Orell Valerian Liehr-4/+0
2024-10-30Rollup merge of #132344 - compiler-errors:same-thing, r=lcnrJubilee-1/+1
Merge `HostPolarity` and `BoundConstness` They're basically the same thing, and I think `BoundConstness` is easier to use. r? fee1-dead or reassign