Skip to content

Commit

Permalink
Rollup merge of #86028 - LingMan:dupe_empty_check, r=jyn514
Browse files Browse the repository at this point in the history
Drop an `if let` that will always succeed

We've already checked that `proj_base == []` in the line above and renaming
`place_local` to `local` doesn't gain us anything.

`@rustbot` modify labels +C-cleanup +T-compiler
  • Loading branch information
GuillaumeGomez authored Jun 5, 2021
2 parents 1542950 + f4080fc commit 01bbae8
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions compiler/rustc_mir/src/transform/check_consts/validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -729,13 +729,11 @@ impl Visitor<'tcx> for Validator<'mir, 'tcx> {
let base_ty = Place::ty_from(place_local, proj_base, self.body, self.tcx).ty;
if let ty::RawPtr(_) = base_ty.kind() {
if proj_base.is_empty() {
if let (local, []) = (place_local, proj_base) {
let decl = &self.body.local_decls[local];
if let Some(box LocalInfo::StaticRef { def_id, .. }) = decl.local_info {
let span = decl.source_info.span;
self.check_static(def_id, span);
return;
}
let decl = &self.body.local_decls[place_local];
if let Some(box LocalInfo::StaticRef { def_id, .. }) = decl.local_info {
let span = decl.source_info.span;
self.check_static(def_id, span);
return;
}
}
self.check_op(ops::RawPtrDeref);
Expand Down

0 comments on commit 01bbae8

Please sign in to comment.