From b9289b5969123d8c4edc94f3de62deb7921f572d Mon Sep 17 00:00:00 2001 From: Philip Herron Date: Sat, 16 May 2020 19:12:06 +0100 Subject: Add error E0282 when the LetStmt cannot be infered --- gcc/rust/analysis/rust-resolution.cc | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'gcc') 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 ()) { -- cgit v1.1