Skip to content

Commit

Permalink
Document projection condition
Browse files Browse the repository at this point in the history
  • Loading branch information
oli-obk committed Sep 19, 2022
1 parent dab1074 commit 1905f8c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions compiler/rustc_mir_build/src/build/matches/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ impl<'pat, 'tcx> MatchPair<'pat, 'tcx> {
let mut place = match place.try_upvars_resolved(cx) {
Ok(val) | Err(val) => val,
};

// Only add the OpaqueCast projection if the given place is an opaque type and the
// expected type from the pattern is not.
let may_need_cast = match place.base() {
PlaceBase::Local(local) => {
let ty = Place::ty_from(local, place.projection(), &cx.local_decls, cx.tcx).ty;
Expand Down

0 comments on commit 1905f8c

Please sign in to comment.