aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimple-array-bounds.cc
diff options
context:
space:
mode:
authorPhilip Herron <herron.philip@googlemail.com>2023-01-31 18:52:33 +0000
committerPhilip Herron <herron.philip@googlemail.com>2023-02-05 00:10:48 +0000
commitaff069dfb1fb1dcd785d5af68373d83289d62c72 (patch)
treee186ec3c1c669875ffa3e14253422e3291f162d2 /gcc/gimple-array-bounds.cc
parentd4e6b64e7f9e23aeb5d3c40665f18091575921ed (diff)
downloadgcc-aff069dfb1fb1dcd785d5af68373d83289d62c72.zip
gcc-aff069dfb1fb1dcd785d5af68373d83289d62c72.tar.gz
gcc-aff069dfb1fb1dcd785d5af68373d83289d62c72.tar.bz2
gccrs: Fix higher ranked trait bounds computation of self
This updates the higher ranked trait bounds computation to handle ambigious cases. When we have a slice for example: let slice = &a[1..3]; This works by reusing the Index operator overload from libcore, so when the index range of 1..3 is computed, the type system needs to compute what the types of index are; this works by integer inference variables Range<<integer>> that need to be unified with the impl Index for Range<Usize> which computes the real type of usize for the index. This is fine but what happens when we have the Copy and Clone traits bounds which have implementations for all the primitive types i8, i16, i32, i64... which is valid for any integer inference variable so the code prior to this patch would have grabbed the first impl it would have found and used it which is incorrect. When we have integer or float inference variables we need to look for their respective defaults or emit an ambigious type bound error. Signed-off-by: Philip Herron <herron.philip@googlemail.com> gcc/rust/ChangeLog: * typecheck/rust-hir-trait-reference.h: add const infterface * typecheck/rust-tyty-subst.cc (SubstitutionParamMapping::get_generic_param): make const (SubstitutionRef::monomorphize): fix issue * typecheck/rust-tyty-subst.h: constify interface
Diffstat (limited to 'gcc/gimple-array-bounds.cc')
0 files changed, 0 insertions, 0 deletions