Skip to content

Commit

Permalink
./x.py fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
spastorino committed Jan 28, 2020
1 parent 22a4827 commit 5f1caa4
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
18 changes: 12 additions & 6 deletions src/librustc_mir/borrow_check/diagnostics/conflict_errors.rs
Expand Up @@ -604,8 +604,13 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
cursor = proj_base;

match elem {
ProjectionElem::Field(field, _) if union_ty(*local, proj_base).is_some() => {
return Some((PlaceRef { local: *local, projection: proj_base }, field));
ProjectionElem::Field(field, _)
if union_ty(*local, proj_base).is_some() =>
{
return Some((
PlaceRef { local: *local, projection: proj_base },
field,
));
}
_ => {}
}
Expand All @@ -629,7 +634,10 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
{
// FIXME when we avoid clone reuse describe_place closure
let describe_base_place = self
.describe_place(PlaceRef { local: *local, projection: proj_base })
.describe_place(PlaceRef {
local: *local,
projection: proj_base,
})
.unwrap_or_else(|| "_".to_owned());

return Some((
Expand Down Expand Up @@ -1513,9 +1521,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
StorageDeadOrDrop::LocalStorageDead
| StorageDeadOrDrop::BoxedStorageDead => {
assert!(
Place::ty_from(place.local, proj_base, *self.body, tcx)
.ty
.is_box(),
Place::ty_from(place.local, proj_base, *self.body, tcx).ty.is_box(),
"Drop of value behind a reference or raw pointer"
);
StorageDeadOrDrop::BoxedStorageDead
Expand Down
3 changes: 1 addition & 2 deletions src/librustc_mir/borrow_check/diagnostics/move_errors.rs
Expand Up @@ -274,8 +274,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
let description = if place.projection.len() == 1 {
format!("static item `{}`", self.describe_place(place.as_ref()).unwrap())
} else {
let base_static =
PlaceRef { local: place.local, projection: &[ProjectionElem::Deref] };
let base_static = PlaceRef { local: place.local, projection: &[ProjectionElem::Deref] };

format!(
"`{:?}` as `{:?}` is a static item",
Expand Down
3 changes: 1 addition & 2 deletions src/librustc_mir/transform/check_unsafety.rs
Expand Up @@ -414,8 +414,7 @@ impl<'a, 'tcx> UnsafetyChecker<'a, 'tcx> {
match elem {
ProjectionElem::Field(..) => {
let ty =
Place::ty_from(place.local, proj_base, &self.body.local_decls, self.tcx)
.ty;
Place::ty_from(place.local, proj_base, &self.body.local_decls, self.tcx).ty;
match ty.kind {
ty::Adt(def, _) => match self.tcx.layout_scalar_valid_range(def.did) {
(Bound::Unbounded, Bound::Unbounded) => {}
Expand Down

0 comments on commit 5f1caa4

Please sign in to comment.