From 698f8c2f01ea549d77d7dc3338a12e04c11057b9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:02:58 +0200 Subject: Adding upstream version 1.64.0+dfsg1. Signed-off-by: Daniel Baumann --- compiler/rustc_error_codes/src/error_codes/E0384.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 compiler/rustc_error_codes/src/error_codes/E0384.md (limited to 'compiler/rustc_error_codes/src/error_codes/E0384.md') diff --git a/compiler/rustc_error_codes/src/error_codes/E0384.md b/compiler/rustc_error_codes/src/error_codes/E0384.md new file mode 100644 index 000000000..e21fac079 --- /dev/null +++ b/compiler/rustc_error_codes/src/error_codes/E0384.md @@ -0,0 +1,20 @@ +An immutable variable was reassigned. + +Erroneous code example: + +```compile_fail,E0384 +fn main() { + let x = 3; + x = 5; // error, reassignment of immutable variable +} +``` + +By default, variables in Rust are immutable. To fix this error, add the keyword +`mut` after the keyword `let` when declaring the variable. For example: + +``` +fn main() { + let mut x = 3; + x = 5; +} +``` -- cgit v1.2.3