Skip to content

Commit b005fea

Browse files
committed
comment
1 parent 65ad1b8 commit b005fea

File tree

1 file changed

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

1 file changed

+4
-0
lines changed

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

+4
Original file line numberDiff line numberDiff line change
@@ -949,12 +949,15 @@ struct Candidate<'pat, 'tcx> {
949949
has_guard: bool,
950950

951951
/// All of these must be satisfied...
952+
// Invariant: all the `MatchPair`s are recursively simplified.
952953
match_pairs: Vec<MatchPair<'pat, 'tcx>>,
953954

954955
/// ...these bindings established...
956+
// Invariant: not mutated during match tree construction.
955957
bindings: Vec<Binding<'tcx>>,
956958

957959
/// ...and these types asserted...
960+
// Invariant: not mutated during match tree construction.
958961
ascriptions: Vec<Ascription<'tcx>>,
959962

960963
/// ...and if this is non-empty, one of these subcandidates also has to match...
@@ -1056,6 +1059,7 @@ pub(crate) struct MatchPair<'pat, 'tcx> {
10561059
place: PlaceBuilder<'tcx>,
10571060

10581061
// ... must match this pattern.
1062+
// Invariant: this pattern must be simplified, i.e. requires a test.
10591063
pattern: &'pat Pat<'tcx>,
10601064

10611065
/// Precomputed sub-match pairs.

0 commit comments

Comments
 (0)