diff --git a/src/librustc_typeck/diagnostics.rs b/src/librustc_typeck/diagnostics.rs index 166af6832a9568f796c94ec6d640b2abd6b5e384..fa258188eb8251992c4269a66671f75a5dab2cc4 100644 --- a/src/librustc_typeck/diagnostics.rs +++ b/src/librustc_typeck/diagnostics.rs @@ -642,6 +642,7 @@ enum variant, one of the fields was not provided. Each field should be and field references. Let's start with some bad examples: + ``` use std::collections::LinkedList; @@ -653,8 +654,10 @@ enum variant, one of the fields was not provided. Each field should be fn some_func(i: &mut i32) { i += 12; // Error : '+=' operation cannot be applied on a reference ! } +``` And now some good examples: + ``` let mut i : i32 = 0; @@ -665,7 +668,6 @@ fn some_func(i: &mut i32) { fn some_func(i: &mut i32) { *i += 12; // Good ! } - ``` "##, @@ -694,6 +696,7 @@ fn foo() -> u8 { https://doc.rust-lang.org/reference.html#lvalues,-rvalues-and-temporaries Now, we can go further. Here are some bad examples: + ``` struct SomeStruct { x: i32,