about summary refs log tree commit diff
path: root/compiler/rustc_hir_analysis
AgeCommit message (Collapse)AuthorLines
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/+20
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-76/+279
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/+20
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-76/+279
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
2024-04-25Auto merge of #124058 - TechVest:master, r=fmeasebors-1/+1
Fix some typos in comments
2024-04-25Fix some typos in commentsTechVest-1/+1
Signed-off-by: TechVest <techdashen@qq.com>
2024-04-24Auto merge of #122500 - petrochenkov:deleg, r=fmeasebors-28/+0
delegation: Support renaming, and async, const, extern "ABI" and C-variadic functions Also allow delegating to functions with opaque types (`impl Trait`). The delegation item will refer to the original opaque type from the callee, fresh opaque type won't be created, which seems like a reasonable behavior. (Such delegation items will cause query cycles when used in trait impls, but it can be fixed later.) Part of https://github.com/rust-lang/rust/issues/118212.
2024-04-23delegation: Support async, const, extern "ABI" and C-variadic functionsVadim Petrochenkov-28/+0
Also allow `impl Trait` in delegated functions. The delegation item will refer to the original opaque type from the callee, fresh opaque type won't be created.
2024-04-23Auto merge of #124302 - matthiaskrgr:rollup-2aya8n8, r=matthiaskrgrbors-8/+6
Rollup of 3 pull requests Successful merges: - #124003 (Dellvmize some intrinsics (use `u32` instead of `Self` in some integer intrinsics)) - #124169 (Don't fatal when calling `expect_one_of` when recovering arg in `parse_seq`) - #124286 (Subtree sync for rustc_codegen_cranelift) r? `@ghost` `@rustbot` modify labels: rollup
2024-04-23Rollup merge of #124003 - WaffleLapkin:dellvmization, r=scottmcm,RalfJung,antoyoMatthias Krüger-8/+6
Dellvmize some intrinsics (use `u32` instead of `Self` in some integer intrinsics) This implements https://github.com/rust-lang/compiler-team/issues/693 minus what was implemented in #123226. Note: I decided to _not_ change `shl`/... builder methods, as it just doesn't seem worth it. r? ``@scottmcm``
2024-04-23Rollup merge of #123993 - compiler-errors:coroutine-obl, r=lcnrLeón Orell Valerian Liehr-36/+11
Do `check_coroutine_obligations` once per typeck root We only need to do `check_coroutine_obligations` once per typeck root, especially since the new solver can't really (easily) associate which obligations correspond to which coroutines. This requires us to move the checks for sized coroutine fields into `mir_coroutine_witnesses`, but that's fine imo. r? lcnr
2024-04-23Rollup merge of #122591 - gurry:122162-impl-type-binding-suggestion, r=fmeaseLeón Orell Valerian Liehr-11/+114
Suggest using type args directly instead of equality constraint When type arguments are written erroneously using an equality constraint we suggest specifying them directly without the equality constraint. Fixes #122162 Changes the diagnostic in the issue from: ```rust error[E0229]: associated type bindings are not allowed here 9 | impl std::cmp::PartialEq<Rhs = T> for S { | ^^^^^^^ associated type not allowed here | ``` to ```rust error[E0229]: associated type bindings are not allowed here 9 | impl std::cmp::PartialEq<Rhs = T> for S { | ^^^^^^^ associated type not allowed here | help: to use `T` as a generic argument specify it directly | | impl std::cmp::PartialEq<T> for S { | ~ ```
2024-04-23Rollup merge of #124288 - fee1-dead-contrib:rm_inner, r=fmeaseMatthias Krüger-10/+0
remove `push_trait_bound_inner` Don't see a use for it.
2024-04-23Rollup merge of #124067 - RalfJung:weak-lang-items, r=davidtwcoMatthias Krüger-3/+3
weak lang items are not allowed to be #[track_caller] For instance the panic handler will be called via this import ```rust extern "Rust" { #[lang = "panic_impl"] fn panic_impl(pi: &PanicInfo<'_>) -> !; } ``` A `#[track_caller]` would add an extra argument and thus make this the wrong signature. The 2nd commit is a consistency rename; based on the docs [here](https://doc.rust-lang.org/unstable-book/language-features/lang-items.html) and [here](https://rustc-dev-guide.rust-lang.org/lang-items.html) I figured "lang item" is more widely used. (In the compiler output, "lang item" and "language item" seem to be pretty even.)
2024-04-23remove `push_trait_bound_inner`Deadbeef-10/+0
2024-04-22Rollup merge of #124230 - reitermarkus:generic-nonzero-stable, r=dtolnayGuillaume Gomez-1/+0
Stabilize generic `NonZero`. Tracking issue: https://github.com/rust-lang/rust/issues/120257 r? `@dtolnay`
2024-04-22Stabilize generic `NonZero`.Markus Reiter-1/+0
2024-04-22Do not ICE on `AnonConst`s in `diagnostic_hir_wf_check`Gurinder Singh-6/+8
2024-04-21Auto merge of #124241 - matthiaskrgr:rollup-xhu90xr, r=matthiaskrgrbors-2/+7
Rollup of 5 pull requests Successful merges: - #123840 (Add an intrinsic for `ptr::from_raw_parts(_mut)`) - #124224 (cleanup: unnecessary clone during lower generics args) - #124229 (Add gnullvm targets to manifest) - #124231 (remove from reviewers) - #124235 (Move some tests) r? `@ghost` `@rustbot` modify labels: rollup
2024-04-21Rollup merge of #124224 - bvanjoi:cleanup, r=fmeaseMatthias Krüger-2/+2
cleanup: unnecessary clone during lower generics args
2024-04-21Auto merge of #124203 - lukas-code:delete-deleting-caches, r=compiler-errorsbors-2/+2
fix normalizing in different `ParamEnv`s with the same `InferCtxt` This PR changes the key of the projection cache from just `AliasTy` to `(AliasTy, ParamEnv)` to allow normalizing in different `ParamEnv`s without resetting caches. Previously, normalizing the same alias in different param envs would always reuse the cached result from the first normalization, which is incorrect if the projection clauses in the param env have changed. Fixing this bug allows us to get rid of `InferCtxt::clear_caches`, which was only used by the `AutoTraitFinder`, because it requires normalizing in different param envs. r? `@fmease`
2024-04-21Add an intrinsic that lowers to AggregateKind::RawPtrScott McMurray-0/+5
2024-04-21also remap RPITITs nested in other types back to their opaquesLukas Markeffsky-2/+2
2024-04-21cleanup: unnecessary clone during lower generics argsbohan-2/+2
2024-04-20Explicitly mention `Self`Michael Goulet-7/+29
2024-04-20Flip spans for precise capturing syntax not capturing a ty/ct paramMichael Goulet-14/+21
2024-04-20Rollup merge of #124104 - compiler-errors:parent-generic-use, r=oli-obkMatthias Krüger-7/+30
Fix capturing duplicated lifetimes via parent in `precise_captures` (`impl use<'...>`) For technical reasons related to the way that `Self` and `T::Assoc` are lowered from HIR -> `rustc_middle::ty`, an opaque may mention in its bounds both the original early-bound lifetime from the parent `impl`/`fn`, *and* the *duplicated* early-bound lifetime on the opaque. This is fine -- and has been fine since `@cjgillot` rewrote the way we handled opaque lifetime captures, and we went further to allow this behavior explicitly in https://github.com/rust-lang/rust/pull/115659. It's worthwhile to read this PR's technical section to recall how this duplication works and when it acts surprisingly. The problem here is that the check that make sure that `impl use<'a, 'b>` lists all of the opaque's captured lifetimes wasn't smart enough to consider both these captured lifetimes and the original lifetimes they're duplicated from to be equal. This PR fixes that. r? oli-obk
2024-04-19Fix capturing duplicated lifetimes via parentMichael Goulet-7/+30
2024-04-19Rollup merge of #124106 - compiler-errors:tait-lifetime-dedup, r=oli-obkMatthias Krüger-6/+9
Don't repeatedly duplicate TAIT lifetimes for each subsequently nested TAIT Make it so that nested TAITs inherit the lifetimes from their parent item, not their parent TAIT. This is because we don't need to re-duplicate lifetimes for nested TAITs over and over, since the only lifetimes they can capture are from the parent item anyways. This mirrors how RPITs work. This is **not** a functional change that should be observable, since the whole point of duplicating lifetimes and marking the shadowed ones (and uncaptured ones) as bivariant is designed to *not* be observable. r? oli-obk
2024-04-18Rollup merge of #124047 - Jules-Bertholet:match-ergonomics-cleanups, r=NadrierilMatthias Krüger-2/+2
Match ergonomics 2024: miscellaneous code cleanups - Store `ByRef` instead of `BindingAnnotation` in `PatInfo` - Rename `BindingAnnotation` to `BindingMode` r? ``@Nadrieril`` cc #123076 ``@rustbot`` label A-patterns
2024-04-17Don't repeatedly duplicate TAIT lifetimes for each subsequently nested TAITMichael Goulet-6/+9
2024-04-17Auto merge of #123674 - oli-obk:bogus_note, r=estebankbors-2/+8
Silence some follow-up errors on trait impls in case the trait has conflicting or otherwise incoherent impls fixes #123292 Also removes a bunch of extra diagnostics that were introduced in https://github.com/rust-lang/rust/pull/121154 and https://github.com/rust-lang/rust/pull/120558
2024-04-17Rename `BindingAnnotation` to `BindingMode`Jules Bertholet-2/+2
2024-04-17consistency rename: language item -> lang itemRalf Jung-3/+3
2024-04-17Rollup merge of #123997 - compiler-errors:self-res, r=fmeaseMatthias Krüger-0/+11
Delay span bug when `Self` kw resolves to `DefKind::{Mod,Trait}` Catch the case where `kw::Self` is recovered in the parser and causes us to subsequently resolve `&self`'s implicit type to something that's not a type. This check could be made more accurate, though I'm not sure how hard we have to try here. Fixes #123988
2024-04-17Rollup merge of #122813 - nnethercote:nicer-quals, r=compiler-errorsMatthias Krüger-38/+21
Qualifier tweaking Adding and removing qualifiers in some cases that make things nicer. Details in individual commits. r? `@compiler-errors`
2024-04-16Prefer identity equality over equating types during coercion.Oli Scherer-22/+13
These types are always generic only over their own generic parameters with no inference variables involved.
2024-04-16Change intrinsic types to use `u32` instead of `T` to match stable reexportsMaybe Waffle-8/+6