about summary refs log tree commit diff
path: root/compiler/rustc_hir_analysis/src
AgeCommit message (Collapse)AuthorLines
2023-09-26Don't store lazyness in DefKindMichael Goulet-36/+42
2023-09-26Auto merge of #116072 - compiler-errors:rpitit-implied-bounds, r=aliemjaybors-8/+88
Use placeholders to prevent using inferred RPITIT types to imply their own well-formedness The issue here is that we use the same signature to do RPITIT inference as we do to compute implied bounds. To fix this, when gathering the assumed wf types for the method, we replace all of the infer vars (that will be eventually used to infer RPITIT types) with type placeholders, which imply nothing about lifetime bounds. This solution kind of sucks, but I'm not certain there's another feasible way to fix this. If anyone has a better solution, I'd be glad to hear it. My naive first solution was, instead of using placeholders, to replace the signature with the RPITIT projections that it originally started out with. But turns out that we can't just use the unnormalized signature of the trait method in `implied_outlives_bounds` since we normalize during WF computation -- that would cause a query cycle in `collect_return_position_impl_trait_in_trait_tys`. idk who to request review... r? `@lcnr` or `@aliemjay` i guess. Fixes #116060
2023-09-24Added additional visit steps to visit_generic_param() in order to avoid ICE ↵Lenko Donchev-16/+15
on no bound vars.
2023-09-24Remove span from BrAnon.Camille GILLOT-6/+6
2023-09-24Rollup merge of #116073 - compiler-errors:poly-sigs, r=b-naberMatthias Krüger-8/+8
Allow higher-ranked fn sigs in `ValuePairs` For better bookkeeping -- only affects diagnostic path. Allow reporting signature mismatches like "signature"s and not "fn pointer"s. Improves https://github.com/rust-lang/rust/pull/115897#discussion_r1331940846
2023-09-23Remove GeneratorWitness and rename GeneratorWitnessMIR.Camille GILLOT-7/+1
2023-09-23Enable drop_tracking_mir by default.Camille GILLOT-8/+1
2023-09-23Auto merge of #116081 - compiler-errors:closure-captures-sized, r=cjgillotbors-1/+20
Check that closure/generator's interior/capture types are sized check that closure upvars and generator interiors are sized. this check is only necessary when `unsized_fn_params` or `unsized_locals` is enabled, so only check if those are active. Fixes #93622 Fixes #61335 Fixes #68543
2023-09-23Auto merge of #116045 - notriddle:notriddle/issue-83556, r=cjgillotbors-3/+19
diagnostics: avoid mismatch between variance index and hir generic This happens because variances are constructed from ty generics, and ty generics are always constructed with lifetimes first. https://github.com/rust-lang/rust/blob/b3aa8e7168a3d940122db3561289ffbf3f587262/compiler/rustc_hir_analysis/src/collect/generics_of.rs#L248-L269 Fixes #83556
2023-09-22diagnostics: simpler 83556 handling by bailing outMichael Howell-8/+3
2023-09-23Check types live across yields in generators tooMichael Goulet-1/+20
2023-09-22Allow higher-ranked fn sigs in ValuePairsMichael Goulet-8/+8
2023-09-22Need to use hybrid param-env to make sure implication is not circularMichael Goulet-2/+13
2023-09-22Use placeholders to prevent using inferred RPITIT types to imply their own ↵Michael Goulet-6/+75
WF-ness
2023-09-22Rollup merge of #116039 - estebank:nested-tait, r=compiler-errorsMatthias Krüger-2/+7
Account for nested `impl Trait` in TAIT Fix #116031. r? `@compiler-errors`
2023-09-21diagnostics: avoid mismatch between variance index and hir genericMichael Howell-3/+24
This happens because variances are constructed from ty generics, and ty generics are always constructed with lifetimes first. See compiler/rustc_hir_analysis/src/collect/generics_of.rs:248-269 Fixes #83556
2023-09-21Auto merge of #115897 - eduardosm:check-fn-sig, r=compiler-errorsbors-64/+117
rustc_hir_analysis: add a helper to check function the signature mismatches This function is now used to check `#[panic_handler]`, `start` lang item, `main`, `#[start]` and intrinsic functions. The diagnosis produced are now closer to the ones produced by trait/impl method signature mismatch. This is the first time I do anything with rustc_hir_analysis/rustc_hir_typeck, so comments and suggestions about things I did wrong or that could be improved will be appreciated.
2023-09-21Record asyncness span in HIRMichael Goulet-4/+4
2023-09-21Account for nested `impl Trait` in TAITEsteban Küber-2/+7
Fix #116031.
2023-09-20Rollup merge of #115566 - ↵Guillaume Gomez-5/+5
zirconium-n:issue-107250-clean-up-unused-to-predicate, r=oli-obk clean up unneeded `ToPredicate` impls Part of #107250. Removed all totally unused impls. And inlined two impls not need to satisify trait bound. r? `@oli-obk`
2023-09-20Migrate `rustc_hir_analysis` to session diagnosticObei Sideg-122/+202
Part 5: Finishing `coherence/builtin.rs` file
2023-09-20Auto merge of #115486 - compiler-errors:dont-capture-late-pls, r=cjgillotbors-26/+65
Correctly deny late-bound lifetimes from parent in anon consts and TAITs Reuse the `AnonConstBoundary` scope (introduced in #108553, renamed in this PR to `LateBoundary`) to deny late-bound vars of *all* kinds (ty/const/lifetime) in anon consts and TAITs. Side-note, but I would like to consolidate this with the error reporting for RPITs (E0657): https://github.com/rust-lang/rust/blob/c4f25777a08cd64b710e8a9a6159e67cbb35e6f5/compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs#L733-L754 but the semantics about what we're allowed to capture there are slightly different, so I'm leaving that untouched. Fixes #115474
2023-09-20remove `impl<'tcx> ToPredicate<'tcx, Clause<'tcx>> for ↵Ziru Niu-5/+5
PolyProjectionPredicate<'tcx>`
2023-09-19wrap fn sig binders in fn ptrEduardo Sánchez Muñoz-10/+7
2023-09-19rustc_hir_analysis: add a helper to check function the signature mismatchesEduardo Sánchez Muñoz-64/+120
This function is now used to check `#[panic_handler]`, `start` lang item, `main`, `#[start]` and intrinsic functions. The diagnosis produced are now closer to the ones produced by trait/impl method signature mismatch.
2023-09-19Don't complain on a single non-exhaustive 1-zstMichael Goulet-19/+29
2023-09-18Prototype using const generic for simd_shuffle IDX arrayOli Scherer-21/+23
2023-09-17Auto merge of #115334 - RalfJung:transparent-aligned-zst, r=compiler-errorsbors-37/+21
repr(transparent): it's fine if the one non-1-ZST field is a ZST This code currently gets rejected: ```rust #[repr(transparent)] struct MyType([u16; 0]) ``` That clearly seems like a bug to me: `repr(transparent)` [got defined ](https://github.com/rust-lang/rust/issues/77841#issuecomment-716575747) as having any number of 1-ZST fields plus optionally one more field; `MyType` clearly satisfies that definition. This PR changes the `repr(transparent)` logic to actually match that definition.
2023-09-16Rollup merge of #115860 - Soveu:varargs2, r=WaffleLapkinMatthias Krüger-1/+1
Enable varargs support for AAPCS calling convention Welp, I was looking for a reason why this shouldn't be stabilized after so long... and here it is.
2023-09-15Auto merge of #115853 - obeis:hir-analysis-migrate-diagnostics-6, ↵bors-77/+88
r=compiler-errors Migrate `rustc_hir_analysis` to session diagnostic [Part 6] Part 6: Finish `coherence/inherent_impls.rs` file
2023-09-14Enable varargs support for AAPCS calling conventionSoveu-1/+1
This is the default calling convention for ARM - it is used for extern "C", therefore it supports varargs.
2023-09-14Auto merge of #115677 - matthewjasper:let-expr-recovery, r=b-naberbors-1/+5
Improve invalid let expression handling - Move all of the checks for valid let expression positions to parsing. - Add a field to ExprKind::Let in AST/HIR to mark whether it's in a valid location. - Suppress some later errors and MIR construction for invalid let expressions. - Fix a (drop) scope issue that was also responsible for #104172. Fixes #104172 Fixes #104868
2023-09-14Migrate `rustc_hir_analysis` to session diagnosticObei Sideg-77/+88
Part 6: Finish `coherence/inherent_impls.rs`
2023-09-14Paper over an accidental regressionOli Scherer-1/+9
2023-09-12Auto merge of #115699 - RalfJung:interpret-abi-compat, r=oli-obkbors-0/+8
interpret: change ABI-compat test to be type-based This makes the test consistent across targets. Otherwise the chances are very high that ABI mismatches get accepted on x86_64 but still fail on many other targets with more complicated ABIs. This implements (most of) the rules described in https://github.com/rust-lang/rust/pull/115476.
2023-09-11Move let expression checking to parsingMatthew Jasper-1/+1
There was an incomplete version of the check in parsing and a second version in AST validation. This meant that some, but not all, invalid uses were allowed inside macros/disabled cfgs. It also means that later passes have a hard time knowing when the let expression is in a valid location, sometimes causing ICEs. - Add a field to ExprKind::Let in AST/HIR to mark whether it's in a valid location. - Suppress later errors and MIR construction for invalid let expressions.
2023-09-11Don't create drop scopes after item statementsMatthew Jasper-1/+5
These scopes would not exist in MIR and can cause ICEs with invalid uses of let expressions.
2023-09-11Rollup merge of #115727 - fee1-dead-contrib:effect-fallback, r=oli-obkMatthias Krüger-3/+6
Implement fallback for effect param r? `@oli-obk` or `@lcnr` tracking issue for this ongoing work: https://github.com/rust-lang/rust/issues/110395
2023-09-11add `is_host_effect` to `GenericParamDefKind::Const` and address reviewDeadbeef-3/+6
2023-09-11explain why DispatchFromDyn does the check it doesRalf Jung-0/+8
2023-09-08E0220: only suggests associated types if there's only one candidateLieselotte-25/+19
2023-09-08Improve "associated type not found" diagnosticsLieselotte-11/+42
2023-09-08Stabilize impl_trait_projectionsMichael Goulet-132/+3
2023-09-07Add noteMichael Goulet-0/+1
2023-09-07Don't emit refining_impl_trait for private itemsMichael Goulet-0/+28
2023-09-07Use self instead of the actual self tyMichael Goulet-3/+15
2023-09-07Implement refinement lint for RPITITMichael Goulet-0/+294
2023-09-06Auto merge of #115401 - Zoxc:freeze, r=oli-obkbors-0/+4
Add `FreezeLock` type and use it to store `Definitions` This adds a `FreezeLock` type which allows mutation using a lock until the value is frozen where it can be accessed lock-free. It's used to store `Definitions` in `Untracked` instead of a `RwLock`. Unlike the current scheme of leaking read guards this doesn't deadlock if definitions is written to after no mutation are expected.
2023-09-05Correctly deny late-bound lifetimes from parent in anon consts and TAITsMichael Goulet-26/+65
2023-09-02Freeze `Definitions` earlierJohn Kåre Alsaker-0/+4