Skip to content

Commit bfbdff0

Browse files
author
Adam Medziński
committed
Updated error message E0388
1 parent 42001ed commit bfbdff0

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/librustc_borrowck/borrowck/mod.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -910,9 +910,11 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
910910
}
911911
mc::AliasableStatic |
912912
mc::AliasableStaticMut => {
913-
struct_span_err!(
913+
let mut err = struct_span_err!(
914914
self.tcx.sess, span, E0388,
915-
"{} in a static location", prefix)
915+
"{} in a static location", prefix);
916+
err.span_label(span, &format!("cannot write data in a static definition"));
917+
err
916918
}
917919
mc::AliasableBorrowed => {
918920
struct_span_err!(

src/test/compile-fail/E0017.rs

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const CR: &'static mut i32 = &mut C; //~ ERROR E0017
1616
static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017
1717
//~| ERROR E0017
1818
//~| ERROR E0388
19+
//~| NOTE cannot write data in a static definition
1920
static CONST_REF: &'static mut i32 = &mut C; //~ ERROR E0017
2021
//~| ERROR E0017
2122

0 commit comments

Comments
 (0)