gccrs: Fix handling where clauses into two passes - #4875
Merged
Conversation
Where constraints are annoying so we need to do it in two passes. 1. Register bounds on the regular single segment TypePaths so like P: Deref 2. Then register regular type bindings like I::Item or Item = U::Item As they can be order dependant as the initial predicate needs added to then param decls then onto whatever projections after. Fixes #4864 gcc/rust/ChangeLog: * hir/tree/rust-hir-item.h: missing non const helper. * typecheck/rust-hir-type-check-base.h: new defer_bindings. * typecheck/rust-hir-type-check-implitem.cc (TypeCheckTopLevelExternItem::visit): new helper (TypeCheckImplItem::resolve_function_signature): Likewise. (TypeCheckImplItem::visit): Likewise. * typecheck/rust-hir-type-check-item.cc (TypeCheckItem::visit): Likewise. (TypeCheckItem::resolve_function_signature): Likewise. (TypeCheckItem::resolve_impl_block_substitutions): Likewise. * typecheck/rust-hir-type-check-type.cc (ResolveWhereClauseItem::Resolve): new helper (ResolveWhereClauseItem::visit): support defer. * typecheck/rust-hir-type-check-type.h: update header. * typecheck/rust-hir-type-check.cc (TraitItemReference::get_type_from_fn): call new helper * typecheck/rust-tyty-bounds.cc: defer flag gcc/testsuite/ChangeLog: * rust/compile/issue-4864.rs: New test. Signed-off-by: Philip Herron <herron.philip@googlemail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Where constraints are annoying so we need to do it in two passes.
As they can be order dependant as the initial predicate needs added to then param decls then onto whatever projections after.
Fixes #4864
gcc/rust/ChangeLog:
gcc/testsuite/ChangeLog: