about summary refs log tree commit diff
path: root/compiler/rustc_hir_analysis/src
AgeCommit message (Collapse)AuthorLines
2024-05-21Auto merge of #125358 - matthiaskrgr:rollup-mx841tg, r=matthiaskrgrbors-0/+1
Rollup of 7 pull requests Successful merges: - #124570 (Miscellaneous cleanups) - #124772 (Refactor documentation for Apple targets) - #125011 (Add opt-for-size core lib feature flag) - #125218 (Migrate `run-make/no-intermediate-extras` to new `rmake.rs`) - #125225 (Use functions from `crt_externs.h` on iOS/tvOS/watchOS/visionOS) - #125266 (compiler: add simd_ctpop intrinsic) - #125348 (Small fixes to `std::path::absolute` docs) Failed merges: - #125296 (Fix `unexpected_cfgs` lint on std) r? `@ghost` `@rustbot` modify labels: rollup
2024-05-21Rollup merge of #125266 - workingjubilee:stream-plastic-love, r=RalfJung,nikicMatthias Krüger-0/+1
compiler: add simd_ctpop intrinsic Fairly straightforward addition. cc `@rust-lang/opsem` new (extremely boring) intrinsic
2024-05-20Implement BOXED_SLICE_INTO_ITERMichael Goulet-2/+19
2024-05-19Add and use generics.is_empty() and generics.is_own_empty, rather than using ↵Santiago Pastorino-6/+6
generics' attributes
2024-05-18compiler: add simd_ctpop intrinsicJubilee Young-0/+1
2024-05-18Auto merge of #125077 - spastorino:add-new-fnsafety-enum2, r=jackh726bors-62/+48
Rename Unsafe to Safety Alternative to #124455, which is to just have one Safety enum to use everywhere, this opens the posibility of adding `ast::Safety::Safe` that's useful for unsafe extern blocks. This leaves us today with: ```rust enum ast::Safety { Unsafe(Span), Default, // Safe (going to be added for unsafe extern blocks) } enum hir::Safety { Unsafe, Safe, } ``` We would convert from `ast::Safety::Default` into the right Safety level according the context.
2024-05-17Rename Unsafe to SafetySantiago Pastorino-62/+48
2024-05-17to_opt_poly_X_pred -> as_X_clauseMichael Goulet-3/+3
2024-05-16Make P parameter explicitMichael Goulet-13/+12
2024-05-16Rename ToPredicate for UpcastMichael Goulet-28/+28
2024-05-15Fix more new for_loops_over_fallibles hits in compiler.Zachary S-2/+2
2024-05-13Warn against redundant use<...>Michael Goulet-1/+1
2024-05-13Auto merge of #125076 - compiler-errors:alias-term, r=lcnrbors-46/+39
Split out `ty::AliasTerm` from `ty::AliasTy` Splitting out `AliasTerm` (for use in project and normalizes goals) and `AliasTy` (for use in `ty::Alias`) r? lcnr
2024-05-13Apply nitsMichael Goulet-23/+9
2024-05-13split out AliasTy -> AliasTermMichael Goulet-32/+39
2024-05-13Remove `extern crate rustc_middle` from `rustc_hir_analysis`.Nicholas Nethercote-4/+27
2024-05-11Apply nits, uplift ExistentialPredicate tooMichael Goulet-1/+1
2024-05-11Pattern types: Prohibit generic args on const paramsLeón Orell Valerian Liehr-9/+14
2024-05-11Consolidate obligation cause codes for where clausesMichael Goulet-10/+5
2024-05-10Auto merge of #124982 - compiler-errors:uplift-trait-ref, r=lcnrbors-0/+4
Uplift `TraitRef` into `rustc_type_ir` Emotional rollercoaster r? lcnr
2024-05-10Lift `TraitRef` into `rustc_type_ir`Michael Goulet-0/+4
2024-05-10Auto merge of #124952 - compiler-errors:no-error, r=lcnrbors-17/+31
Rename some `FulfillmentErrorCode`/`ObligationCauseCode` variants to be less redundant 1. Rename some `FulfillmentErrorCode` variants. 2. Always use `ObligationCauseCode::` to prefix a code, rather than using a glob import and naming them through `traits::`. 3. Rename some `ObligationCauseCode` variants -- I wasn't particularly thorough with thinking of a new names for these, so could workshop them if necessary. 4. Misc stuff from renaming. r? lcnr
2024-05-10Name tweaksMichael Goulet-6/+7
2024-05-10More rename falloutMichael Goulet-4/+4
2024-05-10Rename some ObligationCauseCode variantsMichael Goulet-13/+12
2024-05-10Remove glob imports for ObligationCauseCodeMichael Goulet-10/+24
2024-05-10Rollup merge of #124957 - compiler-errors:builtin-deref, r=michaelwoeristerMatthias Krüger-21/+20
Make `Ty::builtin_deref` just return a `Ty` Nowhere in the compiler are we using the mutability part of the `TyAndMut` that we used to return.
2024-05-10Auto merge of #124961 - matthiaskrgr:rollup-1jj65p6, r=matthiaskrgrbors-5/+1
Rollup of 7 pull requests Successful merges: - #124551 (Add benchmarks for `impl Debug for str`) - #124915 (`rustc_target` cleanups) - #124918 (Eliminate some `FIXME(lcnr)` comments) - #124927 (opt-dist: use xz2 instead of xz crate) - #124936 (analyse visitor: build proof tree in probe) - #124943 (always use `GenericArgsRef`) - #124955 (Use fewer origins when creating type variables.) r? `@ghost` `@rustbot` modify labels: rollup
2024-05-10Rollup merge of #124955 - nnethercote:next_ty_var, r=lcnrMatthias Krüger-5/+1
Use fewer origins when creating type variables. To reduce lots of repetitive boilerplate code. Details in the individual commit messages. r? ``@lcnr``
2024-05-10Auto merge of #124953 - compiler-errors:own-params, r=lcnrbors-62/+66
Rename `Generics::params` to `Generics::own_params` I hope this makes it slightly more obvious that `generics.own_params` is insufficient when considering nested items. I didn't actually audit any of the usages, for the record. r? lcnr
2024-05-09Make builtin_deref just return a TyMichael Goulet-21/+20
2024-05-09Rename Generics::params to Generics::own_paramsMichael Goulet-62/+66
2024-05-10Use fewer origins when creating type variables.Nicholas Nethercote-5/+1
`InferCtxt::next_{ty,const}_var*` all take an origin, but the `param_def_id` is almost always `None`. This commit changes them to just take a `Span` and build the origin within the method, and adds new methods for the rare cases where `param_def_id` might not be `None`. This avoids a lot of tedious origin building. Specifically: - next_ty_var{,_id_in_universe,_in_universe}: now take `Span` instead of `TypeVariableOrigin` - next_ty_var_with_origin: added - next_const_var{,_in_universe}: takes Span instead of ConstVariableOrigin - next_const_var_with_origin: added - next_region_var, next_region_var_in_universe: these are unchanged, still take RegionVariableOrigin The API inconsistency (ty/const vs region) seems worth it for the large conciseness improvements.
2024-05-09Add `ErrorGuaranteed` to `Recovered::Yes` and use it more.Nicholas Nethercote-4/+2
The starting point for this was identical comments on two different fields, in `ast::VariantData::Struct` and `hir::VariantData::Struct`: ``` // FIXME: investigate making this a `Option<ErrorGuaranteed>` recovered: bool ``` I tried that, and then found that I needed to add an `ErrorGuaranteed` to `Recovered::Yes`. Then I ended up using `Recovered` instead of `Option<ErrorGuaranteed>` for these two places and elsewhere, which required moving `ErrorGuaranteed` from `rustc_parse` to `rustc_ast`. This makes things more consistent, because `Recovered` is used in more places, and there are fewer uses of `bool` and `Option<ErrorGuaranteed>`. And safer, because it's difficult/impossible to set `recovered` to `Recovered::Yes` without having emitted an error.
2024-05-07Auto merge of #124219 - gurry:122989-ice-unexpected-anon-const, ↵bors-6/+8
r=compiler-errors Do not ICE on `AnonConst`s in `diagnostic_hir_wf_check` Fixes #122989 Below is the snippet from #122989 that ICEs: ```rust trait Traitor<const N: N<2> = 1, const N: N<2> = N> { fn N(&N) -> N<2> { M } } trait N<const N: Traitor<2> = 12> {} ``` The `AnonConst` that triggers the ICE is the `2` in the param `const N: N<2> = 1`. The currently existing code in `diagnostic_hir_wf_check` deals only with `AnonConst`s that are default values of some param, but the `2` is not a default value. It is just an `AnonConst` HIR node inside a `TraitRef` HIR node corresponding to `N<2>`. Therefore the existing code cannot handle it and this PR ensures that it does.
2024-05-03Rollup merge of #124687 - fee1-dead-contrib:private-clauses, r=compiler-errorsMichael Goulet-1/+1
Make `Bounds.clauses` private Construct it through `Bounds::default()`, then consume the clauses via the method `Bounds::clauses()`. This helps with effects desugaring where `clauses()` is not only the clauses within the `clauses` field.
2024-05-04Make `Bounds.clauses` privateDeadbeef-1/+1
2024-05-04Auto merge of #124401 - oli-obk:some_hir_cleanups, r=cjgillotbors-14/+10
Some hir cleanups It seemed odd to not put `AnonConst` in the arena, compared with the other types that we did put into an arena. This way we can also give it a `Span` without growing a lot of other HIR data structures because of the extra field. r? compiler
2024-05-02Take ocx by move for pending obligationsMichael Goulet-1/+1
2024-05-02Use ObligationCtxt in favor of TraitEngine in many placesMichael Goulet-21/+15
2024-05-02Rollup merge of #124624 - WaffleLapkin:old_unit, r=fmeaseMatthias Krüger-23/+23
Use `tcx.types.unit` instead of `Ty::new_unit(tcx)` I don't think there is any need for the function, given that we can just access the `.types`, similarly to all other primitives?
2024-05-02Inline & delete `Ty::new_unit`, since it's just a field accessWaffle Lapkin-23/+23
2024-05-02shallow resolve in orphan checklcnr-0/+1
2024-05-01Auto merge of #124356 - fmease:fewer-magic-numbers-in-names, r=lcnrbors-14/+14
Cleanup: Replace item names referencing GitHub issues or error codes with something more meaningful **lcnr** in https://github.com/rust-lang/rust/pull/117164#pullrequestreview-1969935387: > […] while I know that there's precendent to name things `Issue69420`, I really dislike this as it requires looking up the issue to figure out the purpose of such a variant. Actually referring to the underlying issue, e.g. `AliasMayNormToUncovered` or whatever and then linking to the issue in a doc comment feels a lot more desirable to me. We should ideally rename all the functions and enums which currently use issue numbers. I've grepped through `compiler/` like crazy and think that I've found all instances of this pattern. However, I haven't renamed `compute_2229_migrations_*`. Should I? The first commit introduces an abhorrent and super long name for an item because naming is hard but also scary looking / unwelcoming names are good for things related to temporary-ish backcompat hacks. I'll let you discover it by yourself. Contains a bit of drive-by cleanup and a diag migration bc that was the simplest option. r? lcnr or compiler
2024-04-30Auto merge of #117164 - fmease:orphan-norm, r=lcnrbors-72/+275
Lazily normalize inside trait ref during orphan check & consider ty params in rigid alias types to be uncovered Fixes #99554, fixes rust-lang/types-team#104. Fixes #114061. Supersedes #100555. Tracking issue for the future compatibility lint: #124559. r? lcnr
2024-04-30Replace item names containing an error code with something more meaningfulLeón Orell Valerian Liehr-14/+14
or inline such functions if useless.
2024-04-30Normalize trait ref before orphan check & consider ty params in alias types ↵León Orell Valerian Liehr-72/+275
to be uncovered
2024-04-29Avoid some `def_span` query callsOli Scherer-13/+9
2024-04-27Fix ICE on invalid const param typesGurinder Singh-0/+2
2024-04-26put `hir::AnonConst` on the hir arenaOli Scherer-1/+1