about summary refs log tree commit diff
path: root/compiler/rustc_hir_analysis
AgeCommit message (Collapse)AuthorLines
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-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
2024-04-16Auto merge of #123468 - compiler-errors:precise-capturing, r=oli-obkbors-2/+261
Implement syntax for `impl Trait` to specify its captures explicitly (`feature(precise_capturing)`) Implements `impl use<'a, 'b, T, U> Sized` syntax that allows users to explicitly list the captured parameters for an opaque, rather than inferring it from the opaque's bounds (or capturing *all* lifetimes under 2024-edition capture rules). This allows us to exclude some implicit captures, so this syntax may be used as a migration strategy for changes due to #117587. We represent this list of captured params as `PreciseCapturingArg` in AST and HIR, resolving them between `rustc_resolve` and `resolve_bound_vars`. Later on, we validate that the opaques only capture the parameters in this list. We artificially limit the feature to *require* mentioning all type and const parameters, since we don't currently have support for non-lifetime bivariant generics. This can be relaxed in the future. We also may need to limit this to require naming *all* lifetime parameters for RPITIT, since GATs have no variance. I have to investigate this. This can also be relaxed in the future. r? `@oli-obk` Tracking issue: - https://github.com/rust-lang/rust/issues/123432
2024-04-16Avoid lots of `hir::HirId{,Map,Set}` qualifiers.Nicholas Nethercote-37/+20
Because they're a bit redundant.
2024-04-16Avoid unnecessary `rustc_span::DUMMY_SP` usage.Nicholas Nethercote-1/+1
In some cases `DUMMY_SP` is already imported. In other cases this commit adds the necessary import, in files where `DUMMY_SP` is used more than once.
2024-04-16Emit suggestions when equality constraints are wrongly usedGurinder Singh-11/+114
2024-04-15Delay span bug when Self resolves to DefKind::{Mod,Trait}Michael Goulet-0/+11
2024-04-15redundant ::{self}Michael Goulet-1/+1
2024-04-15Do check_coroutine_obligations once per typeck rootMichael Goulet-36/+11
2024-04-15Rename coroutine_stalled_predicatesMichael Goulet-3/+3
2024-04-16Rollup merge of #123926 - compiler-errors:no-ann, r=estebankLeón Orell Valerian Liehr-4/+4
Fix pretty HIR for anon consts in diagnostics This removes the `NoAnn` printer which skips over nested bodies altogether, which is confusing, and requires users of `{ty|qpath|pat}_to_string` to pass in `&tcx` which now impleemnts `hir_pretty::PpAnn`. There's one case where this "regresses" by actually printing out the body of the anon const -- we could suppress that, but I don't expect people to actually get anon consts like that unless they're fuzzing, tbh. r? estebank
2024-04-16Rollup merge of #123016 - compiler-errors:no-type-var-origin, r=lcnrLeón Orell Valerian Liehr-5/+5
Remove `TypeVariableOriginKind` and `ConstVariableOriginKind` It's annoying to have to import `TypeVariableOriginKind` just to fill it with `MiscVariable` for almost every use. Every other usage other than `TypeParameterDefinition` wasn't even used -- I can see how it may have been useful once for debugging, but I do quite a lot of typeck debugging and I've never really needed it. So let's just remove it, and keep around the only useful thing which is the `DefId` of the param for `var_for_def`. This is based on #123006, which removed the special use of `TypeVariableOriginKind::OpaqueInference`, which I'm pretty sure I was the one that added. r? lcnr or re-roll to types
2024-04-15Fix pretty hir for anon consts in diagnosticsMichael Goulet-4/+4
2024-04-15Remove TypeVariableOriginKindMichael Goulet-5/+5
2024-04-15More polishingMichael Goulet-3/+11
2024-04-15Use a path instead of an ident (and stop manually resolving)Michael Goulet-3/+26
2024-04-15Some ordering and duplication checksMichael Goulet-15/+70
2024-04-15Add hir::Node::PreciseCapturingNonLifetimeArgMichael Goulet-3/+5
2024-04-15Validation and other thingsMichael Goulet-4/+150