about summary refs log tree commit diff
path: root/compiler/rustc_hir_analysis/src/collect
AgeCommit message (Collapse)AuthorLines
2024-04-15Validation and other thingsMichael Goulet-2/+11
2024-04-15Lower and resolve precise captures in HIRMichael Goulet-0/+25
2024-04-11Call lower_const_param instead of duplicating the codeSantiago Pastorino-0/+5
2024-04-09Actually, just reuse the UNUSED_LIFETIMES lintMichael Goulet-26/+0
2024-04-04cache type info for ParamEnvLukas Markeffsky-7/+4
2024-04-02Don't create an FnDef of a DefKind::Variant, use the ctor def idMichael Goulet-2/+2
2024-03-30Stop calling visitors VMichael Goulet-3/+5
2024-03-25Rollup merge of #122881 - Bryanskiy:delegation-fixes-2, r=petrochenkovMatthias Krüger-1/+9
Delegation: fix ICE on `bound_vars` divergence Fixes https://github.com/rust-lang/rust/issues/122550. Bug was caused by divergence between lowered type and corresponding `bound_vars` in `late_bound_vars_map`. In this patch `bound_vars` calculation for delegation item is moved from `lower_fn_ty` to `resolve_bound_vars` query. r? `@petrochenkov`
2024-03-22Split out ImplPolarity and PredicatePolarityMichael Goulet-2/+2
2024-03-22Delegation: fix ICE on `bound_vars` divergenceBryanskiy-1/+9
2024-03-22Rename module astconv to hir_ty_loweringLeón Orell Valerian Liehr-2/+2
Split from the main renaming commit to make git generate a proper diff for ease of reviewing.
2024-03-22Update local variables and tracing callsLeón Orell Valerian Liehr-20/+19
Most of the tracing calls didn't fully leverage the power of `tracing`. For example, several of them used to hard-code method names / tracing spans as well as variable names. Use `#[instrument]` and `?var` / `%var` (etc.) instead. In my opinion, this is the proper way to migrate them from the old AstConv nomenclature to the new HIR ty lowering one.
2024-03-22Update (doc) commentsLeón Orell Valerian Liehr-18/+19
Several (doc) comments were super outdated or didn't provide enough context. Some doc comments shoved everything in a single paragraph without respecting the fact that the first paragraph should be a single sentence because rustdoc treats these as item descriptions / synopses on module pages.
2024-03-22Rename AstConv to HIR ty loweringLeón Orell Valerian Liehr-37/+37
This includes updating astconv-related items and a few local variables.
2024-03-21Rollup merge of #122799 - estebank:issue-122569, r=fee1-deadMatthias Krüger-3/+3
Replace closures with `_` when suggesting fully qualified path for method call ``` error[E0283]: type annotations needed --> $DIR/into-inference-needs-type.rs:12:10 | LL | .into()?; | ^^^^ | = note: cannot satisfy `_: From<...>` = note: required for `FilterMap<...>` to implement `Into<_>` help: try using a fully qualified path to specify the expected types | LL ~ let list = <FilterMap<Map<std::slice::Iter<'_, &str>, _>, _> as Into<T>>::into(vec LL | .iter() LL | .map(|s| s.strip_prefix("t")) LL ~ .filter_map(Option::Some))?; | ``` Fix #122569.
2024-03-21Replace closures with `_` when suggesting fully qualified path for method callEsteban Küber-3/+3
``` error[E0283]: type annotations needed --> $DIR/into-inference-needs-type.rs:12:10 | LL | .into()?; | ^^^^ | = note: cannot satisfy `_: From<...>` = note: required for `FilterMap<...>` to implement `Into<_>` help: try using a fully qualified path to specify the expected types | LL ~ let list = <FilterMap<Map<std::slice::Iter<'_, &str>, _>, _> as Into<T>>::into(vec LL | .iter() LL | .map(|s| s.strip_prefix("t")) LL ~ .filter_map(Option::Some))?; | ``` Fix #122569.
2024-03-20Split item bounds and item super predicatesMichael Goulet-5/+49
2024-03-19Rollup merge of #122719 - oli-obk:nested_static_feed_hir, r=fee1-deadMatthias Krüger-1/+1
Ensure nested statics have a HIR node to prevent various queries from ICEing fixes https://github.com/rust-lang/miri/issues/3389
2024-03-19The AssocOpaqueTy HIR node is not actually needed to differentiate from ↵Oli Scherer-1/+1
other hir nodes that were fed
2024-03-18Use `hir::Node` helper methods instead of repeat the same impl multiple timesOli Scherer-89/+20
There already were inconsistencies, so this ensures we don't introduce subtle surprising bugs
2024-03-15Rollup merge of #122513 - petrochenkov:somehir4, r=fmeaseGuillaume Gomez-7/+4
hir: Remove `opt_local_def_id_to_hir_id` and `opt_hir_node_by_def_id` Also replace a few `hir_node()` calls with `hir_node_by_def_id()`. Follow up to https://github.com/rust-lang/rust/pull/120943.
2024-03-15Rollup merge of #122527 - fmease:clean-up-hir-ty-lowering, r=compiler-errorsMatthias Krüger-2/+1
Clean up AstConv Split off from #120926 to make it only contain the renaming & (doc) comment updates. Any changes other than that which have accumulated over time are now part of this PR. Let's be disciplined ;) Inspired by https://github.com/rust-lang/rust/pull/120926#issuecomment-1997984483. --- * Remove `hir_trait_to_predicates` * Unused since #113671 * Inline `create_args_for_ast_trait_ref` * Only had a single call site * Having it as a separate method didn't gain us anything * Use an if-let guard somewhere to avoid unwrapping * Avoid explicit trait object lifetimes * More legible, stylistic-only (the updated code is 100% semantically identical) * Use explicitly elided lifetimes in impl headers, they get elaborated to distinct lifetimes * Make use of [object lifetime defaulting](https://doc.rust-lang.org/reference/lifetime-elision.html#default-trait-object-lifetimes) for a trait object type inside of a reference type somewhere * Use preexisting dedicated method `ItemCtxt::to_ty` over `<dyn AstConv<'_>>::ast_ty_to_ty` * Use preexisting dedicated method `AstConv::astconv` over explicit coercions * Simplify the function signature of `create_args_for_ast_path` and of `check_generic_arg_count` * In both cases redundant information was passed rendering the call sites verbose and confusing * No perf impact (tested in [#120926](https://github.com/rust-lang/rust/pull/120926)) * Move diagnostic method `report_ambiguous_associated_type` from `astconv` to `astconv::errors` * The submodule `errors` exists specifically for that purpose * Use it to keep the main module clean & short
2024-03-15Clean up AstConvLeón Orell Valerian Liehr-2/+1
2024-03-14hir: Remove `opt_local_def_id_to_hir_id` and `opt_hir_node_by_def_id`Vadim Petrochenkov-7/+4
Also replace a few `hir_node()` calls with `hir_node_by_def_id()`
2024-03-14Auto merge of #120943 - petrochenkov:somehir3, r=oli-obkbors-0/+1
Create some minimal HIR for associated opaque types `LocalDefId`s for opaque types in traits and impls are created after AST -> HIR lowering, so they don't have corresponding HIR and return their various properties through fed queries. In this PR I also feed some core HIR-related queries for these `LocalDefId`s (which happen to be HIR owners). As a result all `LocalDefId`s now have corresponding `HirId`s and HIR nodes, and "optional" methods like `opt_local_def_id_to_hir_id` and `opt_hir_node_by_def_id` can be removed. Follow up to https://github.com/rust-lang/rust/pull/120206.
2024-03-13Create some minimal HIR for associated opaque typesVadim Petrochenkov-0/+1
2024-03-11Revert "Auto merge of #122140 - oli-obk:track_errors13, r=davidtwco"Oli Scherer-3/+5
This reverts commit 65cd843ae06ad00123c131a431ed5304e4cd577a, reversing changes made to d255c6a57c393db6221b1ff700daea478436f1cd.
2024-03-11Auto merge of #122338 - workingjubilee:rollup-xzpt4v4, r=workingjubileebors-31/+0
Rollup of 15 pull requests Successful merges: - #116791 (Allow codegen backends to opt-out of parallel codegen) - #116793 (Allow targets to override default codegen backend) - #117458 (LLVM Bitcode Linker: A self contained linker for nvptx and other targets) - #119385 (Fix type resolution of associated const equality bounds (take 2)) - #121438 (std support for wasm32 panic=unwind) - #121893 (Add tests (and a bit of cleanup) for interior mut handling in promotion and const-checking) - #122080 (Clarity improvements to `DropTree`) - #122152 (Improve diagnostics for parenthesized type arguments) - #122166 (Remove the unused `field_remapping` field from `TypeLowering`) - #122249 (interpret: do not call machine read hooks during validation) - #122299 (Store backtrace for `must_produce_diag`) - #122318 (Revision-related tweaks for next-solver tests) - #122320 (Use ptradd for vtable indexing) - #122328 (unix_sigpipe: Replace `inherit` with `sig_dfl` in syntax tests) - #122330 (bootstrap readme: fix, improve, update) r? `@ghost` `@rustbot` modify labels: rollup
2024-03-11Rollup merge of #119385 - fmease:assoc-const-eq-fixes-2, r=oli-obk,cjgillotJubilee-31/+0
Fix type resolution of associated const equality bounds (take 2) Instead of trying to re-resolve the type of assoc const bindings inside the `type_of` query impl in an incomplete manner, transfer the already (correctly) resolved type from `add_predicates_for_ast_type_binding` to `type_of`/`anon_type_of` through query feeding. --- Together with #118668 (merged) and #121258, this supersedes #118360. Fixes #118040. r? ``@ghost``
2024-03-11Never bail out early while running all the type check queriesOli Scherer-5/+3
2024-03-08Rollup merge of #122100 - compiler-errors:better-capture, r=oli-obkMatthias Krüger-28/+40
Better comment for implicit captures in RPITIT Improve the error message for implicit captures. Also always set E0657. r? oli-obk
2024-03-08Improve error message for opaque capturesMichael Goulet-28/+40
2024-03-08Rollup merge of #121563 - Jarcho:use_cf, r=petrochenkovMatthias Krüger-22/+16
Use `ControlFlow` in visitors. Follow up to #121256 This does have a few small behaviour changes in some diagnostic output where the visitor will now find the first match rather than the last match. The change in `find_anon_types.rs` has the only affected test. I don't see this being an issue as the last occurrence isn't any better of a choice than the first.
2024-03-08Rename some functions to represent their generalized behaviorMichael Goulet-1/+1
2024-03-08Make TAITs capture all higher-ranked lifetimes in scopeMichael Goulet-53/+7
2024-03-06Rollup merge of #122027 - compiler-errors:rpitit-cycle, r=spastorinoMatthias Krüger-15/+61
Uplift some feeding out of `associated_type_for_impl_trait_in_impl` and into queries This PR moves the `type_of` and `generics_of` query feeding out of `associated_type_for_impl_trait_in_impl`, since eagerly feeding results in query cycles due to a subtle interaction with `resolve_bound_vars`. Fixes #122019 r? spastorino
2024-03-05Use `ControlFlow` in HIR visitorsJason Newcomb-22/+16
2024-03-06Auto merge of #122041 - matthiaskrgr:rollup-imsmdke, r=matthiaskrgrbors-20/+8
Rollup of 8 pull requests Successful merges: - #121202 (Limit the number of names and values in check-cfg diagnostics) - #121301 (errors: share `SilentEmitter` between rustc and rustfmt) - #121658 (Hint user to update nightly on ICEs produced from outdated nightly) - #121846 (only compare ambiguity item that have hard error) - #121961 (add test for #78894 #71450) - #121975 (hir_analysis: enums return `None` in `find_field`) - #121978 (Fix duplicated path in the "not found dylib" error) - #121991 (Merge impl_trait_in_assoc_types_defined_by query back into `opaque_types_defined_by`) r? `@ghost` `@rustbot` modify labels: rollup
2024-03-05Convert `TypeVisitor` and `DefIdVisitor` to use `VisitorResult`Jason Newcomb-9/+4
2024-03-05Move visitor utils to `rustc_ast_ir`Jason Newcomb-1/+1
2024-03-05Merge `impl_trait_in_assoc_types_defined_by` query back into ↵Oli Scherer-20/+8
`opaque_types_defined_by` Instead, when we're collecting opaques for associated items, we choose the right collection mode depending on whether we're collecting for an associated item of a trait impl or not.
2024-03-05Uplift some feeding out of associated_type_for_impl_trait_in_impl and into ↵Michael Goulet-15/+61
queries
2024-03-03Add a proper `with_no_queries` to printingJohn Kåre Alsaker-1/+1
2024-02-29Overhaul how stashed diagnostics work, again.Nicholas Nethercote-13/+9
Stashed errors used to be counted as errors, but could then be cancelled, leading to `ErrorGuaranteed` soundness holes. #120828 changed that, closing the soundness hole. But it introduced other difficulties because you sometimes have to account for pending stashed errors when making decisions about whether errors have occured/will occur and it's easy to overlook these. This commit aims for a middle ground. - Stashed errors (not warnings) are counted immediately as emitted errors, avoiding the possibility of forgetting to consider them. - The ability to cancel (or downgrade) stashed errors is eliminated, by disallowing the use of `steal_diagnostic` with errors, and introducing the more restrictive methods `try_steal_{modify,replace}_and_emit_err` that can be used instead. Other things: - `DiagnosticBuilder::stash` and `DiagCtxt::stash_diagnostic` now both return `Option<ErrorGuaranteed>`, which enables the removal of two `delayed_bug` calls and one `Ty::new_error_with_message` call. This is possible because we store error guarantees in `DiagCtxt::stashed_diagnostics`. - Storing the guarantees also saves us having to maintain a counter. - Calls to the `stashed_err_count` method are no longer necessary alongside calls to `has_errors`, which is a nice simplification, and eliminates two more `span_delayed_bug` calls and one FIXME comment. - Tests are added for three of the four fixed PRs mentioned below. - `issue-121108.rs`'s output improved slightly, omitting a non-useful error message. Fixes #121451. Fixes #121477. Fixes #121504. Fixes #121508.
2024-02-28Rename `DiagnosticBuilder` as `Diag`.Nicholas Nethercote-7/+6
Much better! Note that this involves renaming (and updating the value of) `DIAGNOSTIC_BUILDER` in clippy.
2024-02-26Revert some `span_bug`s to `span_delayed_bug`.Nicholas Nethercote-1/+1
Fixes #121503. Fixes #121597.
2024-02-25Rollup merge of #121409 - compiler-errors:atb-cycle, r=cjgillotMatthias Krüger-8/+22
Prevent cycle in implied predicates computation Makes #65913 from hang -> fail. I believe fail is the correct state for this test to remain for the long term.
2024-02-23Rollup merge of #121434 - nnethercote:fix-121208-fallout, r=lcnrMatthias Krüger-1/+1
Fix #121208 fallout #121208 converted lots of delayed bugs to bugs. Unsurprisingly, there were a few invalid conversion found via fuzzing. r? `@lcnr`
2024-02-23Revert some `span_bug`s to `span_delayed_bug`.Nicholas Nethercote-1/+1
Fixes #121410. Fixes #121414. Fixes #121418. Fixes #121431.
2024-02-22Rollup merge of #121386 - oli-obk:no_higher_ranked_opaques, r=lcnrMatthias Krüger-18/+25
test that we do not support higher-ranked regions in opaque type inference We already do all the right checks in `check_opaque_type_parameter_valid`, and we have done so since at least 2 years. I collected the tests from https://github.com/rust-lang/rust/pull/116935 and https://github.com/rust-lang/rust/pull/100503 and added some more cc https://github.com/rust-lang/rust/issues/96146 r? `@lcnr`