Auto merge of #47098 - estebank:immutable-field, r=nagisa

Reword trying to operate in immutable fields

The previous message ("cannot assign/mutably borrow immutable field")
when trying to modify a field of an immutable binding gave the
(incorrect) impression that fields can be mutable independently of their
ADT's binding. Slightly reword the message to read "cannot
assign/mutably borrow field of immutable binding".

Re #35937.
This commit is contained in:
bors 2018-01-01 12:51:54 +00:00
commit d5f2745e7c
11 changed files with 85 additions and 64 deletions

View file

@ -18,8 +18,8 @@ struct TrieMapIterator<'a> {
fn main() {
let a = 5;
let _iter = TrieMapIterator{node: &a};
_iter.node = & //[ast]~ ERROR cannot assign to immutable field `_iter.node`
//[mir]~^ ERROR cannot assign to immutable field `_iter.node` (Ast)
_iter.node = & //[ast]~ ERROR cannot assign to field `_iter.node` of immutable binding
//[mir]~^ ERROR cannot assign to field `_iter.node` of immutable binding (Ast)
// MIR doesn't generate an error because the code isn't reachable. This is OK
// because the test is here to check that the compiler doesn't ICE (cf. #5500).
panic!()