Conversation
This was a nasty issue to debug, the issue was very eager type bounds checking. So for example: pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> The super trait of PartialEq<Rhs> is a generic substitution and we reuse our bounds code here for normal generic bounds and generics an invalid bounds check was occuring when PartialEq<Rhs> was getting substituted becase this is a trait doing proper bounds checking is not valid here because this is telling us about the bounds in this case. Fixes #3836 gcc/rust/ChangeLog: * typecheck/rust-hir-trait-resolve.cc (TraitResolver::resolve_trait): track is super trait * typecheck/rust-hir-type-bounds.h: refactor bounds scan * typecheck/rust-hir-type-check-base.h: track from super trait * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): likewise * typecheck/rust-tyty-bounds.cc (TypeBoundsProbe::is_bound_satisfied_for_type): refactor (TypeBoundsProbe::scan): likewise (TypeBoundPredicate::apply_generic_arguments): likewise * typecheck/rust-tyty-subst.cc: optional bounds checking on parm subst * typecheck/rust-tyty-subst.h: likewise * typecheck/rust-tyty.h: likewise gcc/testsuite/ChangeLog: * rust/compile/derive_partial_ord1.rs: this is now fully supported * rust/execute/torture/basic_partial_ord1.rs: add missing i32 impl * rust/execute/torture/basic_partial_ord2.rs: likewise * rust/compile/issue-3836.rs: New test. * rust/execute/torture/issue-3836.rs: New test. * rust/execute/torture/partial-ord-6.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.
This was a nasty issue to debug, the issue was very eager type bounds checking. So for example:
pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq
The super trait of PartialEq is a generic substitution and we reuse our bounds code here for normal generic bounds and generics an invalid bounds check was occuring when PartialEq was getting substituted becase this is a trait doing proper bounds checking is not valid here because this is telling us about the bounds in this case.
Fixes #3836
gcc/rust/ChangeLog:
gcc/testsuite/ChangeLog: