aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Herron <phil@nebuloninc.com>2020-05-16 19:12:06 +0100
committerPhilip Herron <philip.herron@embecosm.com>2020-11-28 19:12:04 +0000
commitb9289b5969123d8c4edc94f3de62deb7921f572d (patch)
treeb1d46714b318cea5b1e827c316a68bd635a0a122
parent60cc2cf64bdbc4224d8f8bbcaa2469cb6e340a47 (diff)
downloadgcc-b9289b5969123d8c4edc94f3de62deb7921f572d.zip
gcc-b9289b5969123d8c4edc94f3de62deb7921f572d.tar.gz
gcc-b9289b5969123d8c4edc94f3de62deb7921f572d.tar.bz2
Add error E0282 when the LetStmt cannot be infered
-rw-r--r--gcc/rust/analysis/rust-resolution.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/gcc/rust/analysis/rust-resolution.cc b/gcc/rust/analysis/rust-resolution.cc
index 182ea2e..186ecd3c 100644
--- a/gcc/rust/analysis/rust-resolution.cc
+++ b/gcc/rust/analysis/rust-resolution.cc
@@ -633,6 +633,13 @@ TypeResolution::visit (AST::EmptyStmt &stmt)
void
TypeResolution::visit (AST::LetStmt &stmt)
{
+ if (!stmt.has_init_expr () && !stmt.has_type ())
+ {
+ rust_error_at (stmt.locus,
+ "E0282: type annotations or init expression needed");
+ return;
+ }
+
AST::Type *inferedType = NULL;
if (stmt.has_init_expr ())
{