aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/backend/rust-compile-struct-field-expr.h
diff options
context:
space:
mode:
authorPhilip Herron <philip.herron@embecosm.com>2022-10-13 10:10:37 +0100
committerPhilip Herron <philip.herron@embecosm.com>2022-10-13 15:45:16 +0100
commit9bac2dbfe999b0dffea65b9a1b6ed0a257edf3c8 (patch)
tree6493d2c0de6af90ffee13bb72e210465775491f4 /gcc/rust/backend/rust-compile-struct-field-expr.h
parent3e7320510e7bb774295ecbd8089a9f51d6475959 (diff)
downloadgcc-9bac2dbfe999b0dffea65b9a1b6ed0a257edf3c8.zip
gcc-9bac2dbfe999b0dffea65b9a1b6ed0a257edf3c8.tar.gz
gcc-9bac2dbfe999b0dffea65b9a1b6ed0a257edf3c8.tar.bz2
Method resolution must support multiple candidates
This patch fixes bad method resolution in our operator_overload_9 case. When we have a &mut reference to something and we deref we must resolve to the mutable reference impl block. The interface we are using to resolve methods is the can_eq interface which allows for permissive mutability which means allowing for mutable reference being unified with an immutable one. This meant we actual match against both the immutable and mutable version leading to multiple candidate error. The fix here adds a method resolution flag to the can_eq interface so that we enforce mutability equality. The other hack is that we do not allow can_eq of ParamTypes to generic Slices. I think there is some subtle thing going on for that case. The Rustc method resolver actually filters the impl blocks for reference types based looking up the relevant lang items we need to do this as well but is a much larger refactor to our method resolver which should be done seperately. Fixes #1588
Diffstat (limited to 'gcc/rust/backend/rust-compile-struct-field-expr.h')
0 files changed, 0 insertions, 0 deletions