Skip to content

Commit 5b1441c

Browse files
pcwaltonpnkfelix
authored andcommitted
libsyntax Eagerly clone some data to accommodate by-value closures.
1 parent ec60976 commit 5b1441c

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/libsyntax/ext/deriving/cmp/totalord.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ pub fn cs_cmp(cx: &mut ExtCtxt, span: Span,
6767
substr: &Substructure) -> @Expr {
6868
let test_id = cx.ident_of("__test");
6969
let equals_path = ordering_const(cx, span, Equal);
70+
let equals_path_2 = equals_path.clone();
7071

7172
/*
7273
Builds:
@@ -107,7 +108,7 @@ pub fn cs_cmp(cx: &mut ExtCtxt, span: Span,
107108
old, Some(cx.expr_ident(span, test_id)));
108109
cx.expr_block(cx.block(span, vec!(assign), Some(if_)))
109110
},
110-
cx.expr_path(equals_path.clone()),
111+
cx.expr_path(equals_path_2),
111112
|cx, span, list, _| {
112113
match list {
113114
// an earlier nonmatching variant is Less than a

src/libsyntax/ext/deriving/generic/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,7 @@ impl<'a> TraitDef<'a> {
380380
generics: &Generics,
381381
methods: Vec<@ast::Method> ) -> @ast::Item {
382382
let trait_path = self.path.to_path(cx, self.span, type_ident, generics);
383+
let trait_path_2 = trait_path.clone();
383384

384385
let Generics { mut lifetimes, ty_params } =
385386
self.generics.to_generics(cx, self.span, type_ident, generics);
@@ -399,7 +400,7 @@ impl<'a> TraitDef<'a> {
399400
type_ident, generics))
400401
}).collect();
401402
// require the current trait
402-
bounds.push(cx.typarambound(trait_path.clone()));
403+
bounds.push(cx.typarambound(trait_path_2.clone()));
403404

404405
cx.typaram(self.span,
405406
ty_param.ident,

0 commit comments

Comments
 (0)