Skip to content

Commit 0251a17

Browse files
committed
---
yaml --- r: 177526 b: refs/heads/master c: d8e1236 h: refs/heads/master v: v3
1 parent bf4001b commit 0251a17

File tree

483 files changed

+6382
-3962
lines changed

Some content is hidden

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

483 files changed

+6382
-3962
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 42e4c1aef6594aac2d27b4bb31896e023863817d
2+
refs/heads/master: d8e12365cd489d16058c8f5b718ada62d69d0e5b
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: a45e117733b866302fa99390553d1c548508dcca
55
refs/heads/try: fde4472848b662a4d1236388c4cf15e2450237e6

trunk/src/compiletest/common.rs

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,20 @@ pub use self::Mode::*;
1212
use std::fmt;
1313
use std::str::FromStr;
1414

15+
#[cfg(stage0)] // NOTE: remove impl after snapshot
16+
#[derive(Clone, Copy, PartialEq, Show)]
17+
pub enum Mode {
18+
CompileFail,
19+
RunFail,
20+
RunPass,
21+
RunPassValgrind,
22+
Pretty,
23+
DebugInfoGdb,
24+
DebugInfoLldb,
25+
Codegen
26+
}
27+
28+
#[cfg(not(stage0))] // NOTE: remove cfg after snapshot
1529
#[derive(Clone, Copy, PartialEq, Debug)]
1630
pub enum Mode {
1731
CompileFail,
@@ -25,18 +39,17 @@ pub enum Mode {
2539
}
2640

2741
impl FromStr for Mode {
28-
type Err = ();
29-
fn from_str(s: &str) -> Result<Mode, ()> {
42+
fn from_str(s: &str) -> Option<Mode> {
3043
match s {
31-
"compile-fail" => Ok(CompileFail),
32-
"run-fail" => Ok(RunFail),
33-
"run-pass" => Ok(RunPass),
34-
"run-pass-valgrind" => Ok(RunPassValgrind),
35-
"pretty" => Ok(Pretty),
36-
"debuginfo-lldb" => Ok(DebugInfoLldb),
37-
"debuginfo-gdb" => Ok(DebugInfoGdb),
38-
"codegen" => Ok(Codegen),
39-
_ => Err(()),
44+
"compile-fail" => Some(CompileFail),
45+
"run-fail" => Some(RunFail),
46+
"run-pass" => Some(RunPass),
47+
"run-pass-valgrind" => Some(RunPassValgrind),
48+
"pretty" => Some(Pretty),
49+
"debuginfo-lldb" => Some(DebugInfoLldb),
50+
"debuginfo-gdb" => Some(DebugInfoGdb),
51+
"codegen" => Some(Codegen),
52+
_ => None,
4053
}
4154
}
4255
}

trunk/src/compiletest/compiletest.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
#![feature(os)]
2424
#![feature(unicode)]
2525

26-
#![allow(unstable)]
2726
#![deny(warnings)]
2827

2928
extern crate test;
@@ -35,6 +34,7 @@ extern crate log;
3534
use std::os;
3635
use std::old_io;
3736
use std::old_io::fs;
37+
use std::str::FromStr;
3838
use std::thunk::Thunk;
3939
use getopts::{optopt, optflag, reqopt};
4040
use common::Config;
@@ -139,7 +139,9 @@ pub fn parse_config(args: Vec<String> ) -> Config {
139139
build_base: opt_path(matches, "build-base"),
140140
aux_base: opt_path(matches, "aux-base"),
141141
stage_id: matches.opt_str("stage-id").unwrap(),
142-
mode: matches.opt_str("mode").unwrap().parse().ok().expect("invalid mode"),
142+
mode: FromStr::from_str(matches.opt_str("mode")
143+
.unwrap()
144+
.as_slice()).expect("invalid mode"),
143145
run_ignored: matches.opt_present("ignored"),
144146
filter: filter,
145147
logfile: matches.opt_str("logfile").map(|s| Path::new(s)),

trunk/src/compiletest/errors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pub struct ExpectedError {
1717
pub msg: String,
1818
}
1919

20-
#[derive(PartialEq, Debug)]
20+
#[derive(PartialEq, Show)]
2121
enum WhichLine { ThisLine, FollowPrevious(uint), AdjustBackward(uint) }
2222

2323
/// Looks for either "//~| KIND MESSAGE" or "//~^^... KIND MESSAGE"

trunk/src/compiletest/header.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -352,8 +352,8 @@ pub fn gdb_version_to_int(version_string: &str) -> int {
352352
panic!("{}", error_string);
353353
}
354354

355-
let major: int = components[0].parse().ok().expect(error_string);
356-
let minor: int = components[1].parse().ok().expect(error_string);
355+
let major: int = components[0].parse().expect(error_string);
356+
let minor: int = components[1].parse().expect(error_string);
357357

358358
return major * 1000 + minor;
359359
}
@@ -363,6 +363,6 @@ pub fn lldb_version_to_int(version_string: &str) -> int {
363363
"Encountered LLDB version string with unexpected format: {}",
364364
version_string);
365365
let error_string = error_string.as_slice();
366-
let major: int = version_string.parse().ok().expect(error_string);
366+
let major: int = version_string.parse().expect(error_string);
367367
return major;
368368
}

trunk/src/doc/reference.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2994,7 +2994,7 @@ Some examples of call expressions:
29942994
# fn add(x: i32, y: i32) -> i32 { 0 }
29952995
29962996
let x: i32 = add(1i32, 2i32);
2997-
let pi: Option<f32> = "3.14".parse().ok();
2997+
let pi: Option<f32> = "3.14".parse();
29982998
```
29992999

30003000
### Lambda expressions

trunk/src/doc/trpl/error-handling.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,10 +147,10 @@ for all but the most trivial of situations.
147147
Here's an example of using `Result`:
148148

149149
```rust
150-
#[derive(Debug)]
150+
#[derive(Show)]
151151
enum Version { Version1, Version2 }
152152

153-
#[derive(Debug)]
153+
#[derive(Show)]
154154
enum ParseError { InvalidHeaderLength, InvalidVersion }
155155

156156
fn parse_version(header: &[u8]) -> Result<Version, ParseError> {

trunk/src/doc/trpl/guessing-game.md

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ a function for that:
400400
let input = old_io::stdin().read_line()
401401
.ok()
402402
.expect("Failed to read line");
403-
let input_num: Option<u32> = input.parse().ok();
403+
let input_num: Option<u32> = input.parse();
404404
```
405405
406406
The `parse` function takes in a `&str` value and converts it into something.
@@ -422,13 +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 = "5".parse::<u32>().ok(); // input_num: Option<u32>
426-
let input_num: Option<u32> = "5".parse().ok(); // input_num: Option<u32>
425+
let input_num = "5".parse::<u32>(); // input_num: Option<u32>
426+
let input_num: Option<u32> = "5".parse(); // input_num: Option<u32>
427427
```
428428
429-
Here we're converting the `Result` returned by `parse` to an `Option` by using
430-
the `ok` method as well. Anyway, with us now converting our input to a number,
431-
our code looks like this:
429+
Anyway, with us now converting our input to a number, our code looks like this:
432430
433431
```{rust,ignore}
434432
use std::old_io;
@@ -447,7 +445,7 @@ fn main() {
447445
let input = old_io::stdin().read_line()
448446
.ok()
449447
.expect("Failed to read line");
450-
let input_num: Option<u32> = input.parse().ok();
448+
let input_num: Option<u32> = input.parse();
451449

452450
println!("You guessed: {}", input_num);
453451

@@ -497,7 +495,7 @@ fn main() {
497495
let input = old_io::stdin().read_line()
498496
.ok()
499497
.expect("Failed to read line");
500-
let input_num: Option<u32> = input.parse().ok();
498+
let input_num: Option<u32> = input.parse();
501499
502500
let num = match input_num {
503501
Some(num) => num,
@@ -564,7 +562,7 @@ fn main() {
564562
let input = old_io::stdin().read_line()
565563
.ok()
566564
.expect("Failed to read line");
567-
let input_num: Option<u32> = input.trim().parse().ok();
565+
let input_num: Option<u32> = input.trim().parse();
568566
569567
let num = match input_num {
570568
Some(num) => num,
@@ -640,7 +638,7 @@ fn main() {
640638
let input = old_io::stdin().read_line()
641639
.ok()
642640
.expect("Failed to read line");
643-
let input_num: Option<u32> = input.trim().parse().ok();
641+
let input_num: Option<u32> = input.trim().parse();
644642

645643
let num = match input_num {
646644
Some(num) => num,
@@ -716,7 +714,7 @@ fn main() {
716714
let input = old_io::stdin().read_line()
717715
.ok()
718716
.expect("Failed to read line");
719-
let input_num: Option<u32> = input.trim().parse().ok();
717+
let input_num: Option<u32> = input.trim().parse();
720718
721719
let num = match input_num {
722720
Some(num) => num,
@@ -772,7 +770,7 @@ fn main() {
772770
let input = old_io::stdin().read_line()
773771
.ok()
774772
.expect("Failed to read line");
775-
let input_num: Option<u32> = input.trim().parse().ok();
773+
let input_num: Option<u32> = input.trim().parse();
776774
777775
let num = match input_num {
778776
Some(num) => num,
@@ -849,7 +847,7 @@ fn main() {
849847
let input = old_io::stdin().read_line()
850848
.ok()
851849
.expect("Failed to read line");
852-
let input_num: Option<u32> = input.trim().parse().ok();
850+
let input_num: Option<u32> = input.trim().parse();
853851
854852
let num = match input_num {
855853
Some(num) => num,

trunk/src/doc/trpl/pointers.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,7 @@ Sometimes, you need a recursive data structure. The simplest is known as a
605605

606606

607607
```{rust}
608-
#[derive(Debug)]
608+
#[derive(Show)]
609609
enum List<T> {
610610
Cons(T, Box<List<T>>),
611611
Nil,

trunk/src/doc/trpl/unsafe.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -576,10 +576,6 @@ extern fn panic_fmt(args: &core::fmt::Arguments,
576576
#[lang = "eh_personality"] extern fn eh_personality() {}
577577
# #[start] fn start(argc: isize, argv: *const *const u8) -> isize { 0 }
578578
# fn main() {}
579-
# mod std { // for-loops
580-
# pub use core::iter;
581-
# pub use core::option;
582-
# }
583579
```
584580

585581
Note that there is one extra lang item here which differs from the examples

trunk/src/etc/emacs/README.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
`rust-mode`: A major Emacs mode for editing Rust source code
2+
============================================================
3+
4+
`rust-mode` makes editing [Rust](http://rust-lang.org) code with Emacs
5+
enjoyable.
6+
7+
8+
### Manual Installation
9+
10+
To install manually, check out this repository and add this to your
11+
`.emacs` file:
12+
13+
```lisp
14+
(add-to-list 'load-path "/path/to/rust-mode/")
15+
(autoload 'rust-mode "rust-mode" nil t)
16+
(add-to-list 'auto-mode-alist '("\\.rs\\'" . rust-mode))
17+
```
18+
19+
This associates `rust-mode` with `.rs` files. To enable it explicitly, do
20+
<kbd>M-x rust-mode</kbd>.
21+
22+
### `package.el` installation via Marmalade or MELPA
23+
24+
It can be more convenient to use Emacs's package manager to handle
25+
installation for you if you use many elisp libraries. If you have
26+
`package.el` but haven't added Marmalade or MELPA, the community
27+
package source, yet, add this to `~/.emacs.d/init.el`:
28+
29+
Using Marmalade:
30+
31+
```lisp
32+
(require 'package)
33+
(add-to-list 'package-archives
34+
'("marmalade" . "http://marmalade-repo.org/packages/"))
35+
(package-initialize)
36+
```
37+
38+
Using MELPA:
39+
40+
```lisp
41+
(require 'package)
42+
(add-to-list 'package-archives
43+
'("melpa" . "http://melpa.milkbox.net/packages/") t)
44+
(package-initialize)
45+
```
46+
47+
Then do this to load the package listing:
48+
49+
* <kbd>M-x eval-buffer</kbd>
50+
* <kbd>M-x package-refresh-contents</kbd>
51+
52+
If you use a version of Emacs prior to 24 that doesn't include
53+
`package.el`, you can get it from [here](http://bit.ly/pkg-el23).
54+
55+
If you have an older ELPA `package.el` installed from tromey.com, you
56+
should upgrade in order to support installation from multiple sources.
57+
The ELPA archive is deprecated and no longer accepting new packages,
58+
so the version there (1.7.1) is very outdated.
59+
60+
#### Install `rust-mode`
61+
62+
One you have `package.el`, you can install `rust-mode` or any other
63+
modes by choosing them from a list:
64+
65+
* <kbd>M-x package-list-packages</kbd>
66+
67+
Now, to install packages, move your cursor to them and press
68+
<kbd>i</kbd>. This will mark the packages for installation. When
69+
you're done with marking, press <kbd>x</kbd>, and ELPA will install
70+
the packages for you (under `~/.emacs.d/elpa/`).
71+
72+
* or using <kbd>M-x package-install rust-mode</kbd>
73+
74+
### Tests via ERT
75+
76+
The file `rust-mode-tests.el` contains tests that can be run via
77+
[ERT](http://www.gnu.org/software/emacs/manual/html_node/ert/index.html).
78+
You can use `run_rust_emacs_tests.sh` to run them in batch mode, if
79+
Emacs is somewhere in your `$PATH`.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/sh
2+
# Copyright 2014 The Rust Project Developers. See the COPYRIGHT
3+
# file at the top-level directory of this distribution and at
4+
# http://rust-lang.org/COPYRIGHT.
5+
#
6+
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
7+
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
8+
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
9+
# option. This file may not be copied, modified, or distributed
10+
# except according to those terms.
11+
#
12+
# This runs the test for emacs rust-mode.
13+
# It must be possible to find emacs via PATH.
14+
emacs -batch -l rust-mode.el -l rust-mode-tests.el -f ert-run-tests-batch-and-exit

0 commit comments

Comments
 (0)