aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/backend
diff options
context:
space:
mode:
authorPhilip Herron <herron.philip@googlemail.com>2023-02-13 17:51:19 +0000
committerPhilip Herron <philip.herron@embecosm.com>2023-02-14 22:55:07 +0000
commit84eb2e24d93c581c33ea817d678bc0612c2a225e (patch)
tree0b75818e2e4ad3cce73fdd62d29776a0c56741c8 /gcc/rust/backend
parent226e5736c08614621ef64dd7f710f6af006d082a (diff)
downloadgcc-84eb2e24d93c581c33ea817d678bc0612c2a225e.zip
gcc-84eb2e24d93c581c33ea817d678bc0612c2a225e.tar.gz
gcc-84eb2e24d93c581c33ea817d678bc0612c2a225e.tar.bz2
gccrs: Support for Sized builtin marker trait
When implementing general bounds checking as part of unify calls, we did not check associated types on bounds which lead to alot of missed error checking. This now recursively checks the bounds and the associated types with a decent error message. This also required us to implement the Sized marker trait to keep existing test-cases happy. Fixes #1725 Signed-off-by: Philip Herron <herron.philip@googlemail.com> gcc/rust/ChangeLog: * typecheck/rust-hir-trait-reference.cc (TraitReference::clear_associated_types): make const (TraitReference::clear_associated_type_projections): new interface * typecheck/rust-hir-trait-reference.h: * typecheck/rust-hir-trait-resolve.cc (TraitResolver::resolve_trait): refactor (TraitItemReference::associated_type_reset): reset projections * typecheck/rust-hir-type-bounds.h: * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): fix bounds * typecheck/rust-tyty-bounds.cc (TypeBoundsProbe::TypeBoundsProbe): refactor into cc file (TypeBoundsProbe::Probe): refactor (TypeBoundsProbe::is_bound_satisfied_for_type): likewise (TypeBoundsProbe::assemble_sized_builtin): add builtin for Sized (TypeCheckBase::get_predicate_from_bound): refactor (TypeBoundPredicate::lookup_associated_type): refactor * typecheck/rust-tyty-subst.cc (SubstitutionRef::lookup_associated_impl) (SubstitutionRef::prepare_higher_ranked_bounds): new interface to clear hanging bounds (SubstitutionRef::monomorphize): refactor * typecheck/rust-tyty-subst.h: * typecheck/rust-tyty.cc (BaseType::get_locus): helper (BaseType::satisfies_bound): ensure bounds are satisfied and assoicated types (ParamType::ParamType): new field in constructor (ParamType::clone): update clone (ParamType::set_implicit_self_trait): new interface (ParamType::is_implicit_self_trait): likewise * typecheck/rust-tyty.h: cleanup * util/rust-hir-map.cc (Mappings::Mappings): builtin marker (Mappings::~Mappings): delete marker (Mappings::lookup_builtin_marker): lookup * util/rust-hir-map.h: update header gcc/testsuite/ChangeLog: * rust/compile/issue-1725-1.rs: New test. * rust/compile/issue-1725-2.rs: New test.
Diffstat (limited to 'gcc/rust/backend')
0 files changed, 0 insertions, 0 deletions