Skip to content

Commit be92f9d

Browse files
committed
Teach new error messages in MIR borrowck about promoted places
1 parent ac54b74 commit be92f9d

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

src/librustc_mir/borrow_check/move_errors.rs

+1
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ impl<'a, 'gcx, 'tcx> MirBorrowckCtxt<'a, 'gcx, 'tcx> {
247247
Place::Projection(ref proj) => {
248248
proj.base == Place::Local(Local::new(1))
249249
}
250+
Place::Promoted(_) |
250251
Place::Local(_) | Place::Static(_) => unreachable!(),
251252
}
252253
} =>

src/librustc_mir/borrow_check/mutability_errors.rs

+2
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,8 @@ impl<'a, 'gcx, 'tcx> MirBorrowckCtxt<'a, 'gcx, 'tcx> {
122122
}
123123
}
124124

125+
Place::Promoted(_) => unreachable!(),
126+
125127
Place::Static(box Static { def_id, ty: _ }) => {
126128
if let Place::Static(_) = access_place {
127129
item_msg = format!("immutable static item `{}`", access_place_desc.unwrap());

0 commit comments

Comments
 (0)