Skip to content

Commit 1905f8c

Browse files
committed
Document projection condition
1 parent dab1074 commit 1905f8c

File tree

1 file changed

+3
-0
lines changed
  • compiler/rustc_mir_build/src/build/matches

1 file changed

+3
-0
lines changed

compiler/rustc_mir_build/src/build/matches/util.rs

+3
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,9 @@ impl<'pat, 'tcx> MatchPair<'pat, 'tcx> {
106106
let mut place = match place.try_upvars_resolved(cx) {
107107
Ok(val) | Err(val) => val,
108108
};
109+
110+
// Only add the OpaqueCast projection if the given place is an opaque type and the
111+
// expected type from the pattern is not.
109112
let may_need_cast = match place.base() {
110113
PlaceBase::Local(local) => {
111114
let ty = Place::ty_from(local, place.projection(), &cx.local_decls, cx.tcx).ty;

0 commit comments

Comments
 (0)