Skip to content

Commit ab73421

Browse files
author
Jonathan Turner
authored
Rollup merge of rust-lang#35360 - medzin:E0388, r=jonathandturner
Updated error message E0388 Fixes rust-lang#35339 as part of rust-lang#35233. r? @GuillaumeGomez
2 parents 3c5a0fa + bfbdff0 commit ab73421

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
@@ -914,9 +914,11 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
914914
}
915915
mc::AliasableStatic |
916916
mc::AliasableStaticMut => {
917-
struct_span_err!(
917+
let mut err = struct_span_err!(
918918
self.tcx.sess, span, E0388,
919-
"{} in a static location", prefix)
919+
"{} in a static location", prefix);
920+
err.span_label(span, &format!("cannot write data in a static definition"));
921+
err
920922
}
921923
mc::AliasableBorrowed => {
922924
struct_span_err!(

src/test/compile-fail/E0017.rs

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017
2020
//~| ERROR E0017
2121
//~| NOTE statics require immutable values
2222
//~| ERROR E0388
23+
//~| NOTE cannot write data in a static definition
2324
static CONST_REF: &'static mut i32 = &mut C; //~ ERROR E0017
2425
//~| NOTE statics require immutable values
2526
//~| ERROR E0017

0 commit comments

Comments
 (0)