about summary refs log tree commit diff
path: root/compiler/rustc_hir_analysis/src
AgeCommit message (Collapse)AuthorLines
2024-09-12Implement a Method to Seal `DiagInner`'s SuggestionsVeera-2/+2
2024-09-12Rollup merge of #130250 - compiler-errors:useless-conversion, r=jieyouxuStuart Cook-2/+2
Fix `clippy::useless_conversion` Self-explanatory. Probably the last clippy change I'll actually put up since this is the only other one I've actually seen in the wild.
2024-09-12Rollup merge of #130235 - compiler-errors:nested-if, r=michaelwoeristerStuart Cook-83/+71
Simplify some nested `if` statements Applies some but not all instances of `clippy::collapsible_if`. Some ended up looking worse afterwards, though, so I left those out. Also applies instances of `clippy::collapsible_else_if` Review with whitespace disabled please.
2024-09-11Rollup merge of #130114 - eduardosm:needless-returns, r=compiler-errorsJubilee-2/+2
Remove needless returns detected by clippy in the compiler
2024-09-11clippy::useless_conversionMichael Goulet-2/+2
2024-09-11Also fix if in elseMichael Goulet-54/+48
2024-09-11Simplify some nested if statementsMichael Goulet-29/+23
2024-09-10Auto merge of #129403 - scottmcm:only-array-simd, r=compiler-errorsbors-20/+22
Ban non-array SIMD Nearing the end of https://github.com/rust-lang/compiler-team/issues/621 ! Currently blocked on ~~https://github.com/rust-lang/compiler-builtins/pull/673~~ ~~https://github.com/rust-lang/compiler-builtins/pull/674~~ ~~https://github.com/rust-lang/rust/pull/129400~~ ~~https://github.com/rust-lang/rust/pull/129481~~ for windows.
2024-09-11rescope temp lifetime in let-chain into IfElseDing Xiang Fei-2/+12
apply rules by span edition
2024-09-09Ban non-array SIMDScott McMurray-20/+22
2024-09-09Rollup merge of #130149 - GrigorenkoPV:lifetime-suggestion, r=cjgillotJubilee-17/+1
Helper function for formatting with `LifetimeSuggestionPosition`
2024-09-09Rollup merge of #130064 - folkertdev:fix-issue-129983, r=compiler-errorsMatthias Krüger-3/+9
fix ICE in CMSE type validation fixes #129983 tracking issue: https://github.com/rust-lang/rust/issues/81391 r? ``@compiler-errors``
2024-09-09Helper function for formatting with `LifetimeSuggestionPosition`Pavel Grigorenko-17/+1
2024-09-09Remove needless returns detected by clippy in the compilerEduardo Sánchez Muñoz-2/+2
2024-09-09do `PolyFnSig` -> `FnSig` conversion laterFolkert de Vries-5/+8
2024-09-08Auto merge of #130036 - weiznich:diagnostic_unstable_tracking, r=compiler-errorsbors-2/+0
Correctly handle stability of `#[diagnostic]` attributes This commit changes the way we treat the stability of attributes in the `#[diagnostic]` namespace. Instead of relaying on ad-hoc checks to ensure at call side that a certain attribute is really usable at that location it centralises the logic to one place. For diagnostic attributes comming from other crates it just skips serializing attributes that are not stable and that do not have the corresponding feature enabled. For attributes from the current crate we can just use the feature information provided by `TyCtx`. r​? `@compiler-errors`
2024-09-07Auto merge of #126161 - Bryanskiy:delegation-generics-4, r=petrochenkovbors-120/+357
Delegation: support generics in associated delegation items This is a continuation of https://github.com/rust-lang/rust/pull/125929. [design](https://github.com/Bryanskiy/posts/blob/master/delegation%20in%20generic%20contexts.md) Generic parameters inheritance was implemented in all contexts. Generic arguments are not yet supported. r? `@petrochenkov`
2024-09-07fix ICE in CMSE type validationFolkert de Vries-5/+8
2024-09-06Auto merge of #128776 - Bryanskiy:deep-reject-ctxt, r=lcnrbors-2/+3
Use `DeepRejectCtxt` to quickly reject `ParamEnv` candidates The description is on the [zulip thread](https://rust-lang.zulipchat.com/#narrow/stream/144729-t-types/topic/.5Basking.20for.20help.5D.20.60DeepRejectCtxt.60.20for.20param.20env.20candidates) r? `@lcnr`
2024-09-06Revert ed7bdbb17b9c03fe3530e5e3f21b7c6c7879dbcaGeorg Semmler-2/+0
2024-09-05Delegation: support generics in associated delegation itemsBryanskiy-71/+204
2024-09-05Rollup merge of #129664 - ↵Matthias Krüger-19/+63
adetaylor:arbitrary-self-types-pointers-feature-gate, r=wesleywiser Arbitrary self types v2: pointers feature gate. The main `arbitrary_self_types` feature gate will shortly be reused for a new version of arbitrary self types which we are amending per [this RFC](https://github.com/rust-lang/rfcs/blob/master/text/3519-arbitrary-self-types-v2.md). The main amendments are: * _do_ support `self` types which can't safely implement `Deref` * do _not_ support generic `self` types * do _not_ support raw pointers as `self` types. This PR relates to the last of those bullet points: this strips pointer support from the current `arbitrary_self_types` feature. We expect this to cause some amount of breakage for crates using this unstable feature to allow raw pointer self types. If that's the case, we want to know about it, and we want crate authors to know of the upcoming changes. For now, this can be resolved by adding the new `arbitrary_self_types_pointers` feature to such crates. If we determine that use of raw pointers as self types is common, then we may maintain that as an unstable feature even if we come to stabilize the rest of the `arbitrary_self_types` support in future. If we don't hear that this PR is causing breakage, then perhaps we don't need it at all, even behind an unstable feature gate. [Tracking issue](https://github.com/rust-lang/rust/issues/44874) This is [step 4 of the plan outlined here](https://github.com/rust-lang/rust/issues/44874#issuecomment-2122179688)
2024-09-03Rollup merge of #127692 - veera-sivarajan:bugfix-125139, r=estebankMatthias Krüger-23/+55
Suggest `impl Trait` for References to Bare Trait in Function Header Fixes #125139 This PR suggests `impl Trait` when `&Trait` is found as a function parameter type or return type. This makes use of existing diagnostics by adding `peel_refs()` when checking for type equality. Additionaly, it makes a few other improvements: 1. Checks if functions inside impl blocks have bare trait in their headers. 2. Introduces a trait `NextLifetimeParamName` similar to the existing `NextTypeParamName` for suggesting a lifetime name. Also, abstracts out the common logic between the two trait impls. ### Related Issues I ran into a bunch of related diagnostic issues but couldn't fix them within the scope of this PR. So, I have created the following issues: 1. [Misleading Suggestion when Returning a Reference to a Bare Trait from a Function](https://github.com/rust-lang/rust/issues/127689) 2. [Verbose Error When a Function Takes a Bare Trait as Parameter](https://github.com/rust-lang/rust/issues/127690) 3. [Incorrect Suggestion when Returning a Bare Trait from a Function](https://github.com/rust-lang/rust/issues/127691) r​? ```@estebank``` since you implemented #119148
2024-09-03Delegation refactoring: add builders for generics inheritanceBryanskiy-80/+184
2024-09-02Use `DeepRejectCtxt` to quickly reject `ParamEnv` candidatesBryanskiy-2/+3
2024-09-02chore: Fix typos in 'compiler' (batch 1)Alexander Cyon-6/+6
2024-08-31Rollup merge of #129767 - nnethercote:rm-extern-crate-tracing-4, r=jieyouxuMatthias Krüger-3/+31
Remove `#[macro_use] extern crate tracing`, round 4 Because explicit importing of macros via use items is nicer (more standard and readable) than implicit importing via #[macro_use]. Continuing the work from #124511, #124914, and #125434. After this PR no `rustc_*` crates use `#[macro_use] extern crate tracing` except for `rustc_codegen_gcc` which is a special case and I will do separately. r? ```@jieyouxu```
2024-08-30Some code review suggestions.Adrian Taylor-20/+18
2024-08-30Remove `#[macro_use] extern crate tracing` from `rustc_hir_analysis`.Nicholas Nethercote-3/+31
2024-08-29Stop using ty::GenericPredicates for non-predicates_of queriesMichael Goulet-35/+34
2024-08-28Auto merge of #129546 - compiler-errors:no-pred-on, r=fee1-deadbors-34/+22
Get rid of `predicates_defined_on` This is the uncontroversial part of #129532. This simply inlines the `predicates_defined_on` into into `predicates_of`. Nothing should change here logically.
2024-08-27Auto merge of #128506 - compiler-errors:by-move-body, r=cjgillotbors-5/+2
Stop storing a special inner body for the coroutine by-move body for async closures ...and instead, just synthesize an item which is treated mostly normally by the MIR pipeline. This PR does a few things: * We synthesize a new `DefId` for the by-move body of a closure, which has its `mir_built` fed with the output of the `ByMoveBody` MIR transformation, and some other relevant queries. * This has the `DefKind::ByMoveBody`, which we use to distinguish it from "real" bodies (that come from HIR) which need to be borrowck'd. Introduce `TyCtxt::is_synthetic_mir` to skip over `mir_borrowck` which is called by `mir_promoted`; borrowck isn't really possible to make work ATM since it heavily relies being called on a body generated from HIR, and is redundant by the construction of the by-move-body. * Remove the special `PassManager` hacks for handling the inner `by_move_body` stored within the coroutine's mir body. Instead, this body is fed like a regular MIR body, so it's goes through all of the `tcx.*_mir` stages normally (build -> promoted -> ...etc... -> optimized) ✨. * Remove the `InstanceKind::ByMoveBody` shim, since now we have a "regular" def id, we can just use `InstanceKind::Item`. This also allows us to remove the corresponding hacks from codegen, such as in `fn_sig_for_fn_abi` ✨. Notable remarks: * ~~I know it's kind of weird to be using `DefKind::Closure` here, since it's not a distinct closure but just a new MIR body. I don't believe it really matters, but I could also use a different `DefKind`... maybe one that we could use for synthetic MIR bodies in general?~~ edit: We're doing this now.
2024-08-27Arbitrary self types v2: pointers feature gate.Adrian Taylor-19/+65
The main `arbitrary_self_types` feature gate will shortly be reused for a new version of arbitrary self types which we are amending per [this RFC](https://github.com/rust-lang/rfcs/blob/master/text/3519-arbitrary-self-types-v2.md). The main amendments are: * _do_ support `self` types which can't safely implement `Deref` * do _not_ support generic `self` types * do _not_ support raw pointers as `self` types. This PR relates to the last of those bullet points: this strips pointer support from the current `arbitrary_self_types` feature. We expect this to cause some amount of breakage for crates using this unstable feature to allow raw pointer self types. If that's the case, we want to know about it, and we want crate authors to know of the upcoming changes. For now, this can be resolved by adding the new `arbitrary_self_types_pointers` feature to such crates. If we determine that use of raw pointers as self types is common, then we may maintain that as an unstable feature even if we come to stabilize the rest of the `arbitrary_self_types` support in future. If we don't hear that this PR is causing breakage, then perhaps we don't need it at all, even behind an unstable feature gate. [Tracking issue](https://github.com/rust-lang/rust/issues/44874) This is [step 4 of the plan outlined here](https://github.com/rust-lang/rust/issues/44874#issuecomment-2122179688)
2024-08-27Add `warn(unreachable_pub)` to `rustc_hir_analysis`.Nicholas Nethercote-145/+155
2024-08-26Stop using a special inner body for the coroutine by-move body for async ↵Michael Goulet-5/+2
closures
2024-08-26Rollup merge of #129590 - compiler-errors:ref-tykind, r=fmeaseMatthias Krüger-2/+2
Avoid taking reference of &TyKind It's already a ref anyways. Just a tiny cleanup here.
2024-08-26Rollup merge of #129519 - compiler-errors:lowering-flags, r=fmeaseMatthias Krüger-43/+45
Remove redundant flags from `lower_ty_common` that can be inferred from the HIR ...and then get rid of `lower_ty_common`. r? ``@fmease`` or re-roll if you're busy!
2024-08-25Remove redundant flags that can be inferred from the HIRMichael Goulet-28/+21
2024-08-25Avoid taking reference of &TyKindMichael Goulet-2/+2
2024-08-25Rollup merge of #129487 - ↵Matthias Krüger-1/+2
GrigorenkoPV:repr_transparent_external_private_fields, r=compiler-errors repr_transparent_external_private_fields: special-case some std types Fixes #129470 ```@rustbot``` label +A-lint +L-repr_transparent_external_private_fields
2024-08-25Auto merge of #129521 - matthiaskrgr:rollup-uigv77m, r=matthiaskrgrbors-1/+1
Rollup of 9 pull requests Successful merges: - #128596 (stabilize const_fn_floating_point_arithmetic) - #129199 (make writes_through_immutable_pointer a hard error) - #129246 (Retroactively feature gate `ConstArgKind::Path`) - #129290 (Pin `cc` to 1.0.105) - #129323 (Implement `ptr::fn_addr_eq`) - #129500 (remove invalid `TyCompat` relation for effects) - #129501 (panicking: improve hint for Miri's RUST_BACKTRACE behavior) - #129505 (interpret: ImmTy: tighten sanity checks in offset logic) - #129510 (Fix `elided_named_lifetimes` in code) r? `@ghost` `@rustbot` modify labels: rollup
2024-08-24Rollup merge of #129429 - cjgillot:named-variance, r=compiler-errorsTrevor Gross-8/+24
Print the generic parameter along with the variance in dumps. This allows to make sure we are testing what we think we are testing. While the tests are correct, I discovered that opaque duplicated args are in the reverse declaration order.
2024-08-24Get rid of predicates_defined_onMichael Goulet-34/+22
2024-08-24repr_transparent_external_private_fields: treat `rustc_pub_transparent` ↵Pavel Grigorenko-1/+2
types as local
2024-08-24Rework how we emit errors for unresolved object lifetimesMichael Goulet-16/+25
2024-08-24Fix `elided_named_lifetimes` in codePavel Grigorenko-1/+1
2024-08-23Print the generic parameter along with the variance in dumps.Camille GILLOT-8/+24
2024-08-23Rollup merge of #129417 - compiler-errors:refine-err, r=lqdMatthias Krüger-1/+6
Don't trigger refinement lint if predicates reference errors Fixes #129404
2024-08-23Rollup merge of #129386 - cjgillot:local-resolved-arg, r=compiler-errorsMatthias Krüger-29/+31
Use a LocalDefId in ResolvedArg.
2024-08-22Don't trigger refinement lint if predicates reference errorsMichael Goulet-1/+6