mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-04 04:39:16 +00:00
Make the dogfood test happy.
This commit is contained in:
parent
42f44d5c78
commit
4fb1bb124e
@ -496,8 +496,8 @@ enum NeverLoopResult {
|
|||||||
Otherwise,
|
Otherwise,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn absorb_break(arg: NeverLoopResult) -> NeverLoopResult {
|
fn absorb_break(arg: &NeverLoopResult) -> NeverLoopResult {
|
||||||
match arg {
|
match *arg {
|
||||||
NeverLoopResult::AlwaysBreak |
|
NeverLoopResult::AlwaysBreak |
|
||||||
NeverLoopResult::Otherwise => NeverLoopResult::Otherwise,
|
NeverLoopResult::Otherwise => NeverLoopResult::Otherwise,
|
||||||
NeverLoopResult::MayContinueMainLoop => NeverLoopResult::MayContinueMainLoop,
|
NeverLoopResult::MayContinueMainLoop => NeverLoopResult::MayContinueMainLoop,
|
||||||
@ -580,18 +580,22 @@ fn never_loop_expr(expr: &Expr, main_loop_id: &NodeId) -> NeverLoopResult {
|
|||||||
ExprIf(ref e, ref e2, ref e3) => {
|
ExprIf(ref e, ref e2, ref e3) => {
|
||||||
let e1 = never_loop_expr(e, main_loop_id);
|
let e1 = never_loop_expr(e, main_loop_id);
|
||||||
let e2 = never_loop_expr(e2, main_loop_id);
|
let e2 = never_loop_expr(e2, main_loop_id);
|
||||||
let e3 = e3.as_ref().map(|ref e| never_loop_expr(e, main_loop_id)).unwrap_or(NeverLoopResult::Otherwise);
|
let e3 =
|
||||||
|
match *e3 {
|
||||||
|
Some(ref e3) => never_loop_expr(e3, main_loop_id),
|
||||||
|
None => NeverLoopResult::Otherwise,
|
||||||
|
};
|
||||||
combine_seq(e1, combine_branches(e2, e3))
|
combine_seq(e1, combine_branches(e2, e3))
|
||||||
},
|
},
|
||||||
ExprLoop(ref b, _, _) => {
|
ExprLoop(ref b, _, _) => {
|
||||||
// Break can come from the inner loop so remove them.
|
// Break can come from the inner loop so remove them.
|
||||||
absorb_break(never_loop_block(b, main_loop_id))
|
absorb_break(&never_loop_block(b, main_loop_id))
|
||||||
},
|
},
|
||||||
ExprWhile(ref e, ref b, _) => {
|
ExprWhile(ref e, ref b, _) => {
|
||||||
let e = never_loop_expr(e, main_loop_id);
|
let e = never_loop_expr(e, main_loop_id);
|
||||||
let result = never_loop_block(b, main_loop_id);
|
let result = never_loop_block(b, main_loop_id);
|
||||||
// Break can come from the inner loop so remove them.
|
// Break can come from the inner loop so remove them.
|
||||||
combine_seq(e, absorb_break(result))
|
combine_seq(e, absorb_break(&result))
|
||||||
},
|
},
|
||||||
ExprMatch(ref e, ref arms, _) => {
|
ExprMatch(ref e, ref arms, _) => {
|
||||||
let e = never_loop_expr(e, main_loop_id);
|
let e = never_loop_expr(e, main_loop_id);
|
||||||
|
Loading…
Reference in New Issue
Block a user