aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/rust-session-manager.cc
diff options
context:
space:
mode:
authorPhilip Herron <herron.philip@googlemail.com>2023-09-17 20:11:23 +0100
committerArthur Cohen <arthur.cohen@embecosm.com>2024-01-16 19:04:37 +0100
commite47a980566050a290e1fbf9fb4792065ea772a47 (patch)
tree3ef43e89a2592692ac89240d0f108f89cb5c1100 /gcc/rust/rust-session-manager.cc
parent718b65a93d194a97a88f96780b97023ce9ed9378 (diff)
downloadgcc-e47a980566050a290e1fbf9fb4792065ea772a47.zip
gcc-e47a980566050a290e1fbf9fb4792065ea772a47.tar.gz
gcc-e47a980566050a290e1fbf9fb4792065ea772a47.tar.bz2
gccrs: port over readonly_error from c-family for lvalue assignment checks
Fixes #2391 gcc/rust/ChangeLog: * Make-lang.in: fixup formatting * resolve/rust-ast-resolve-expr.cc (ResolveExpr::visit): remove old check * rust-session-manager.cc (Session::compile_crate): call new lint * resolve/rust-ast-verify-assignee.h: Removed. * checks/errors/rust-readonly-check.cc: New file. * checks/errors/rust-readonly-check.h: New file. gcc/testsuite/ChangeLog: * rust/compile/wrong_lhs_assignment.rs: update error message * rust/compile/issue-2391.rs: New test. Signed-off-by: Philip Herron <herron.philip@googlemail.com>
Diffstat (limited to 'gcc/rust/rust-session-manager.cc')
-rw-r--r--gcc/rust/rust-session-manager.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/gcc/rust/rust-session-manager.cc b/gcc/rust/rust-session-manager.cc
index 7c4a76f..1273b53 100644
--- a/gcc/rust/rust-session-manager.cc
+++ b/gcc/rust/rust-session-manager.cc
@@ -32,9 +32,9 @@
#include "rust-cfg-parser.h"
#include "rust-lint-scan-deadcode.h"
#include "rust-lint-unused-var.h"
+#include "rust-readonly-check.h"
#include "rust-hir-dump.h"
#include "rust-ast-dump.h"
-#include "rust-ast-collector.h"
#include "rust-export-metadata.h"
#include "rust-imports.h"
#include "rust-extern-crate.h"
@@ -47,7 +47,6 @@
#include "rust-unicode.h"
#include "rust-attribute-values.h"
-#include "diagnostic.h"
#include "input.h"
#include "selftest.h"
#include "tm.h"
@@ -676,6 +675,7 @@ Session::compile_crate (const char *filename)
// lints
Analysis::ScanDeadcode::Scan (hir);
Analysis::UnusedVariables::Lint (ctx);
+ Analysis::ReadonlyCheck::Lint (ctx);
// metadata
bool specified_emit_metadata