libcore: Fix more merge fallout.
This commit is contained in:
parent
3affc6ed40
commit
72868450df
|
@ -225,7 +225,7 @@ mod test {
|
|||
fn rng() {
|
||||
do run_in_newsched_task() {
|
||||
use rand::{rng, Rng};
|
||||
let r = rng();
|
||||
let mut r = rng();
|
||||
let _ = r.next();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
use ast;
|
||||
use codemap;
|
||||
use codemap::span;
|
||||
use fold;
|
||||
use ext::base::ext_ctxt;
|
||||
use ext::build;
|
||||
|
||||
|
@ -516,3 +517,20 @@ pub fn mk_unreachable(cx: @ext_ctxt, span: span) -> @ast::expr {
|
|||
pub fn mk_unreachable_arm(cx: @ext_ctxt, span: span) -> ast::arm {
|
||||
mk_arm(cx, span, ~[mk_pat_wild(cx, span)], mk_unreachable(cx, span))
|
||||
}
|
||||
|
||||
//
|
||||
// Duplication functions
|
||||
//
|
||||
// These functions just duplicate AST nodes.
|
||||
//
|
||||
|
||||
pub fn duplicate_expr(cx: @ext_ctxt, expr: @ast::expr) -> @ast::expr {
|
||||
let folder = fold::default_ast_fold();
|
||||
let folder = @fold::AstFoldFns {
|
||||
new_id: |_| cx.next_id(),
|
||||
..*folder
|
||||
};
|
||||
let folder = fold::make_fold(folder);
|
||||
folder.fold_expr(expr)
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ pub fn expand_deriving_rand(cx: @ext_ctxt,
|
|||
self_ty: None,
|
||||
args: ~[
|
||||
Ptr(~Literal(Path::new_local(~"R")),
|
||||
Borrowed(None, ast::m_imm))
|
||||
Borrowed(None, ast::m_mutbl))
|
||||
],
|
||||
ret_ty: Self,
|
||||
const_nonmatching: false,
|
||||
|
@ -59,8 +59,10 @@ fn rand_substructure(cx: @ext_ctxt, span: span, substr: &Substructure) -> @expr
|
|||
cx.ident_of(~"rand")
|
||||
];
|
||||
let rand_call = || {
|
||||
build::mk_call_global(cx, span,
|
||||
copy rand_ident, copy rng)
|
||||
build::mk_call_global(cx,
|
||||
span,
|
||||
copy rand_ident,
|
||||
~[ build::duplicate_expr(cx, rng[0]) ])
|
||||
};
|
||||
|
||||
return match *substr.fields {
|
||||
|
@ -80,7 +82,10 @@ fn rand_substructure(cx: @ext_ctxt, span: span, substr: &Substructure) -> @expr
|
|||
let rand_name = build::mk_raw_path_(span, copy rand_ident, None, ~[ u32_ty, r_ty ]);
|
||||
let rand_name = build::mk_path_raw(cx, span, rand_name);
|
||||
|
||||
let rv_call = build::mk_call_(cx, span, rand_name, copy rng);
|
||||
let rv_call = build::mk_call_(cx,
|
||||
span,
|
||||
rand_name,
|
||||
~[ build::duplicate_expr(cx, rng[0]) ]);
|
||||
|
||||
// rand() % variants.len()
|
||||
let rand_variant = build::mk_binary(cx, span, ast::rem,
|
||||
|
|
|
@ -859,3 +859,4 @@ impl AstFoldExtensions for @ast_fold {
|
|||
pub fn make_fold(afp: ast_fold_fns) -> @ast_fold {
|
||||
afp as @ast_fold
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue