gccrs: Remove more calls to the old TyTy::BaseType::can_eq interface#4034
Merged
Conversation
This old can_eq interface was an old method to try and check if types can match up by taking into account generics but its not maintained properly and we already have a new wrapper Resolver::types_compatable (type, type, locus, emit_errors) which just calls unify_site_and infer with commit false. There are only a few places left to update. One minor downside is that i need to remove const in some places because the unify interface is non const. Ideally we would want to avoid writing a seperate const unify anyway so i think this is not ideal but fine for us. gcc/rust/ChangeLog: * typecheck/rust-autoderef.cc: remove useless assertion * typecheck/rust-coercion.cc (TypeCoercionRules::coerce_unsafe_ptr): refactor (TypeCoercionRules::coerce_borrowed_pointer): remove FIXME this is fine * typecheck/rust-hir-inherent-impl-overlap.h: use types_compatable * typecheck/rust-hir-path-probe.cc (PathProbeType::PathProbeType): remove const (PathProbeType::Probe): likewise (PathProbeImplTrait::PathProbeImplTrait): likewise (PathProbeImplTrait::Probe): likewise * typecheck/rust-hir-path-probe.h: likewise * typecheck/rust-hir-type-check-base.cc (walk_types_to_constrain): likewise * typecheck/rust-hir-type-check-base.h: likewise * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): use types_compatable * typecheck/rust-hir-type-check.h: remove const * typecheck/rust-typecheck-context.cc (TypeCheckContext::insert_associated_impl_mapping): likewise (TypeCheckContext::lookup_associated_impl_mapping_for_self): remove can_Eq * typecheck/rust-tyty-bounds.cc (TypeBoundPredicate::is_equal): likewise * typecheck/rust-tyty-subst.cc (SubstitutionArg::get_tyty): remove const version * typecheck/rust-tyty-subst.h: likewise * typecheck/rust-tyty.cc (BaseType::get_root): likewise * typecheck/rust-tyty.h: likewise gcc/testsuite/ChangeLog: * rust/compile/generics8.rs: extra error message 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 old can_eq interface was an old method to try and check if types can match up by taking into account generics but its not maintained properly and we already have a new wrapper Resolver::types_compatable (type, type, locus, emit_errors) which just calls unify_site_and infer with commit false. There are only a few places left to update.
One minor downside is that i need to remove const in some places because the unify interface is non const. Ideally we would want to avoid writing a seperate const unify anyway so i think this is not ideal but fine for us.
gcc/rust/ChangeLog:
gcc/testsuite/ChangeLog: