Skip to content

Commit d7c5faa

Browse files
committed
---
yaml --- r: 152620 b: refs/heads/try2 c: f2dd4f3 h: refs/heads/master v: v3
1 parent e793982 commit d7c5faa

File tree

28 files changed

+523
-777
lines changed

28 files changed

+523
-777
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: 410d70b5af30a4e5d566b981c9bf1b10b12b796b
8+
refs/heads/try2: f2dd4f3c065193e869d6feeb15d95d6495e7bd50
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/doc/rust.md

Lines changed: 6 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ rule. A literal is a form of constant expression, so is evaluated (primarily)
234234
at compile time.
235235

236236
~~~~ {.ebnf .gram}
237-
literal : string_lit | char_lit | byte_string_lit | byte_lit | num_lit ;
237+
literal : string_lit | char_lit | num_lit ;
238238
~~~~
239239

240240
#### Character and string literals
@@ -244,17 +244,17 @@ char_lit : '\x27' char_body '\x27' ;
244244
string_lit : '"' string_body * '"' | 'r' raw_string ;
245245
246246
char_body : non_single_quote
247-
| '\x5c' [ '\x27' | common_escape | unicode_escape ] ;
247+
| '\x5c' [ '\x27' | common_escape ] ;
248248
249249
string_body : non_double_quote
250-
| '\x5c' [ '\x22' | common_escape | unicode_escape ] ;
250+
| '\x5c' [ '\x22' | common_escape ] ;
251251
raw_string : '"' raw_string_body '"' | '#' raw_string '#' ;
252252
253253
common_escape : '\x5c'
254254
| 'n' | 'r' | 't' | '0'
255255
| 'x' hex_digit 2
256-
unicode_escape : 'u' hex_digit 4
257-
| 'U' hex_digit 8 ;
256+
| 'u' hex_digit 4
257+
| 'U' hex_digit 8 ;
258258
259259
hex_digit : 'a' | 'b' | 'c' | 'd' | 'e' | 'f'
260260
| 'A' | 'B' | 'C' | 'D' | 'E' | 'F'
@@ -294,7 +294,7 @@ the following forms:
294294
escaped in order to denote *itself*.
295295

296296
Raw string literals do not process any escapes. They start with the character
297-
`U+0072` (`r`), followed by zero or more of the character `U+0023` (`#`) and a
297+
`U+0072` (`r`), followed zero or more of the character `U+0023` (`#`) and a
298298
`U+0022` (double-quote) character. The _raw string body_ is not defined in the
299299
EBNF grammar above: it can contain any sequence of Unicode characters and is
300300
terminated only by another `U+0022` (double-quote) character, followed by the
@@ -319,65 +319,6 @@ r##"foo #"# bar"##; // foo #"# bar
319319
"\\x52"; r"\x52"; // \x52
320320
~~~~
321321

322-
#### Byte and byte string literals
323-
324-
~~~~ {.ebnf .gram}
325-
byte_lit : 'b' '\x27' byte_body '\x27' ;
326-
byte_string_lit : 'b' '"' string_body * '"' | 'b' 'r' raw_byte_string ;
327-
328-
byte_body : ascii_non_single_quote
329-
| '\x5c' [ '\x27' | common_escape ] ;
330-
331-
byte_string_body : ascii_non_double_quote
332-
| '\x5c' [ '\x22' | common_escape ] ;
333-
raw_byte_string : '"' raw_byte_string_body '"' | '#' raw_byte_string '#' ;
334-
335-
~~~~
336-
337-
A _byte literal_ is a single ASCII character (in the `U+0000` to `U+007F` range)
338-
enclosed within two `U+0027` (single-quote) characters,
339-
with the exception of `U+0027` itself,
340-
which must be _escaped_ by a preceding U+005C character (`\`),
341-
or a single _escape_.
342-
It is equivalent to a `u8` unsigned 8-bit integer _number literal_.
343-
344-
A _byte string literal_ is a sequence of ASCII characters and _escapes_
345-
enclosed within two `U+0022` (double-quote) characters,
346-
with the exception of `U+0022` itself,
347-
which must be _escaped_ by a preceding `U+005C` character (`\`),
348-
or a _raw byte string literal_.
349-
It is equivalent to a `&'static [u8]` borrowed vectior unsigned 8-bit integers.
350-
351-
Some additional _escapes_ are available in either byte or non-raw byte string
352-
literals. An escape starts with a `U+005C` (`\`) and continues with one of
353-
the following forms:
354-
355-
* An _byte escape_ escape starts with `U+0078` (`x`) and is
356-
followed by exactly two _hex digits_. It denotes the byte
357-
equal to the provided hex value.
358-
* A _whitespace escape_ is one of the characters `U+006E` (`n`), `U+0072`
359-
(`r`), or `U+0074` (`t`), denoting the bytes values `0x0A` (ASCII LF),
360-
`0x0D` (ASCII CR) or `0x09` (ASCII HT) respectively.
361-
* The _backslash escape_ is the character `U+005C` (`\`) which must be
362-
escaped in order to denote its ASCII encoding `0x5C`.
363-
364-
Raw byte string literals do not process any escapes.
365-
They start with the character `U+0072` (`r`),
366-
followed by `U+0062` (`b`),
367-
followed by zero or more of the character `U+0023` (`#`),
368-
and a `U+0022` (double-quote) character.
369-
The _raw string body_ is not defined in the EBNF grammar above:
370-
it can contain any sequence of ASCII characters and is
371-
terminated only by another `U+0022` (double-quote) character, followed by the
372-
same number of `U+0023` (`#`) characters that preceded the opening `U+0022`
373-
(double-quote) character.
374-
A raw byte string literal can not contain any non-ASCII byte.
375-
376-
All characters contained in the raw string body represent their ASCII encoding,
377-
the characters `U+0022` (double-quote) (except when followed by at least as
378-
many `U+0023` (`#`) characters as were used to start the raw string literal) or
379-
`U+005C` (`\`) do not have any special meaning.
380-
381322
#### Number literals
382323

383324
~~~~ {.ebnf .gram}

branches/try2/src/libcore/option.rs

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -574,17 +574,13 @@ impl<A> ExactSize<A> for Item<A> {}
574574
/// Here is an example which increments every integer in a vector,
575575
/// checking for overflow:
576576
///
577-
/// ```rust
578-
/// use std::option;
579-
/// use std::uint;
580-
///
581-
/// let v = vec!(1u, 2u);
582-
/// let res: Option<Vec<uint>> = option::collect(v.iter().map(|x: &uint|
583-
/// if *x == uint::MAX { None }
584-
/// else { Some(x + 1) }
585-
/// ));
586-
/// assert!(res == Some(vec!(2u, 3u)));
587-
/// ```
577+
/// fn inc_conditionally(x: uint) -> Option<uint> {
578+
/// if x == uint::MAX { return None; }
579+
/// else { return Some(x+1u); }
580+
/// }
581+
/// let v = [1u, 2, 3];
582+
/// let res = collect(v.iter().map(|&x| inc_conditionally(x)));
583+
/// assert!(res == Some(~[2u, 3, 4]));
588584
#[inline]
589585
pub fn collect<T, Iter: Iterator<Option<T>>, V: FromIterator<T>>(iter: Iter) -> Option<V> {
590586
// FIXME(#11084): This should be twice as fast once this bug is closed.

branches/try2/src/libcore/result.rs

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -572,17 +572,13 @@ impl<T: Show, E> Result<T, E> {
572572
/// Here is an example which increments every integer in a vector,
573573
/// checking for overflow:
574574
///
575-
/// ```rust
576-
/// use std::result;
577-
/// use std::uint;
578-
///
579-
/// let v = vec!(1u, 2u);
580-
/// let res: Result<Vec<uint>, &'static str> = result::collect(v.iter().map(|x: &uint|
581-
/// if *x == uint::MAX { Err("Overflow!") }
582-
/// else { Ok(x + 1) }
583-
/// ));
584-
/// assert!(res == Ok(vec!(2u, 3u)));
585-
/// ```
575+
/// fn inc_conditionally(x: uint) -> Result<uint, &'static str> {
576+
/// if x == uint::MAX { return Err("overflow"); }
577+
/// else { return Ok(x+1u); }
578+
/// }
579+
/// let v = [1u, 2, 3];
580+
/// let res = collect(v.iter().map(|&x| inc_conditionally(x)));
581+
/// assert!(res == Ok(~[2u, 3, 4]));
586582
#[inline]
587583
pub fn collect<T, E, Iter: Iterator<Result<T, E>>, V: FromIterator<T>>(iter: Iter) -> Result<V, E> {
588584
// FIXME(#11084): This should be twice as fast once this bug is closed.

branches/try2/src/libcore/str.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -560,8 +560,6 @@ Section: Comparing strings
560560

561561
// share the implementation of the lang-item vs. non-lang-item
562562
// eq_slice.
563-
/// NOTE: This function is (ab)used in rustc::middle::trans::_match
564-
/// to compare &[u8] byte slices that are not necessarily valid UTF-8.
565563
#[inline]
566564
fn eq_slice_(a: &str, b: &str) -> bool {
567565
#[allow(ctypes)]
@@ -574,8 +572,6 @@ fn eq_slice_(a: &str, b: &str) -> bool {
574572
}
575573

576574
/// Bytewise slice equality
577-
/// NOTE: This function is (ab)used in rustc::middle::trans::_match
578-
/// to compare &[u8] byte slices that are not necessarily valid UTF-8.
579575
#[cfg(not(test))]
580576
#[lang="str_eq"]
581577
#[inline]

branches/try2/src/libregex_macros/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ fn exec<'t>(which: ::regex::native::MatchKind, input: &'t str,
182182
#[allow(unused_variable)]
183183
fn run(&mut self, start: uint, end: uint) -> Vec<Option<uint>> {
184184
let mut matched = false;
185-
let prefix_bytes: &[u8] = $prefix_bytes;
185+
let prefix_bytes: &[u8] = &$prefix_bytes;
186186
let mut clist = &mut Threads::new(self.which);
187187
let mut nlist = &mut Threads::new(self.which);
188188

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,6 @@ pub fn lit_to_const(lit: &Lit) -> const_val {
506506
LitBinary(ref data) => {
507507
const_binary(Rc::new(data.iter().map(|x| *x).collect()))
508508
}
509-
LitByte(n) => const_uint(n as u64),
510509
LitChar(n) => const_uint(n as u64),
511510
LitInt(n, _) => const_int(n),
512511
LitUint(n, _) => const_uint(n),
@@ -529,7 +528,6 @@ pub fn compare_const_vals(a: &const_val, b: &const_val) -> Option<int> {
529528
(&const_float(a), &const_float(b)) => compare_vals(a, b),
530529
(&const_str(ref a), &const_str(ref b)) => compare_vals(a, b),
531530
(&const_bool(a), &const_bool(b)) => compare_vals(a, b),
532-
(&const_binary(ref a), &const_binary(ref b)) => compare_vals(a, b),
533531
_ => None
534532
}
535533
}

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -805,7 +805,6 @@ fn check_type_limits(cx: &Context, e: &ast::Expr) {
805805
} else { t };
806806
let (min, max) = uint_ty_range(uint_type);
807807
let lit_val: u64 = match lit.node {
808-
ast::LitByte(_v) => return, // _v is u8, within range by definition
809808
ast::LitInt(v, _) => v as u64,
810809
ast::LitUint(v, _) => v,
811810
ast::LitIntUnsuffixed(v) => v as u64,

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

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1273,24 +1273,13 @@ fn compare_values<'a>(
12731273
val: bool_to_i1(result.bcx, result.val)
12741274
}
12751275
}
1276-
_ => cx.sess().bug("only strings supported in compare_values"),
1276+
_ => cx.sess().bug("only scalars and strings supported in compare_values"),
12771277
},
12781278
ty::ty_rptr(_, mt) => match ty::get(mt.ty).sty {
12791279
ty::ty_str => compare_str(cx, lhs, rhs, rhs_t),
1280-
ty::ty_vec(mt, _) => match ty::get(mt.ty).sty {
1281-
ty::ty_uint(ast::TyU8) => {
1282-
// NOTE: cast &[u8] to &str and abuse the str_eq lang item,
1283-
// which calls memcmp().
1284-
let t = ty::mk_str_slice(cx.tcx(), ty::ReStatic, ast::MutImmutable);
1285-
let lhs = BitCast(cx, lhs, type_of::type_of(cx.ccx(), t).ptr_to());
1286-
let rhs = BitCast(cx, rhs, type_of::type_of(cx.ccx(), t).ptr_to());
1287-
compare_str(cx, lhs, rhs, rhs_t)
1288-
},
1289-
_ => cx.sess().bug("only byte strings supported in compare_values"),
1290-
},
1291-
_ => cx.sess().bug("on string and byte strings supported in compare_values"),
1280+
_ => cx.sess().bug("only scalars and strings supported in compare_values"),
12921281
},
1293-
_ => cx.sess().bug("only scalars, byte strings, and strings supported in compare_values"),
1282+
_ => cx.sess().bug("only scalars and strings supported in compare_values"),
12941283
}
12951284
}
12961285

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ pub fn const_lit(cx: &CrateContext, e: &ast::Expr, lit: ast::Lit)
4343
-> ValueRef {
4444
let _icx = push_ctxt("trans_lit");
4545
match lit.node {
46-
ast::LitByte(b) => C_integral(Type::uint_from_ty(cx, ast::TyU8), b as u64, false),
4746
ast::LitChar(i) => C_integral(Type::char(cx), i as u64, false),
4847
ast::LitInt(i, t) => C_integral(Type::int_from_ty(cx, t), i as u64, true),
4948
ast::LitUint(u, t) => C_integral(Type::uint_from_ty(cx, t), u, false),

0 commit comments

Comments
 (0)