From f52be4bf85a5190ce7a2e456d40cbc94aa63ca89 Mon Sep 17 00:00:00 2001 From: Philip Herron Date: Fri, 1 Aug 2025 11:54:52 +0100 Subject: gccrs: Remove more calls to the old TyTy::BaseType::can_eq interface 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 --- gcc/testsuite/rust/compile/generics8.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/testsuite/rust') diff --git a/gcc/testsuite/rust/compile/generics8.rs b/gcc/testsuite/rust/compile/generics8.rs index 88c4bac..2d30a9e 100644 --- a/gcc/testsuite/rust/compile/generics8.rs +++ b/gcc/testsuite/rust/compile/generics8.rs @@ -4,7 +4,7 @@ pub trait Sized {} struct Foo(A, B); impl Foo { - fn test(a: T) -> T { + fn test(a: T) -> T { // { dg-error "duplicate definitions with name .test." } a } } -- cgit v1.1