Skip to content

Commit 6edd4d6

Browse files
committed
---
yaml --- r: 63335 b: refs/heads/snap-stage3 c: c83bced h: refs/heads/master i: 63333: b71f3c5 63331: 8eb11ca 63327: 677df6d v: v3
1 parent a59424e commit 6edd4d6

File tree

3 files changed

+46
-4
lines changed

3 files changed

+46
-4
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 2d28d645422c1617be58c8ca7ad9a457264ca850
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 1ba6fa477743bf6b8340b6d83987f1e243a509ae
4+
refs/heads/snap-stage3: c83bceddbb497464f8e4e1990f7518b009cd61ca
55
refs/heads/try: 7b78b52e602bb3ea8174f9b2006bff3315f03ef9
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/libsyntax/ext/deriving/rand.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,18 +79,19 @@ fn rand_substructure(cx: @ExtCtxt, span: span, substr: &Substructure) -> @expr {
7979
let variant_count = cx.expr_uint(span, variants.len());
8080

8181
// need to specify the uint-ness of the random number
82-
let u32_ty = cx.ty_ident(span, cx.ident_of("uint"));
82+
let uint_ty = cx.ty_ident(span, cx.ident_of("uint"));
8383
let r_ty = cx.ty_ident(span, cx.ident_of("R"));
84-
let rand_name = cx.path_all(span, false, copy rand_ident, None, ~[ u32_ty, r_ty ]);
84+
let rand_name = cx.path_all(span, true, copy rand_ident, None, ~[ uint_ty, r_ty ]);
8585
let rand_name = cx.expr_path(rand_name);
8686

87+
// ::std::rand::Rand::rand::<uint>(rng)
8788
let rv_call = cx.expr_call(span,
8889
rand_name,
8990
~[ rng[0].duplicate(cx) ]);
9091

9192
// rand() % variants.len()
9293
let rand_variant = cx.expr_binary(span, ast::rem,
93-
rv_call, variant_count);
94+
rv_call, variant_count);
9495

9596
let mut arms = do variants.mapi |i, id_sum| {
9697
let i_expr = cx.expr_uint(span, i);
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// xfail-test #7103 `extern mod` does not work on windows
2+
3+
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
4+
// file at the top-level directory of this distribution and at
5+
// http://rust-lang.org/COPYRIGHT.
6+
//
7+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
8+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
9+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
10+
// option. This file may not be copied, modified, or distributed
11+
// except according to those terms.
12+
13+
extern mod extra; // {En,De}codable
14+
mod submod {
15+
// if any of these are implemented without global calls for any
16+
// function calls, then being in a submodule will (correctly)
17+
// cause errors about unrecognised module `std` (or `extra`)
18+
#[deriving(Eq, Ord, TotalEq, TotalOrd,
19+
IterBytes,
20+
Clone, DeepClone,
21+
ToStr, Rand,
22+
Encodable, Decodable)]
23+
enum A { A1(uint), A2(int) }
24+
25+
#[deriving(Eq, Ord, TotalEq, TotalOrd,
26+
IterBytes,
27+
Clone, DeepClone,
28+
ToStr, Rand,
29+
Encodable, Decodable)]
30+
struct B { x: uint, y: int }
31+
32+
#[deriving(Eq, Ord, TotalEq, TotalOrd,
33+
IterBytes,
34+
Clone, DeepClone,
35+
ToStr, Rand,
36+
Encodable, Decodable)]
37+
struct C(uint, int);
38+
39+
}
40+
41+
fn main() {}

0 commit comments

Comments
 (0)