aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/hir/rust-hir-dump.cc
diff options
context:
space:
mode:
authorPhilip Herron <herron.philip@googlemail.com>2023-02-26 22:08:26 +0000
committerPhilip Herron <philip.herron@embecosm.com>2023-02-28 20:38:35 +0000
commit4b43f026aac8f0b9a918082551abca6bfa4d9912 (patch)
tree8371efacd9c77357cedffbf595d82066ede74045 /gcc/rust/hir/rust-hir-dump.cc
parent83863c69193c27ad6dcfb67d86691ef6fb3e1486 (diff)
downloadgcc-4b43f026aac8f0b9a918082551abca6bfa4d9912.zip
gcc-4b43f026aac8f0b9a918082551abca6bfa4d9912.tar.gz
gcc-4b43f026aac8f0b9a918082551abca6bfa4d9912.tar.bz2
gccrs: Generic pointers are coerceable
This is a complex type-system change where it begins out journey to get rid of our can_eq interface. Rust allows: let x:*mut T let y = x as *mut u8; Which requires us to consider find a way to infer what T should be so as to keep unify happy. This means we need to introduce a new unify_and interface where we can optionally inject inference variables as well as only commit the inference variable joins when they are sucsessful. So for this case we can then inject an implicit inference variables for T that can unify against u8 to make this a valid type-resolution. Fixes #1930 Signed-off-by: Philip Herron <herron.philip@googlemail.com> gcc/rust/ChangeLog: * backend/rust-compile-expr.cc (CompileExpr::resolve_method_address): update to new inteface * typecheck/rust-coercion.cc (TypeCoercionRules::coerce_unsafe_ptr): likewise (TypeCoercionRules::coerce_borrowed_pointer): likewise * typecheck/rust-hir-type-check.h: likewise * typecheck/rust-type-util.cc (unify_site_and): new interface to allow for infer and commit * typecheck/rust-type-util.h (unify_site_and): likewise * typecheck/rust-typecheck-context.cc (TypeCheckContext::clear_type): new interface * typecheck/rust-unify.cc (UnifyRules::UnifyRules): update (UnifyRules::Resolve): new optional flags for commit and infer (UnifyRules::go): likewise (UnifyRules::expect_adt): refactor to use new interface (UnifyRules::expect_reference): likewise (UnifyRules::expect_pointer): likewise (UnifyRules::expect_array): likewise (UnifyRules::expect_slice): likewise (UnifyRules::expect_fndef): likewise (UnifyRules::expect_fnptr): likewise (UnifyRules::expect_tuple): likewise (UnifyRules::expect_closure): likewise * typecheck/rust-unify.h: refactor interface gcc/testsuite/ChangeLog: * rust/compile/issue-1930.rs: New test.
Diffstat (limited to 'gcc/rust/hir/rust-hir-dump.cc')
0 files changed, 0 insertions, 0 deletions