about summary refs log tree commit diff
path: root/compiler/rustc_ty_utils
AgeCommit message (Collapse)AuthorLines
2023-12-13Rollup merge of #118871 - tmiasko:coroutine-maybe-uninit-fields, ↵Matthias Krüger-1/+4
r=compiler-errors Coroutine variant fields can be uninitialized 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-12Move some methods from `tcx.hir()` to `tcx`zetanumbers-9/+8
Renamings: - find -> opt_hir_node - get -> hir_node - find_by_def_id -> opt_hir_node_by_def_id - get_by_def_id -> hir_node_by_def_id Fix rebase changes using removed methods Use `tcx.hir_node_by_def_id()` whenever possible in compiler Fix clippy errors Fix compiler Apply suggestions from code review Co-authored-by: Vadim Petrochenkov <vadim.petrochenkov@gmail.com> Add FIXME for `tcx.hir()` returned type about its removal Simplify with with `tcx.hir_node_by_def_id`
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-08Implement `async gen` blocksMichael Goulet-3/+42
2023-12-06Yeet PolyGenSigMichael Goulet-5/+4
2023-12-04Rollup merge of #118573 - petrochenkov:pathdatakind, r=TaKO8KiTakayuki Maeda-5/+2
rustc: Harmonize `DefKind` and `DefPathData` Follow up to https://github.com/rust-lang/rust/pull/118188. `DefPathData::(ClosureExpr,ImplTrait)` are renamed to match `DefKind::(Closure,OpaqueTy)`. `DefPathData::ImplTraitAssocTy` is replaced with `DefPathData::TypeNS(kw::Empty)` because both correspond to `DefKind::AssocTy`. It's possible that introducing `(DefKind,DefPathData)::AssocOpaqueTy` instead could be a better solution, but that would be a much more invasive change. Const generic parameters introduced for effects are moved from `DefPathData::TypeNS` to `DefPathData::ValueNS`, because constants are values. `DefPathData` is no longer passed to `create_def` functions to avoid redundancy.
2023-12-03rustc: Harmonize `DefKind` and `DefPathData`Vadim Petrochenkov-5/+2
`DefPathData::(ClosureExpr,ImplTrait)` are renamed to match `DefKind::(Closure,OpaqueTy)`. `DefPathData::ImplTraitAssocTy` is replaced with `DefPathData::TypeNS(kw::Empty)` because both correspond to `DefKind::AssocTy`. It's possible that introducing `(DefKind,DefPathData)::AssocOpaqueTy` could be a better solution, but that would be a much more invasive change. Const generic parameters introduced for effects are moved from `DefPathData::TypeNS` to `DefPathData::ValueNS`, because constants are values. `DefPathData` is no longer passed to `create_def` functions to avoid redundancy.
2023-12-03more targeted errors when extern types end up in places they should notRalf Jung-0/+12
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-7/+7
Because the corresponding `Level` is `DelayedBug` and `span_delayed_bug` follows the pattern used everywhere else: `span_err`, `span_warning`, etc.
2023-11-28resolve: Feed the `def_kind` query immediately on `DefId` creationVadim Petrochenkov-6/+4
2023-11-26Rollup merge of #118311 - bvanjoi:merge_coroutinue_into_closure, r=petrochenkovGuillaume Gomez-4/+3
merge `DefKind::Coroutine` into `Defkind::Closure` Related to #118188 We no longer need to be concerned about the precise type whether it's `DefKind::Closure` or `DefKind::Coroutine`. Furthermore, thanks for the great work done by `@petrochenkov` on investigating https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/Why.20does.20it.20hang.20when.20querying.20.EF.BB.BF.60opt_def_kind.60.3F r? `@petrochenkov`
2023-11-26merge `DefKind::Coroutine` into `DefKind::Closure`bohan-4/+3
2023-11-26rustc: `hir().local_def_id_to_hir_id()` -> `tcx.local_def_id_to_hir_id()` ↵Vadim Petrochenkov-3/+3
cleanup
2023-11-26Auto merge of #118250 - petrochenkov:optdefkind, r=compiler-errorsbors-2/+2
rustc: Make `def_kind` mandatory for all `DefId`s Prerequisite for https://github.com/rust-lang/rust/pull/118188.
2023-11-26Use `rustc_fluent_macro::fluent_messages!` directly.Nicholas Nethercote-2/+1
Currently we always do this: ``` use rustc_fluent_macro::fluent_messages; ... fluent_messages! { "./example.ftl" } ``` But there is no need, we can just do this everywhere: ``` rustc_fluent_macro::fluent_messages! { "./example.ftl" } ``` which is shorter.
2023-11-26Avoid need for `{D,Subd}iagnosticMessage` imports.Nicholas Nethercote-1/+0
The `fluent_messages!` macro produces uses of `crate::{D,Subd}iagnosticMessage`, which means that every crate using the macro must have this import: ``` use rustc_errors::{DiagnosticMessage, SubdiagnosticMessage}; ``` This commit changes the macro to instead use `rustc_errors::{D,Subd}iagnosticMessage`, which avoids the need for the imports.
2023-11-25Auto merge of #118127 - RalfJung:unadjusted-abi, r=compiler-errorsbors-6/+29
the unadjusted ABI needs to pass aggregates by-value Fixes https://github.com/rust-lang/rust/issues/118124, a regression introduced in https://github.com/rust-lang/rust/pull/117500
2023-11-25rustc: Make `def_kind` mandatory for all `DefId`sVadim Petrochenkov-2/+2
2023-11-23Fix assertionbjorn3-13/+1
2023-11-23Exhaustively match CoroutineKind in fn_sig_for_fn_abibjorn3-60/+70
2023-11-23Fix fn_sig_for_fn_abi and the coroutine transform for generatorsbjorn3-7/+47
There were three issues previously: * The self argument was pinned, despite Iterator::next taking an unpinned mutable reference. * A resume argument was passed, despite Iterator::next not having one. * The return value was CoroutineState<Item, ()> rather than Option<Item> While these things just so happened to work with the LLVM backend, cg_clif does much stricter checks when trying to assign a value to a place. In addition it can't handle the mismatch between the amount of arguments specified by the FnAbi and the FnSig.
2023-11-22Auto merge of #117928 - nnethercote:rustc_ast_pretty, r=fee1-deadbors-1/+1
`rustc_ast_pretty` cleanups Some improvements I found while looking at this code. r? `@fee1-dead`
2023-11-22Update itertools to 0.11.Nicholas Nethercote-1/+1
Because the API for `with_position` improved in 0.11 and I want to use it.
2023-11-21Fix `clippy::needless_borrow` in the compilerNilstrieb-9/+9
`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-21the unadjusted ABI needs to pass aggregates by-valueRalf Jung-6/+29
2023-11-21Rollup merge of #118115 - spastorino:fix-old-fn-names, r=compiler-errorsNilstrieb-1/+1
Fix occurrences of old fn names in comment and tracing
2023-11-21Rollup merge of #118081 - nnethercote:rustc_ty_utils, r=compiler-errorsNilstrieb-33/+23
`rustc_ty_utils` cleanups Minor improvements I found while looking at this code. r? ``@lcnr``
2023-11-20Fix occurrences of old fn names in comment and tracingSantiago Pastorino-1/+1
2023-11-20Alphabetize features.Nicholas Nethercote-2/+2
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-16/+16
2023-11-19Auto merge of #117500 - RalfJung:aggregate-abi, r=davidtwcobors-5/+77
Ensure sanity of all computed ABIs This moves the ABI sanity assertions from the codegen backend to the ABI computation logic. Sadly, due to past mistakes, we [have to](https://github.com/rust-lang/rust/pull/117351#issuecomment-1788495503) be able to compute a sane ABI for nonsensical function types like `extern "C" fn(str) -> str`. So to make the sanity check pass we first need to make all ABI adjustment deal with unsized types... and we have no shared infrastructure for those adjustments, so that's a bunch of copy-paste. At least we have assertions failing loudly when one accidentally sets a different mode for an unsized argument. To achieve this, this re-lands the parts of https://github.com/rust-lang/rust/pull/80594 that got reverted in https://github.com/rust-lang/rust/pull/81388. To avoid breaking wasm ABI again, that ABI now explicitly opts-in to the (wrong, broken) ABI that we currently keep for backwards compatibility. That's still better than having *every* ABI use the wrong broken default! Cc `@bjorn3` Fixes https://github.com/rust-lang/rust/issues/115845
2023-11-17Rollup merge of #117549 - DaniPopes:more-copied, r=b-naberMatthias Krüger-2/+2
Use `copied` instead of manual `map`
2023-11-15Re-format code with new rustfmtMark Rousskov-5/+1
2023-11-15Bump cfg(bootstrap)sMark Rousskov-3/+3
2023-11-14finish `RegionKind` renamelcnr-13/+13
- `ReFree` -> `ReLateParam` - `ReEarlyBound` -> `ReEarlyParam`
2023-11-13Auto merge of #117881 - TaKO8Ki:rollup-n7jtmgj, r=TaKO8Kibors-5/+5
Rollup of 5 pull requests Successful merges: - #117737 (Remove `-Zkeep-hygiene-data`.) - #117830 (Small improvements in object lifetime default code) - #117858 (Compute layout with spans for better cycle errors in coroutines) - #117863 (Remove some unused stuff from `rustc_index`) - #117872 (Cranelift isn't available on non-nightly channels) r? `@ghost` `@rustbot` modify labels: rollup
2023-11-13rename `ReLateBound` to `ReBound`lcnr-5/+4
other changes: - `Region::new_late_bound` -> `Region::new_bound` - `Region::is_late_bound` -> `Region::is_bound`
2023-11-13Compute layout with spans for better cycle errors in coroutinesMichael Goulet-5/+5
2023-11-03compiler: use `copied` instead of manual `map`DaniPopes-2/+2
2023-11-03default Aggregate ABI to Indirect, and make sure it's never used for unsizedRalf Jung-5/+6
2023-11-03move ABI sanity check from LLVM codegen backend to ABI computation logicRalf Jung-0/+71
2023-11-02review + add testslcnr-4/+4
2023-11-02dropck_outlives check generator witness needs_droplcnr-3/+29
2023-10-30Some more coroutine renamingsMichael Goulet-1/+1
2023-10-30Auto merge of #117415 - matthiaskrgr:rollup-jr2p1t2, r=matthiaskrgrbors-28/+12
Rollup of 7 pull requests Successful merges: - #116862 (Detect when trait is implemented for type and suggest importing it) - #117389 (Some diagnostics improvements of `gen` blocks) - #117396 (Don't treat closures/coroutine types as part of the public API) - #117398 (Correctly handle nested or-patterns in exhaustiveness) - #117403 (Poison check_well_formed if method receivers are invalid to prevent typeck from running on it) - #117411 (Improve some diagnostics around `?Trait` bounds) - #117414 (Don't normalize to an un-revealed opaque when we hit the recursion limit) r? `@ghost` `@rustbot` modify labels: rollup
2023-10-30Rollup merge of #117068 - nnethercote:clean-up-Cargo-toml, r=wesleywiserGuillaume Gomez-5/+7
Clean up `compiler/rustc*/Cargo.toml` Mostly by sorting dependencies, plus some other minor things. r? ``@wesleywiser``