about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorAdam Medziński <adam.medzinski@gmail.com>2016-08-05 11:27:59 +0200
committerAdam Medziński <adam.medzinski@gmail.com>2016-08-22 23:22:40 +0200
commitbfbdff0e2d894cf1f88e93df864b2c02e940a99a (patch)
tree653171afe3590336d115c590175a13e833ecd283 /src
parent42001edc998f3406ecc04afa48bf07ce91247b67 (diff)
Updated error message E0388
Diffstat (limited to 'src')
-rw-r--r--src/librustc_borrowck/borrowck/mod.rs6
-rw-r--r--src/test/compile-fail/E0017.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 904cffac6b3..ada8a3d80b2 100644
--- a/src/librustc_borrowck/borrowck/mod.rs
+++ b/src/librustc_borrowck/borrowck/mod.rs
@@ -910,9 +910,11 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
             }
             mc::AliasableStatic |
             mc::AliasableStaticMut => {
-                struct_span_err!(
+                let mut err = struct_span_err!(
                     self.tcx.sess, span, E0388,
-                    "{} in a static location", prefix)
+                    "{} in a static location", prefix);
+                err.span_label(span, &format!("cannot write data in a static definition"));
+                err
             }
             mc::AliasableBorrowed => {
                 struct_span_err!(
diff --git a/src/test/compile-fail/E0017.rs b/src/test/compile-fail/E0017.rs
index 13f2c23d8c4..8f043d16c11 100644
--- a/src/test/compile-fail/E0017.rs
+++ b/src/test/compile-fail/E0017.rs
@@ -16,6 +16,7 @@ const CR: &'static mut i32 = &mut C; //~ ERROR E0017
 static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017
                                               //~| ERROR E0017
                                               //~| ERROR E0388
+                                              //~| NOTE cannot write data in a static definition
 static CONST_REF: &'static mut i32 = &mut C; //~ ERROR E0017
                                              //~| ERROR E0017