Skip to content

Commit 3f4152e

Browse files
---
yaml --- r: 144951 b: refs/heads/try2 c: 382cb50 h: refs/heads/master i: 144949: 5489965 144947: b98c0a3 144943: b268c4a v: v3
1 parent 6c12d84 commit 3f4152e

File tree

35 files changed

+913
-1217
lines changed

35 files changed

+913
-1217
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: d14bd0879d7357598f4f7f49dae6661559e10745
8+
refs/heads/try2: 382cb500be6c9927805bd9cd7af6a0558333dd0f
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/libextra/num/bigint.rs

Lines changed: 0 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ use std::cmp::{Eq, Ord, TotalEq, TotalOrd, Ordering, Less, Equal, Greater};
2323
use std::int;
2424
use std::num;
2525
use std::num::{IntConvertible, Zero, One, ToStrRadix, FromStrRadix, Orderable};
26-
use std::rand::{Rng, RngUtil};
2726
use std::str;
2827
use std::uint;
2928
use std::vec;
@@ -1089,53 +1088,6 @@ impl FromStrRadix for BigInt {
10891088
}
10901089
}
10911090
1092-
trait RandBigInt {
1093-
/// Generate a random BigUint of the given bit size.
1094-
fn gen_biguint(&mut self, bit_size: uint) -> BigUint;
1095-
1096-
/// Generate a random BigInt of the given bit size.
1097-
fn gen_bigint(&mut self, bit_size: uint) -> BigInt;
1098-
}
1099-
1100-
impl<R: Rng> RandBigInt for R {
1101-
/// Generate a random BigUint of the given bit size.
1102-
fn gen_biguint(&mut self, bit_size: uint) -> BigUint {
1103-
let (digits, rem) = bit_size.div_rem(&BigDigit::bits);
1104-
let mut data = vec::with_capacity(digits+1);
1105-
for _ in range(0, digits) {
1106-
data.push(self.gen());
1107-
}
1108-
if rem > 0 {
1109-
let final_digit: BigDigit = self.gen();
1110-
data.push(final_digit >> (BigDigit::bits - rem));
1111-
}
1112-
return BigUint::new(data);
1113-
}
1114-
1115-
/// Generate a random BigInt of the given bit size.
1116-
fn gen_bigint(&mut self, bit_size: uint) -> BigInt {
1117-
// Generate a random BigUint...
1118-
let biguint = self.gen_biguint(bit_size);
1119-
// ...and then randomly assign it a Sign...
1120-
let sign = if biguint.is_zero() {
1121-
// ...except that if the BigUint is zero, we need to try
1122-
// again with probability 0.5. This is because otherwise,
1123-
// the probability of generating a zero BigInt would be
1124-
// double that of any other number.
1125-
if self.gen() {
1126-
return self.gen_bigint(bit_size);
1127-
} else {
1128-
Zero
1129-
}
1130-
} else if self.gen() {
1131-
Plus
1132-
} else {
1133-
Minus
1134-
};
1135-
return BigInt::from_biguint(sign, biguint);
1136-
}
1137-
}
1138-
11391091
impl BigInt {
11401092
/// Creates and initializes an BigInt.
11411093
#[inline]
@@ -1197,7 +1149,6 @@ mod biguint_tests {
11971149
use std::cmp::{Less, Equal, Greater};
11981150
use std::int;
11991151
use std::num::{IntConvertible, Zero, One, FromStrRadix};
1200-
use std::rand::{task_rng};
12011152
use std::str;
12021153
use std::uint;
12031154
use std::vec;
@@ -1705,13 +1656,6 @@ mod biguint_tests {
17051656
check(20, "2432902008176640000");
17061657
check(30, "265252859812191058636308480000000");
17071658
}
1708-
1709-
#[test]
1710-
fn test_rand() {
1711-
let mut rng = task_rng();
1712-
let _n: BigUint = rng.gen_biguint(137);
1713-
assert!(rng.gen_biguint(0).is_zero());
1714-
}
17151659
}
17161660

17171661
#[cfg(test)]
@@ -1721,7 +1665,6 @@ mod bigint_tests {
17211665
use std::cmp::{Less, Equal, Greater};
17221666
use std::int;
17231667
use std::num::{IntConvertible, Zero, One, FromStrRadix};
1724-
use std::rand::{task_rng};
17251668
use std::uint;
17261669

17271670
#[test]
@@ -2142,13 +2085,6 @@ mod bigint_tests {
21422085
let zero: BigInt = Zero::zero();
21432086
assert_eq!(-zero, zero);
21442087
}
2145-
2146-
#[test]
2147-
fn test_rand() {
2148-
let mut rng = task_rng();
2149-
let _n: BigInt = rng.gen_bigint(137);
2150-
assert!(rng.gen_bigint(0).is_zero());
2151-
}
21522088
}
21532089

21542090
#[cfg(test)]

branches/try2/src/librustc/lib/llvm.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2109,6 +2109,14 @@ pub mod llvm {
21092109
ArgNo: c_uint)
21102110
-> ValueRef;
21112111

2112+
#[fast_ffi]
2113+
pub fn LLVMDIBuilderCreateNameSpace(Builder: DIBuilderRef,
2114+
Scope: ValueRef,
2115+
Name: *c_char,
2116+
File: ValueRef,
2117+
LineNo: c_uint)
2118+
-> ValueRef;
2119+
21122120
#[fast_ffi]
21132121
pub fn LLVMIsAArgument(value_ref: ValueRef) -> ValueRef;
21142122

branches/try2/src/librustc/middle/cfg/construct.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ impl CFGBuilder {
488488

489489
fn find_scope(&self,
490490
expr: @ast::Expr,
491-
label: Option<ast::Name>) -> LoopScope {
491+
label: Option<ast::Ident>) -> LoopScope {
492492
match label {
493493
None => {
494494
return *self.loop_scopes.last();

branches/try2/src/librustc/middle/dataflow.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -867,7 +867,7 @@ impl<'self, O:DataFlowOperator> PropagationContext<'self, O> {
867867

868868
fn find_scope<'a>(&self,
869869
expr: @ast::Expr,
870-
label: Option<ast::Name>,
870+
label: Option<ast::Ident>,
871871
loop_scopes: &'a mut ~[LoopScope]) -> &'a mut LoopScope {
872872
let index = match label {
873873
None => {

branches/try2/src/librustc/middle/effect.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,8 @@ impl Visitor<()> for EffectCheckVisitor {
102102
fn visit_block(&mut self, block:&Block, _:()) {
103103

104104
let old_unsafe_context = self.context.unsafe_context;
105-
let is_unsafe = match block.rules {
106-
ast::UnsafeBlock(*) => true, ast::DefaultBlock => false
107-
};
108-
if is_unsafe && self.context.unsafe_context == SafeContext {
105+
if block.rules == ast::UnsafeBlock &&
106+
self.context.unsafe_context == SafeContext {
109107
self.context.unsafe_context = UnsafeBlock(block.id)
110108
}
111109

branches/try2/src/librustc/middle/lint.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1131,11 +1131,8 @@ impl Visitor<@mut Context> for UnusedUnsafeLintVisitor {
11311131
fn visit_expr(&mut self, e:@ast::Expr, cx:@mut Context) {
11321132

11331133
match e.node {
1134-
// Don't warn about generated blocks, that'll just pollute the
1135-
// output.
1136-
ast::ExprBlock(ref blk) => {
1137-
if blk.rules == ast::UnsafeBlock(ast::UserProvided) &&
1138-
!cx.tcx.used_unsafe.contains(&blk.id) {
1134+
ast::ExprBlock(ref blk) if blk.rules == ast::UnsafeBlock => {
1135+
if !cx.tcx.used_unsafe.contains(&blk.id) {
11391136
cx.span_lint(unused_unsafe, blk.span,
11401137
"unnecessary `unsafe` block");
11411138
}

branches/try2/src/librustc/middle/liveness.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -756,7 +756,7 @@ impl Liveness {
756756
}
757757

758758
pub fn find_loop_scope(&self,
759-
opt_label: Option<Name>,
759+
opt_label: Option<Ident>,
760760
id: NodeId,
761761
sp: Span)
762762
-> NodeId {

branches/try2/src/librustc/middle/resolve.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5157,13 +5157,15 @@ impl Resolver {
51575157
ExprForLoop(*) => fail!("non-desugared expr_for_loop"),
51585158

51595159
ExprBreak(Some(label)) | ExprAgain(Some(label)) => {
5160-
match self.search_ribs(self.label_ribs, label, expr.span,
5160+
let name = label.name;
5161+
match self.search_ribs(self.label_ribs, name, expr.span,
51615162
DontAllowCapturingSelf) {
51625163
None =>
51635164
self.resolve_error(expr.span,
51645165
fmt!("use of undeclared label \
51655166
`%s`",
5166-
interner_get(label))),
5167+
self.session.str_of(
5168+
label))),
51675169
Some(DlDef(def @ DefLabel(_))) => {
51685170
self.record_def(expr.id, def)
51695171
}

branches/try2/src/librustc/middle/trans/base.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ use std::vec;
7676
use std::local_data;
7777
use extra::time;
7878
use extra::sort;
79-
use syntax::ast::Name;
79+
use syntax::ast::Ident;
8080
use syntax::ast_map::{path, path_elt_to_str, path_name, path_pretty_name};
8181
use syntax::ast_util::{local_def};
8282
use syntax::attr;
@@ -1189,7 +1189,7 @@ pub fn scope_block(bcx: @mut Block,
11891189

11901190
pub fn loop_scope_block(bcx: @mut Block,
11911191
loop_break: @mut Block,
1192-
loop_label: Option<Name>,
1192+
loop_label: Option<Ident>,
11931193
n: &str,
11941194
opt_node_info: Option<NodeInfo>) -> @mut Block {
11951195
return new_block(bcx.fcx, Some(bcx), Some(@mut ScopeInfo {

branches/try2/src/librustc/middle/trans/common.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ use std::cast;
3838
use std::hashmap::{HashMap};
3939
use std::libc::{c_uint, c_longlong, c_ulonglong, c_char};
4040
use std::vec;
41-
use syntax::ast::{Name,Ident};
41+
use syntax::ast::Ident;
4242
use syntax::ast_map::{path, path_elt, path_pretty_name};
4343
use syntax::codemap::Span;
4444
use syntax::parse::token;
@@ -463,7 +463,7 @@ pub fn block_cleanups(bcx: @mut Block) -> ~[cleanup] {
463463
pub struct ScopeInfo {
464464
parent: Option<@mut ScopeInfo>,
465465
loop_break: Option<@mut Block>,
466-
loop_label: Option<Name>,
466+
loop_label: Option<Ident>,
467467
// A list of functions that must be run at when leaving this
468468
// block, cleaning up any variables that were introduced in the
469469
// block.

branches/try2/src/librustc/middle/trans/controlflow.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use util::ppaux;
2222
use middle::trans::type_::Type;
2323

2424
use syntax::ast;
25-
use syntax::ast::Name;
25+
use syntax::ast::Ident;
2626
use syntax::ast_util;
2727
use syntax::codemap::Span;
2828

@@ -188,7 +188,7 @@ pub fn trans_while(bcx: @mut Block, cond: @ast::Expr, body: &ast::Block) -> @mut
188188

189189
pub fn trans_loop(bcx:@mut Block,
190190
body: &ast::Block,
191-
opt_label: Option<Name>)
191+
opt_label: Option<Ident>)
192192
-> @mut Block {
193193
let _icx = push_ctxt("trans_loop");
194194
let next_bcx = sub_block(bcx, "next");
@@ -201,7 +201,7 @@ pub fn trans_loop(bcx:@mut Block,
201201
}
202202

203203
pub fn trans_break_cont(bcx: @mut Block,
204-
opt_label: Option<Name>,
204+
opt_label: Option<Ident>,
205205
to_end: bool)
206206
-> @mut Block {
207207
let _icx = push_ctxt("trans_break_cont");
@@ -254,11 +254,11 @@ pub fn trans_break_cont(bcx: @mut Block,
254254
return bcx;
255255
}
256256

257-
pub fn trans_break(bcx: @mut Block, label_opt: Option<Name>) -> @mut Block {
257+
pub fn trans_break(bcx: @mut Block, label_opt: Option<Ident>) -> @mut Block {
258258
return trans_break_cont(bcx, label_opt, true);
259259
}
260260

261-
pub fn trans_cont(bcx: @mut Block, label_opt: Option<Name>) -> @mut Block {
261+
pub fn trans_cont(bcx: @mut Block, label_opt: Option<Ident>) -> @mut Block {
262262
return trans_break_cont(bcx, label_opt, false);
263263
}
264264

branches/try2/src/librustc/middle/trans/expr.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -617,8 +617,7 @@ fn trans_rvalue_stmt_unadjusted(bcx: @mut Block, expr: @ast::Expr) -> @mut Block
617617
return controlflow::trans_while(bcx, cond, body);
618618
}
619619
ast::ExprLoop(ref body, opt_label) => {
620-
// FIXME #6993: map can go away when ast.rs is changed
621-
return controlflow::trans_loop(bcx, body, opt_label.map(|x| x.name));
620+
return controlflow::trans_loop(bcx, body, opt_label);
622621
}
623622
ast::ExprAssign(dst, src) => {
624623
let src_datum = unpack_datum!(

branches/try2/src/librustc/middle/ty.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4266,7 +4266,8 @@ pub fn is_binopable(cx: ctxt, ty: t, op: ast::BinOp) -> bool {
42664266
static tycat_char: int = 2;
42674267
static tycat_int: int = 3;
42684268
static tycat_float: int = 4;
4269-
static tycat_bot: int = 5;
4269+
static tycat_struct: int = 5;
4270+
static tycat_bot: int = 6;
42704271

42714272
static opcat_add: int = 0;
42724273
static opcat_sub: int = 1;
@@ -4309,6 +4310,7 @@ pub fn is_binopable(cx: ctxt, ty: t, op: ast::BinOp) -> bool {
43094310
ty_bool => tycat_bool,
43104311
ty_int(_) | ty_uint(_) | ty_infer(IntVar(_)) => tycat_int,
43114312
ty_float(_) | ty_infer(FloatVar(_)) => tycat_float,
4313+
ty_tup(_) | ty_enum(_, _) => tycat_struct,
43124314
ty_bot => tycat_bot,
43134315
_ => tycat_other
43144316
}
@@ -4324,7 +4326,8 @@ pub fn is_binopable(cx: ctxt, ty: t, op: ast::BinOp) -> bool {
43244326
/*char*/ [f, f, f, f, t, t, f, f],
43254327
/*int*/ [t, t, t, t, t, t, t, f],
43264328
/*float*/ [t, t, t, f, t, t, f, f],
4327-
/*bot*/ [t, t, t, t, f, f, t, t]];
4329+
/*bot*/ [f, f, f, f, f, f, f, f],
4330+
/*struct*/ [t, t, t, t, f, f, t, t]];
43284331

43294332
return tbl[tycat(cx, ty)][opcat(op)];
43304333
}

branches/try2/src/librustc/middle/typeck/check/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ impl PurityState {
200200

201201
purity => {
202202
let (purity, def) = match blk.rules {
203-
ast::UnsafeBlock(*) => (ast::unsafe_fn, blk.id),
203+
ast::UnsafeBlock => (ast::unsafe_fn, blk.id),
204204
ast::DefaultBlock => (purity, self.def),
205205
};
206206
PurityState{ def: def,

branches/try2/src/librustpkg/api.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ pub fn default_context(p: Path) -> BuildContext {
2929
pub fn new_default_context(c: workcache::Context, p: Path) -> BuildContext {
3030
BuildContext {
3131
context: Context {
32-
cfgs: ~[],
33-
rustc_flags: RustcFlags::default(),
3432
use_rust_path_hack: false,
3533
sysroot: p
3634
},
@@ -46,6 +44,7 @@ fn binary_is_fresh(path: &str, in_hash: &str) -> bool {
4644
in_hash == digest_only_date(&Path(path))
4745
}
4846

47+
4948
pub fn new_workcache_context(p: &Path) -> workcache::Context {
5049
let db_file = p.push("rustpkg_db.json"); // ??? probably wrong
5150
debug!("Workcache database file: %s", db_file.to_str());

0 commit comments

Comments
 (0)