Skip to content

Commit 7b24026

Browse files
committed
Add comments indicating hacky fix for Rust pattern-matching bug
rust-lang/rust#16223
1 parent 1bc0b0e commit 7b24026

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/main.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ fn flat_to_px86(instr: Flat) -> Vec<X86> {
181181
Flat::If(cnd, thn, els) => {
182182
let (eq_left, eq_right) = match *cnd {
183183
x => match x {
184+
// https://github.com/rust-lang/rust/issues/16223
184185
Flat::EqP(left, right) => (left, right),
185186
_ => panic!("if cond needs to be Flat::EqP"),
186187
},
@@ -293,6 +294,7 @@ fn get_live_after_sets(mut instrs: Vec<X86>, lives: HashSet<String>)
293294
get_live_after_sets(elss.clone(), live_of_next.clone());
294295
let cond_vars = match *cnd.clone() {
295296
x => match x {
297+
// https://github.com/rust-lang/rust/issues/16223
296298
X86::EqP(left, right) => {
297299
match (left, right) {
298300
(X86Arg::Var(l), X86Arg::Var(r)) => vec![l, r],
@@ -451,6 +453,7 @@ fn assign_homes_to_instrs(instrs: Vec<X86>, locs: HashMap<String, X86Arg>) -> Ve
451453
X86::IfWithLives(cnd, thn, thn_lives, els, els_lives) => {
452454
let new_cnd = match *cnd {
453455
x => match x {
456+
// https://github.com/rust-lang/rust/issues/16223
454457
X86::EqP(left, right) => {
455458
let new_left = match left {
456459
X86Arg::Var(v) => locs.get(&v).unwrap().clone(),
@@ -516,6 +519,7 @@ fn lower_if (instr: X86) -> Vec<X86> {
516519
X86::If(cnd, thn, els) => {
517520
let (eqp_left, eqp_right) = match *cnd {
518521
x => match x {
522+
// https://github.com/rust-lang/rust/issues/16223
519523
X86::EqP(left, right) => (left, right),
520524
_ => panic!("if cond is always EqP"),
521525
},

0 commit comments

Comments
 (0)