about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorJonathan Turner <jonathandturner@users.noreply.github.com>2016-08-27 12:43:30 -0700
committerGitHub <noreply@github.com>2016-08-27 12:43:30 -0700
commitdc6ae4b669435c065b789929372189a3a7034bc6 (patch)
treee32180e600b52224e5b30efc6e226d11f8b66b5f /src
parent11946956a6352f49c6aadc1c13c39757a046e0c2 (diff)
parentf39700514dfdc9ebe76e214967ed3fe9971578af (diff)
Rollup merge of #35657 - ahmedcharles:e0389, r=jonathandturner
Update E0389 to the new format. #35630
Diffstat (limited to 'src')
-rw-r--r--src/librustc_borrowck/borrowck/mod.rs6
-rw-r--r--src/test/compile-fail/E0389.rs1
2 files changed, 5 insertions, 2 deletions
diff --git a/src/librustc_borrowck/borrowck/mod.rs b/src/librustc_borrowck/borrowck/mod.rs
index 6137afbb59f..e8b44d85bf9 100644
--- a/src/librustc_borrowck/borrowck/mod.rs
+++ b/src/librustc_borrowck/borrowck/mod.rs
@@ -926,9 +926,11 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
                 err
             }
             mc::AliasableBorrowed => {
-                struct_span_err!(
+                let mut e = struct_span_err!(
                     self.tcx.sess, span, E0389,
-                    "{} in a `&` reference", prefix)
+                    "{} in a `&` reference", prefix);
+                e.span_label(span, &"assignment into an immutable reference");
+                e
             }
         };
 
diff --git a/src/test/compile-fail/E0389.rs b/src/test/compile-fail/E0389.rs
index 445831bf8d7..584dfd5fa44 100644
--- a/src/test/compile-fail/E0389.rs
+++ b/src/test/compile-fail/E0389.rs
@@ -16,5 +16,6 @@ fn main() {
     let mut fancy = FancyNum{ num: 5 };
     let fancy_ref = &(&mut fancy);
     fancy_ref.num = 6; //~ ERROR E0389
+                       //~^ NOTE assignment into an immutable reference
     println!("{}", fancy_ref.num);
 }