Skip to content

Commit 4e957f5

Browse files
committed
---
yaml --- r: 193359 b: refs/heads/beta c: c6b6603 h: refs/heads/master i: 193357: 4fac9a3 193355: c075c34 193351: 8dc827a 193343: b9dcc14 v: v3
1 parent fa51fce commit 4e957f5

File tree

131 files changed

+1574
-1752
lines changed

Some content is hidden

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

131 files changed

+1574
-1752
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ refs/heads/automation-fail: 1bf06495443584539b958873e04cc2f864ab10e4
3131
refs/heads/issue-18208-method-dispatch-3-quick-reject: 2009f85b9f99dedcec4404418eda9ddba90258a2
3232
refs/heads/batch: b7fd822592a4fb577552d93010c4a4e14f314346
3333
refs/heads/building: 126db549b038c84269a1e4fe46f051b2c15d6970
34-
refs/heads/beta: d7a44beb55cd1180acb3e49309ab7585cbf2503a
34+
refs/heads/beta: c6b66034d61581ff32effa5929de97143f4b38e3
3535
refs/heads/windistfix: 7608dbad651f02e837ed05eef3d74a6662a6e928
3636
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
3737
refs/heads/tmp: de8a23bbc3a7b9cbd7574b5b91a34af59bf030e6

branches/beta/src/compiletest/runtest.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ fn run_rfail_test(config: &Config, props: &TestProps, testfile: &Path) {
127127
};
128128

129129
// The value our Makefile configures valgrind to return on failure
130-
const VALGRIND_ERR: int = 100;
130+
static VALGRIND_ERR: int = 100;
131131
if proc_res.status.matches_exit_status(VALGRIND_ERR) {
132132
fatal_proc_rec("run-fail test isn't valgrind-clean!", &proc_res);
133133
}
@@ -139,7 +139,7 @@ fn run_rfail_test(config: &Config, props: &TestProps, testfile: &Path) {
139139

140140
fn check_correct_failure_status(proc_res: &ProcRes) {
141141
// The value the rust runtime returns on failure
142-
const RUST_ERR: int = 101;
142+
static RUST_ERR: int = 101;
143143
if !proc_res.status.matches_exit_status(RUST_ERR) {
144144
fatal_proc_rec(
145145
&format!("failure produced the wrong error: {:?}",

branches/beta/src/compiletest/util.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use common::Config;
1414
use std::env;
1515

1616
/// Conversion table from triple OS name to Rust SYSNAME
17-
const OS_TABLE: &'static [(&'static str, &'static str)] = &[
17+
static OS_TABLE: &'static [(&'static str, &'static str)] = &[
1818
("mingw32", "windows"),
1919
("win32", "windows"),
2020
("windows", "windows"),

branches/beta/src/doc/intro.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -510,10 +510,10 @@ numbers[1] is 3
510510
numbers[0] is 2
511511
```
512512
513-
Each time, we can get a slightly different output because the threads are not
514-
guaranteed to run in any set order. If you get the same order every time it is
515-
because each of these threads are very small and complete too fast for their
516-
indeterminate behavior to surface.
513+
Each time, we can get a slithtly different output because the threads
514+
are not quaranteed to run in any set order. If you get the same order
515+
every time it is because each of these threads are very small and
516+
complete too fast for their indeterminate behavior to surface.
517517
518518
The important part here is that the Rust compiler was able to use ownership to
519519
give us assurance _at compile time_ that we weren't doing something incorrect

branches/beta/src/doc/reference.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2495,12 +2495,6 @@ The currently implemented features of the reference compiler are:
24952495

24962496
* `staged_api` - Allows usage of stability markers and `#![staged_api]` in a crate
24972497

2498-
* `static_assert` - The `#[static_assert]` functionality is experimental and
2499-
unstable. The attribute can be attached to a `static` of
2500-
type `bool` and the compiler will error if the `bool` is
2501-
`false` at compile time. This version of this functionality
2502-
is unintuitive and suboptimal.
2503-
25042498
* `start` - Allows use of the `#[start]` attribute, which changes the entry point
25052499
into a Rust program. This capabiilty, especially the signature for the
25062500
annotated function, is subject to change.

branches/beta/src/doc/trpl/guessing-game.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -422,11 +422,11 @@ In this case, we say `x` is a `u32` explicitly, so Rust is able to properly
422422
tell `random()` what to generate. In a similar fashion, both of these work:
423423
424424
```{rust,ignore}
425-
let input_num_option = "5".parse::<u32>().ok(); // input_num: Option<u32>
426-
let input_num_result: Result<u32, _> = "5".parse(); // input_num: Result<u32, <u32 as FromStr>::Err>
425+
let input_num = "5".parse::<u32>(); // input_num: Option<u32>
426+
let input_num: Result<u32, _> = "5".parse(); // input_num: Result<u32, <u32 as FromStr>::Err>
427427
```
428428
429-
Above, we're converting the `Result` returned by `parse` to an `Option` by using
429+
Here we're converting the `Result` returned by `parse` to an `Option` by using
430430
the `ok` method as well. Anyway, with us now converting our input to a number,
431431
our code looks like this:
432432
@@ -470,14 +470,14 @@ Let's try it out!
470470
```bash
471471
$ cargo build
472472
Compiling guessing_game v0.0.1 (file:///home/you/projects/guessing_game)
473-
src/main.rs:21:15: 21:24 error: mismatched types: expected `u32`, found `core::result::Result<u32, core::num::ParseIntError>` (expected u32, found enum `core::result::Result`) [E0308]
474-
src/main.rs:21 match cmp(input_num, secret_number) {
473+
src/main.rs:22:15: 22:24 error: mismatched types: expected `u32` but found `core::option::Option<u32>` (expected u32 but found enum core::option::Option)
474+
src/main.rs:22 match cmp(input_num, secret_number) {
475475
^~~~~~~~~
476476
error: aborting due to previous error
477477
```
478478
479-
Oh yeah! Our `input_num` has the type `Result<u32, <some error>>`, rather than `u32`. We
480-
need to unwrap the Result. If you remember from before, `match` is a great way
479+
Oh yeah! Our `input_num` has the type `Option<u32>`, rather than `u32`. We
480+
need to unwrap the Option. If you remember from before, `match` is a great way
481481
to do that. Try this code:
482482
483483
```{rust,no_run}
@@ -500,7 +500,7 @@ fn main() {
500500
let input_num: Result<u32, _> = input.parse();
501501

502502
let num = match input_num {
503-
Ok(n) => n,
503+
Ok(num) => num,
504504
Err(_) => {
505505
println!("Please input a number!");
506506
return;
@@ -524,7 +524,7 @@ fn cmp(a: u32, b: u32) -> Ordering {
524524
}
525525
```
526526
527-
We use a `match` to either give us the `u32` inside of the `Result`, or else
527+
We use a `match` to either give us the `u32` inside of the `Option`, or else
528528
print an error message and return. Let's give this a shot:
529529
530530
```bash

branches/beta/src/etc/unicode.py

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -290,11 +290,11 @@ def emit_bsearch_range_table(f):
290290
fn bsearch_range_table(c: char, r: &'static [(char,char)]) -> bool {
291291
use core::cmp::Ordering::{Equal, Less, Greater};
292292
use core::slice::SliceExt;
293-
r.binary_search_by(|&(lo,hi)| {
293+
r.binary_search(|&(lo,hi)| {
294294
if lo <= c && c <= hi { Equal }
295295
else if hi < c { Less }
296296
else { Greater }
297-
}).is_ok()
297+
}).found().is_some()
298298
}\n
299299
""")
300300

@@ -303,7 +303,7 @@ def emit_table(f, name, t_data, t_type = "&'static [(char, char)]", is_pub=True,
303303
pub_string = ""
304304
if is_pub:
305305
pub_string = "pub "
306-
f.write(" %sconst %s: %s = &[\n" % (pub_string, name, t_type))
306+
f.write(" %sstatic %s: %s = &[\n" % (pub_string, name, t_type))
307307
data = ""
308308
first = True
309309
for dat in t_data:
@@ -329,14 +329,14 @@ def emit_property_module(f, mod, tbl, emit_fn):
329329
def emit_regex_module(f, cats, w_data):
330330
f.write("pub mod regex {\n")
331331
regex_class = "&'static [(char, char)]"
332-
class_table = "&'static [(&'static str, %s)]" % regex_class
332+
class_table = "&'static [(&'static str, &'static %s)]" % regex_class
333333

334334
emit_table(f, "UNICODE_CLASSES", cats, class_table,
335-
pfun=lambda x: "(\"%s\",super::%s::%s_table)" % (x[0], x[1], x[0]))
335+
pfun=lambda x: "(\"%s\",&super::%s::%s_table)" % (x[0], x[1], x[0]))
336336

337-
f.write(" pub const PERLD: %s = super::general_category::Nd_table;\n\n"
337+
f.write(" pub static PERLD: &'static %s = &super::general_category::Nd_table;\n\n"
338338
% regex_class)
339-
f.write(" pub const PERLS: %s = super::property::White_Space_table;\n\n"
339+
f.write(" pub static PERLS: &'static %s = &super::property::White_Space_table;\n\n"
340340
% regex_class)
341341

342342
emit_table(f, "PERLW", w_data, regex_class)
@@ -350,7 +350,7 @@ def emit_conversions_module(f, lowerupper, upperlower):
350350
use core::slice::SliceExt;
351351
use core::option::Option;
352352
use core::option::Option::{Some, None};
353-
use core::result::Result::{Ok, Err};
353+
use core::slice;
354354
355355
pub fn to_lower(c: char) -> char {
356356
match bsearch_case_table(c, LuLl_table) {
@@ -367,13 +367,13 @@ def emit_conversions_module(f, lowerupper, upperlower):
367367
}
368368
369369
fn bsearch_case_table(c: char, table: &'static [(char, char)]) -> Option<usize> {
370-
match table.binary_search_by(|&(key, _)| {
370+
match table.binary_search(|&(key, _)| {
371371
if c == key { Equal }
372372
else if key < c { Less }
373373
else { Greater }
374374
}) {
375-
Ok(i) => Some(i),
376-
Err(_) => None,
375+
slice::BinarySearchResult::Found(i) => Some(i),
376+
slice::BinarySearchResult::NotFound(_) => None,
377377
}
378378
}
379379
@@ -386,9 +386,10 @@ def emit_conversions_module(f, lowerupper, upperlower):
386386

387387
def emit_grapheme_module(f, grapheme_table, grapheme_cats):
388388
f.write("""pub mod grapheme {
389+
use core::kinds::Copy;
389390
use core::slice::SliceExt;
390391
pub use self::GraphemeCat::*;
391-
use core::result::Result::{Ok, Err};
392+
use core::slice;
392393
393394
#[allow(non_camel_case_types)]
394395
#[derive(Clone, Copy)]
@@ -400,16 +401,16 @@ def emit_grapheme_module(f, grapheme_table, grapheme_cats):
400401
401402
fn bsearch_range_value_table(c: char, r: &'static [(char, char, GraphemeCat)]) -> GraphemeCat {
402403
use core::cmp::Ordering::{Equal, Less, Greater};
403-
match r.binary_search_by(|&(lo, hi, _)| {
404+
match r.binary_search(|&(lo, hi, _)| {
404405
if lo <= c && c <= hi { Equal }
405406
else if hi < c { Less }
406407
else { Greater }
407408
}) {
408-
Ok(idx) => {
409+
slice::BinarySearchResult::Found(idx) => {
409410
let (_, _, cat) = r[idx];
410411
cat
411412
}
412-
Err(_) => GC_Any
413+
slice::BinarySearchResult::NotFound(_) => GC_Any
413414
}
414415
}
415416
@@ -429,20 +430,20 @@ def emit_charwidth_module(f, width_table):
429430
f.write(" use core::option::Option;\n")
430431
f.write(" use core::option::Option::{Some, None};\n")
431432
f.write(" use core::slice::SliceExt;\n")
432-
f.write(" use core::result::Result::{Ok, Err};\n")
433+
f.write(" use core::slice;\n")
433434
f.write("""
434435
fn bsearch_range_value_table(c: char, is_cjk: bool, r: &'static [(char, char, u8, u8)]) -> u8 {
435436
use core::cmp::Ordering::{Equal, Less, Greater};
436-
match r.binary_search_by(|&(lo, hi, _, _)| {
437+
match r.binary_search(|&(lo, hi, _, _)| {
437438
if lo <= c && c <= hi { Equal }
438439
else if hi < c { Less }
439440
else { Greater }
440441
}) {
441-
Ok(idx) => {
442+
slice::BinarySearchResult::Found(idx) => {
442443
let (_, _, r_ncjk, r_cjk) = r[idx];
443444
if is_cjk { r_cjk } else { r_ncjk }
444445
}
445-
Err(_) => 1
446+
slice::BinarySearchResult::NotFound(_) => 1
446447
}
447448
}
448449
""")
@@ -529,17 +530,17 @@ def comp_pfun(char):
529530
fn bsearch_range_value_table(c: char, r: &'static [(char, char, u8)]) -> u8 {
530531
use core::cmp::Ordering::{Equal, Less, Greater};
531532
use core::slice::SliceExt;
532-
use core::result::Result::{Ok, Err};
533-
match r.binary_search_by(|&(lo, hi, _)| {
533+
use core::slice;
534+
match r.binary_search(|&(lo, hi, _)| {
534535
if lo <= c && c <= hi { Equal }
535536
else if hi < c { Less }
536537
else { Greater }
537538
}) {
538-
Ok(idx) => {
539+
slice::BinarySearchResult::Found(idx) => {
539540
let (_, _, result) = r[idx];
540541
result
541542
}
542-
Err(_) => 0
543+
slice::BinarySearchResult::NotFound(_) => 0
543544
}
544545
}\n
545546
""")
@@ -608,7 +609,7 @@ def optimize_width_table(wtable):
608609
unicode_version = re.search(pattern, readme.read()).groups()
609610
rf.write("""
610611
/// The version of [Unicode](http://www.unicode.org/)
611-
/// that the unicode parts of `CharExt` and `UnicodeStrPrelude` traits are based on.
612+
/// that the `UnicodeChar` and `UnicodeStrPrelude` traits are based on.
612613
pub const UNICODE_VERSION: (u64, u64, u64) = (%s, %s, %s);
613614
""" % unicode_version)
614615
(canon_decomp, compat_decomp, gencats, combines,

0 commit comments

Comments
 (0)