Skip to content

Commit 67cb4f6

Browse files
committed
---
yaml --- r: 127195 b: refs/heads/snap-stage3 c: e9c5c4c h: refs/heads/master i: 127193: 30b7758 127191: 9accf1e v: v3
1 parent 9eacbfe commit 67cb4f6

File tree

47 files changed

+174
-171
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+174
-171
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: 7be8f0af0393dcdb077c2f6b1653836fd3fba235
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: ef03363059f26f5215d2013da0168c4c34c5561c
4+
refs/heads/snap-stage3: e9c5c4c9bd3f9ed73a549c978a8cafe449587663
55
refs/heads/try: 502e4c045236682e9728539dc0d2b3d0b237f55c
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/libcollections/str.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1457,7 +1457,7 @@ mod tests {
14571457
109
14581458
];
14591459
assert_eq!("".as_bytes(), &[]);
1460-
assert_eq!("abc".as_bytes(), &['a' as u8, 'b' as u8, 'c' as u8]);
1460+
assert_eq!("abc".as_bytes(), b"abc");
14611461
assert_eq!("ศไทย中华Việt Nam".as_bytes(), v.as_slice());
14621462
}
14631463

@@ -1475,11 +1475,11 @@ mod tests {
14751475
fn test_as_ptr() {
14761476
let buf = "hello".as_ptr();
14771477
unsafe {
1478-
assert_eq!(*buf.offset(0), 'h' as u8);
1479-
assert_eq!(*buf.offset(1), 'e' as u8);
1480-
assert_eq!(*buf.offset(2), 'l' as u8);
1481-
assert_eq!(*buf.offset(3), 'l' as u8);
1482-
assert_eq!(*buf.offset(4), 'o' as u8);
1478+
assert_eq!(*buf.offset(0), b'h');
1479+
assert_eq!(*buf.offset(1), b'e');
1480+
assert_eq!(*buf.offset(2), b'l');
1481+
assert_eq!(*buf.offset(3), b'l');
1482+
assert_eq!(*buf.offset(4), b'o');
14831483
}
14841484
}
14851485

branches/snap-stage3/src/libcollections/string.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1040,7 +1040,7 @@ mod tests {
10401040
fn test_push_bytes() {
10411041
let mut s = String::from_str("ABC");
10421042
unsafe {
1043-
s.push_bytes([ 'D' as u8 ]);
1043+
s.push_bytes([b'D']);
10441044
}
10451045
assert_eq!(s.as_slice(), "ABCD");
10461046
}

branches/snap-stage3/src/libcore/fmt/float.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -198,11 +198,11 @@ pub fn float_to_str_bytes_common<T: Primitive + Float, U>(
198198
// Decide what sign to put in front
199199
match sign {
200200
SignNeg | SignAll if neg => {
201-
buf[end] = '-' as u8;
201+
buf[end] = b'-';
202202
end += 1;
203203
}
204204
SignAll => {
205-
buf[end] = '+' as u8;
205+
buf[end] = b'+';
206206
end += 1;
207207
}
208208
_ => ()
@@ -218,7 +218,7 @@ pub fn float_to_str_bytes_common<T: Primitive + Float, U>(
218218
// Now emit the fractional part, if any
219219
deccum = num.fract();
220220
if deccum != _0 || (limit_digits && exact && digit_count > 0) {
221-
buf[end] = '.' as u8;
221+
buf[end] = b'.';
222222
end += 1;
223223
let mut dig = 0u;
224224

@@ -269,8 +269,8 @@ pub fn float_to_str_bytes_common<T: Primitive + Float, U>(
269269
// If reached left end of number, have to
270270
// insert additional digit:
271271
if i < 0
272-
|| buf[i as uint] == '-' as u8
273-
|| buf[i as uint] == '+' as u8 {
272+
|| buf[i as uint] == b'-'
273+
|| buf[i as uint] == b'+' {
274274
for j in range(i as uint + 1, end).rev() {
275275
buf[j + 1] = buf[j];
276276
}
@@ -280,7 +280,7 @@ pub fn float_to_str_bytes_common<T: Primitive + Float, U>(
280280
}
281281

282282
// Skip the '.'
283-
if buf[i as uint] == '.' as u8 { i -= 1; continue; }
283+
if buf[i as uint] == b'.' { i -= 1; continue; }
284284

285285
// Either increment the digit,
286286
// or set to 0 if max and carry the 1.
@@ -306,14 +306,14 @@ pub fn float_to_str_bytes_common<T: Primitive + Float, U>(
306306
let mut i = buf_max_i;
307307

308308
// discover trailing zeros of fractional part
309-
while i > start_fractional_digits && buf[i] == '0' as u8 {
309+
while i > start_fractional_digits && buf[i] == b'0' {
310310
i -= 1;
311311
}
312312

313313
// Only attempt to truncate digits if buf has fractional digits
314314
if i >= start_fractional_digits {
315315
// If buf ends with '.', cut that too.
316-
if buf[i] == '.' as u8 { i -= 1 }
316+
if buf[i] == b'.' { i -= 1 }
317317

318318
// only resize buf if we actually remove digits
319319
if i < buf_max_i {
@@ -323,7 +323,7 @@ pub fn float_to_str_bytes_common<T: Primitive + Float, U>(
323323
} // If exact and trailing '.', just cut that
324324
else {
325325
let max_i = end - 1;
326-
if buf[max_i] == '.' as u8 {
326+
if buf[max_i] == b'.' {
327327
end = max_i;
328328
}
329329
}

branches/snap-stage3/src/libcore/fmt/num.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,13 @@ macro_rules! radix {
104104
}
105105
}
106106

107-
radix!(Binary, 2, "0b", x @ 0 .. 2 => '0' as u8 + x)
108-
radix!(Octal, 8, "0o", x @ 0 .. 7 => '0' as u8 + x)
109-
radix!(Decimal, 10, "", x @ 0 .. 9 => '0' as u8 + x)
110-
radix!(LowerHex, 16, "0x", x @ 0 .. 9 => '0' as u8 + x,
111-
x @ 10 ..15 => 'a' as u8 + (x - 10))
112-
radix!(UpperHex, 16, "0x", x @ 0 .. 9 => '0' as u8 + x,
113-
x @ 10 ..15 => 'A' as u8 + (x - 10))
107+
radix!(Binary, 2, "0b", x @ 0 .. 2 => b'0' + x)
108+
radix!(Octal, 8, "0o", x @ 0 .. 7 => b'0' + x)
109+
radix!(Decimal, 10, "", x @ 0 .. 9 => b'0' + x)
110+
radix!(LowerHex, 16, "0x", x @ 0 .. 9 => b'0' + x,
111+
x @ 10 ..15 => b'a' + (x - 10))
112+
radix!(UpperHex, 16, "0x", x @ 0 .. 9 => b'0' + x,
113+
x @ 10 ..15 => b'A' + (x - 10))
114114

115115
/// A radix with in the range of `2..36`.
116116
#[deriving(Clone, PartialEq)]
@@ -129,8 +129,8 @@ impl GenericRadix for Radix {
129129
fn base(&self) -> u8 { self.base }
130130
fn digit(&self, x: u8) -> u8 {
131131
match x {
132-
x @ 0 ..9 => '0' as u8 + x,
133-
x if x < self.base() => 'a' as u8 + (x - 10),
132+
x @ 0 ..9 => b'0' + x,
133+
x if x < self.base() => b'a' + (x - 10),
134134
x => fail!("number not in the range 0..{}: {}", self.base() - 1, x),
135135
}
136136
}

branches/snap-stage3/src/libcore/str.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1755,7 +1755,7 @@ impl<'a> StrSlice<'a> for &'a str {
17551755
fn lines_any(&self) -> AnyLines<'a> {
17561756
self.lines().map(|line| {
17571757
let l = line.len();
1758-
if l > 0 && line.as_bytes()[l - 1] == '\r' as u8 { line.slice(0, l - 1) }
1758+
if l > 0 && line.as_bytes()[l - 1] == b'\r' { line.slice(0, l - 1) }
17591759
else { line }
17601760
})
17611761
}

branches/snap-stage3/src/libdebug/repr.rs

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -165,11 +165,11 @@ impl<'a> ReprVisitor<'a> {
165165
}
166166

167167
pub fn write_escaped_slice(&mut self, slice: &str) -> bool {
168-
try!(self, self.writer.write(['"' as u8]));
168+
try!(self, self.writer.write([b'"']));
169169
for ch in slice.chars() {
170170
if !self.write_escaped_char(ch, true) { return false }
171171
}
172-
try!(self, self.writer.write(['"' as u8]));
172+
try!(self, self.writer.write([b'"']));
173173
true
174174
}
175175

@@ -188,7 +188,7 @@ impl<'a> ReprVisitor<'a> {
188188
inner: *const TyDesc) -> bool {
189189
let mut p = ptr as *const u8;
190190
let (sz, al) = unsafe { ((*inner).size, (*inner).align) };
191-
try!(self, self.writer.write(['[' as u8]));
191+
try!(self, self.writer.write([b'[']));
192192
let mut first = true;
193193
let mut left = len;
194194
// unit structs have 0 size, and don't loop forever.
@@ -203,7 +203,7 @@ impl<'a> ReprVisitor<'a> {
203203
p = align(unsafe { p.offset(sz as int) as uint }, al) as *const u8;
204204
left -= dec;
205205
}
206-
try!(self, self.writer.write([']' as u8]));
206+
try!(self, self.writer.write([b']']));
207207
true
208208
}
209209

@@ -263,9 +263,9 @@ impl<'a> TyVisitor for ReprVisitor<'a> {
263263

264264
fn visit_char(&mut self) -> bool {
265265
self.get::<char>(|this, &ch| {
266-
try!(this, this.writer.write(['\'' as u8]));
266+
try!(this, this.writer.write([b'\'']));
267267
if !this.write_escaped_char(ch, false) { return false }
268-
try!(this, this.writer.write(['\'' as u8]));
268+
try!(this, this.writer.write([b'\'']));
269269
true
270270
})
271271
}
@@ -310,7 +310,7 @@ impl<'a> TyVisitor for ReprVisitor<'a> {
310310
}
311311

312312
fn visit_rptr(&mut self, mtbl: uint, inner: *const TyDesc) -> bool {
313-
try!(self, self.writer.write(['&' as u8]));
313+
try!(self, self.writer.write([b'&']));
314314
self.write_mut_qualifier(mtbl);
315315
self.get::<*const u8>(|this, p| {
316316
this.visit_ptr_inner(*p, inner)
@@ -319,7 +319,7 @@ impl<'a> TyVisitor for ReprVisitor<'a> {
319319

320320
fn visit_evec_slice(&mut self, mtbl: uint, inner: *const TyDesc) -> bool {
321321
self.get::<raw::Slice<()>>(|this, s| {
322-
try!(this, this.writer.write(['&' as u8]));
322+
try!(this, this.writer.write([b'&']));
323323
this.write_mut_qualifier(mtbl);
324324
let size = unsafe {
325325
if (*inner).size == 0 { 1 } else { (*inner).size }
@@ -338,7 +338,7 @@ impl<'a> TyVisitor for ReprVisitor<'a> {
338338

339339
fn visit_enter_rec(&mut self, _n_fields: uint,
340340
_sz: uint, _align: uint) -> bool {
341-
try!(self, self.writer.write(['{' as u8]));
341+
try!(self, self.writer.write([b'{']));
342342
true
343343
}
344344

@@ -356,7 +356,7 @@ impl<'a> TyVisitor for ReprVisitor<'a> {
356356

357357
fn visit_leave_rec(&mut self, _n_fields: uint,
358358
_sz: uint, _align: uint) -> bool {
359-
try!(self, self.writer.write(['}' as u8]));
359+
try!(self, self.writer.write([b'}']));
360360
true
361361
}
362362

@@ -365,9 +365,9 @@ impl<'a> TyVisitor for ReprVisitor<'a> {
365365
try!(self, self.writer.write(name.as_bytes()));
366366
if n_fields != 0 {
367367
if named_fields {
368-
try!(self, self.writer.write(['{' as u8]));
368+
try!(self, self.writer.write([b'{']));
369369
} else {
370-
try!(self, self.writer.write(['(' as u8]));
370+
try!(self, self.writer.write([b'(']));
371371
}
372372
}
373373
true
@@ -390,17 +390,17 @@ impl<'a> TyVisitor for ReprVisitor<'a> {
390390
_sz: uint, _align: uint) -> bool {
391391
if n_fields != 0 {
392392
if named_fields {
393-
try!(self, self.writer.write(['}' as u8]));
393+
try!(self, self.writer.write([b'}']));
394394
} else {
395-
try!(self, self.writer.write([')' as u8]));
395+
try!(self, self.writer.write([b')']));
396396
}
397397
}
398398
true
399399
}
400400

401401
fn visit_enter_tup(&mut self, _n_fields: uint,
402402
_sz: uint, _align: uint) -> bool {
403-
try!(self, self.writer.write(['(' as u8]));
403+
try!(self, self.writer.write([b'(']));
404404
true
405405
}
406406

@@ -415,9 +415,9 @@ impl<'a> TyVisitor for ReprVisitor<'a> {
415415
fn visit_leave_tup(&mut self, _n_fields: uint,
416416
_sz: uint, _align: uint) -> bool {
417417
if _n_fields == 1 {
418-
try!(self, self.writer.write([',' as u8]));
418+
try!(self, self.writer.write([b',']));
419419
}
420-
try!(self, self.writer.write([')' as u8]));
420+
try!(self, self.writer.write([b')']));
421421
true
422422
}
423423

@@ -455,7 +455,7 @@ impl<'a> TyVisitor for ReprVisitor<'a> {
455455
if write {
456456
try!(self, self.writer.write(name.as_bytes()));
457457
if n_fields > 0 {
458-
try!(self, self.writer.write(['(' as u8]));
458+
try!(self, self.writer.write([b'(']));
459459
}
460460
}
461461
true
@@ -487,7 +487,7 @@ impl<'a> TyVisitor for ReprVisitor<'a> {
487487
match self.var_stk[self.var_stk.len() - 1] {
488488
Matched => {
489489
if n_fields > 0 {
490-
try!(self, self.writer.write([')' as u8]));
490+
try!(self, self.writer.write([b')']));
491491
}
492492
}
493493
_ => ()

branches/snap-stage3/src/libgetopts/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ impl Matches {
372372
}
373373

374374
fn is_arg(arg: &str) -> bool {
375-
arg.len() > 1 && arg.as_bytes()[0] == '-' as u8
375+
arg.len() > 1 && arg.as_bytes()[0] == b'-'
376376
}
377377

378378
fn find_opt(opts: &[Opt], nm: Name) -> Option<uint> {
@@ -555,7 +555,7 @@ pub fn getopts(args: &[String], optgrps: &[OptGroup]) -> Result {
555555
} else {
556556
let mut names;
557557
let mut i_arg = None;
558-
if cur.as_bytes()[1] == '-' as u8 {
558+
if cur.as_bytes()[1] == b'-' {
559559
let tail = cur.as_slice().slice(2, curlen);
560560
let tail_eq: Vec<&str> = tail.split('=').collect();
561561
if tail_eq.len() <= 1 {

branches/snap-stage3/src/libnum/bigint.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1376,7 +1376,7 @@ impl BigInt {
13761376
if buf.is_empty() { return None; }
13771377
let mut sign = Plus;
13781378
let mut start = 0;
1379-
if buf[0] == ('-' as u8) {
1379+
if buf[0] == b'-' {
13801380
sign = Minus;
13811381
start = 1;
13821382
}

branches/snap-stage3/src/libregex/test/bench.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ fn gen_text(n: uint) -> String {
159159
.collect::<Vec<u8>>();
160160
for (i, b) in bytes.mut_iter().enumerate() {
161161
if i % 20 == 0 {
162-
*b = '\n' as u8
162+
*b = b'\n'
163163
}
164164
}
165165
String::from_utf8(bytes).unwrap()

branches/snap-stage3/src/libregex_macros/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,7 @@ fn exec<'t>(which: ::regex::native::MatchKind, input: &'t str,
594594
pats: vec!(box(GC) ast::Pat{
595595
id: ast::DUMMY_NODE_ID,
596596
span: self.sp,
597-
node: ast::PatWild,
597+
node: ast::PatWild(ast::PatWildSingle),
598598
}),
599599
guard: None,
600600
body: body,

branches/snap-stage3/src/librustc/middle/cfg/construct.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ impl<'a> CFGBuilder<'a> {
112112
ast::PatEnum(_, None) |
113113
ast::PatLit(..) |
114114
ast::PatRange(..) |
115-
ast::PatWild | ast::PatWildMulti => {
115+
ast::PatWild(_) => {
116116
self.add_node(pat.id, [pred])
117117
}
118118

branches/snap-stage3/src/librustc/middle/check_match.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ fn construct_witness(cx: &MatchCheckCtxt, ctor: &Constructor,
344344
let fields = ty::lookup_struct_fields(cx.tcx, vid);
345345
let field_pats: Vec<FieldPat> = fields.move_iter()
346346
.zip(pats.iter())
347-
.filter(|&(_, pat)| pat.node != PatWild)
347+
.filter(|&(_, pat)| pat.node != PatWild(PatWildSingle))
348348
.map(|(field, pat)| FieldPat {
349349
ident: Ident::new(field.name),
350350
pat: pat.clone()
@@ -372,7 +372,7 @@ fn construct_witness(cx: &MatchCheckCtxt, ctor: &Constructor,
372372
},
373373
_ => unreachable!()
374374
},
375-
ty::ty_str => PatWild,
375+
ty::ty_str => PatWild(PatWildSingle),
376376

377377
_ => {
378378
assert_eq!(pats.len(), 1);
@@ -394,7 +394,7 @@ fn construct_witness(cx: &MatchCheckCtxt, ctor: &Constructor,
394394
_ => {
395395
match *ctor {
396396
ConstantValue(ref v) => PatLit(const_val_to_expr(v)),
397-
_ => PatWild
397+
_ => PatWild(PatWildSingle),
398398
}
399399
}
400400
};
@@ -599,7 +599,7 @@ fn pat_constructors(cx: &MatchCheckCtxt, p: Gc<Pat>,
599599
},
600600
PatBox(_) | PatTup(_) | PatRegion(..) =>
601601
vec!(Single),
602-
PatWild | PatWildMulti =>
602+
PatWild(_) =>
603603
vec!(),
604604
PatMac(_) =>
605605
cx.tcx.sess.bug("unexpanded macro")
@@ -666,10 +666,7 @@ pub fn specialize(cx: &MatchCheckCtxt, r: &[Gc<Pat>],
666666
id: pat_id, node: ref node, span: pat_span
667667
} = &(*raw_pat(r[col]));
668668
let head: Option<Vec<Gc<Pat>>> = match node {
669-
&PatWild =>
670-
Some(Vec::from_elem(arity, wild())),
671-
672-
&PatWildMulti =>
669+
&PatWild(_) =>
673670
Some(Vec::from_elem(arity, wild())),
674671

675672
&PatIdent(_, _, _) => {

0 commit comments

Comments
 (0)