aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/Make-lang.in
diff options
context:
space:
mode:
authorPhilip Herron <herron.philip@googlemail.com>2023-04-23 22:41:21 +0100
committerArthur Cohen <arthur.cohen@embecosm.com>2024-01-16 18:34:14 +0100
commit1b810614f1e4488b6f5c53a6d195fda51fb5a5e7 (patch)
tree2da890d238cab03396d01d57b27b172302bffbab /gcc/rust/Make-lang.in
parentd264dcc70c4c3537ca350d12855fd29687759041 (diff)
downloadgcc-1b810614f1e4488b6f5c53a6d195fda51fb5a5e7.zip
gcc-1b810614f1e4488b6f5c53a6d195fda51fb5a5e7.tar.gz
gcc-1b810614f1e4488b6f5c53a6d195fda51fb5a5e7.tar.bz2
gccrs: Add mechanism use pattern information to improve type info
When we have an untyped closure we assumed all parameters were inference variables but we can use the pattern type to try and improve the type info so if we have a reference pattern it must be a reference to an inference variables '&_'. This patch adds a new visitor to figure this out for untyped closure parameters. Note this test case does fully type resolve into the gimple: bool test::main::{{closure}} (struct test::main::{{closure}} $closure, struct (& u8) args) { ... } Though the Rustc version does fail type-resolution but we make some assumptions during comparison expressions here that they resolve to a bool this will change when we implement the comparison lang items. Fixes #2142 gcc/rust/ChangeLog: * hir/tree/rust-hir-pattern.h: add missing get_mutability * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): use new ClosureParamInfer on untyped parameters * typecheck/rust-hir-type-check-pattern.cc (ClosureParamInfer::Resolve): interface (ClosureParamInfer::ClosureParamInfer): constructor (ClosureParamInfer::visit): visitors for each pattern * typecheck/rust-hir-type-check-pattern.h (class ClosureParamInfer): new visitor gcc/testsuite/ChangeLog: * rust/compile/issue-2142.rs: New test. Signed-off-by: Philip Herron <herron.philip@googlemail.com>
Diffstat (limited to 'gcc/rust/Make-lang.in')
0 files changed, 0 insertions, 0 deletions