Skip to content

Commit

Permalink
Work around a compiler crash folding labeled break. rust-lang#9129
Browse files Browse the repository at this point in the history
Servo is hitting this problem, so this is a workaround for a lack of a real solution.
  • Loading branch information
brson committed Sep 13, 2013
1 parent cabba6b commit c62919f
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/libsyntax/fold.rs
Original file line number Diff line number Diff line change
Expand Up @@ -690,11 +690,19 @@ pub fn noop_fold_expr(e: &Expr_, fld: @ast_fold) -> Expr_ {
ExprBreak(ref opt_ident) => {
// FIXME #6993: add fold_name to fold.... then cut out the
// bogus Name->Ident->Name conversion.
ExprBreak(opt_ident.map_move(|x| fld.fold_ident(Ident::new(x)).name))
ExprBreak(opt_ident.map_move(|x| {
// FIXME #9129: Assigning the new ident to a temporary to work around codegen bug
let newx = Ident::new(x);
fld.fold_ident(newx).name
}))
}
ExprAgain(ref opt_ident) => {
// FIXME #6993: add fold_name to fold....
ExprAgain(opt_ident.map_move(|x| fld.fold_ident(Ident::new(x)).name))
ExprAgain(opt_ident.map_move(|x| {
// FIXME #9129: Assigning the new ident to a temporary to work around codegen bug
let newx = Ident::new(x);
fld.fold_ident(newx).name
}))
}
ExprRet(ref e) => {
ExprRet(e.map_move(|x| fld.fold_expr(x)))
Expand Down

6 comments on commit c62919f

@catamorphism
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r+,p=10

@pnkfelix
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(i infer that this workaround actually fixes the problem in servo then? Glad to hear that my time extracting it was not in vain. Hopefully I will be able to further investigate what's actually going on in the near future.)

@brson
Copy link
Owner Author

@brson brson commented on c62919f Sep 14, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors: retry

@pnkfelix yes, it fixes the problem servo was hitting

@alexcrichton
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors: retry

@huonw
Copy link

@huonw huonw commented on c62919f Sep 14, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors: retry

@alexcrichton
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors: retry

maybe one of these days...

Please sign in to comment.