Skip to content

Commit cde0255

Browse files
committed
---
yaml --- r: 188135 b: refs/heads/try c: d9b352f h: refs/heads/master i: 188133: bb3117a 188131: b0da260 188127: d6fb06d v: v3
1 parent 8bf667f commit cde0255

File tree

164 files changed

+4623
-2988
lines changed

Some content is hidden

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

164 files changed

+4623
-2988
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 38e97b99a6b133cb4c621c68e75b28abc6c617c1
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 3a96d6a9818fe2affc98a187fb1065120458cee9
5-
refs/heads/try: 708c3858e3e98d1b362b73510aa48416c3f68e51
5+
refs/heads/try: d9b352fdc1d8960d00efde768b66f9af486db6c2
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
88
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596

branches/try/configure

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -875,7 +875,7 @@ then
875875
| cut -d ' ' -f 2)
876876

877877
case $CFG_CLANG_VERSION in
878-
(3.0svn | 3.0 | 3.1* | 3.2* | 3.3* | 3.4* | 3.5* | 3.6*)
878+
(3.2* | 3.3* | 3.4* | 3.5* | 3.6*)
879879
step_msg "found ok version of CLANG: $CFG_CLANG_VERSION"
880880
if [ -z "$CC" ]
881881
then

branches/try/mk/crates.mk

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ TARGET_CRATES := libc std flate arena term \
5454
log graphviz core rbml alloc \
5555
unicode rustc_bitflags
5656
RUSTC_CRATES := rustc rustc_typeck rustc_borrowck rustc_resolve rustc_driver \
57-
rustc_trans rustc_back rustc_llvm rustc_privacy
57+
rustc_trans rustc_back rustc_llvm rustc_privacy rustc_lint
5858
HOST_CRATES := syntax $(RUSTC_CRATES) rustdoc fmt_macros
5959
CRATES := $(TARGET_CRATES) $(HOST_CRATES)
6060
TOOLS := compiletest rustdoc rustc rustbook
@@ -70,20 +70,21 @@ DEPS_graphviz := std
7070
DEPS_syntax := std term serialize log fmt_macros arena libc
7171
DEPS_rustc_driver := arena flate getopts graphviz libc rustc rustc_back rustc_borrowck \
7272
rustc_typeck rustc_resolve log syntax serialize rustc_llvm \
73-
rustc_trans rustc_privacy
73+
rustc_trans rustc_privacy rustc_lint
7474

7575
DEPS_rustc_trans := arena flate getopts graphviz libc rustc rustc_back \
7676
log syntax serialize rustc_llvm
7777
DEPS_rustc_typeck := rustc syntax
7878
DEPS_rustc_borrowck := rustc log graphviz syntax
7979
DEPS_rustc_resolve := rustc log syntax
8080
DEPS_rustc_privacy := rustc log syntax
81+
DEPS_rustc_lint := rustc log syntax
8182
DEPS_rustc := syntax flate arena serialize getopts rbml \
8283
log graphviz rustc_llvm rustc_back
8384
DEPS_rustc_llvm := native:rustllvm libc std
8485
DEPS_rustc_back := std syntax rustc_llvm flate log libc
8586
DEPS_rustdoc := rustc rustc_driver native:hoedown serialize getopts \
86-
test
87+
test rustc_lint
8788
DEPS_rustc_bitflags := core
8889
DEPS_flate := std native:miniz
8990
DEPS_arena := std
@@ -128,11 +129,13 @@ DOC_CRATES := $(filter-out rustc, \
128129
$(filter-out rustc_resolve, \
129130
$(filter-out rustc_driver, \
130131
$(filter-out rustc_privacy, \
132+
$(filter-out rustc_lint, \
131133
$(filter-out log, \
132134
$(filter-out getopts, \
133-
$(filter-out syntax, $(CRATES)))))))))))
135+
$(filter-out syntax, $(CRATES))))))))))))
134136
COMPILER_DOC_CRATES := rustc rustc_trans rustc_borrowck rustc_resolve \
135-
rustc_typeck rustc_driver syntax rustc_privacy
137+
rustc_typeck rustc_driver syntax rustc_privacy \
138+
rustc_lint
136139

137140
# This macro creates some simple definitions for each crate being built, just
138141
# some munging of all of the parameters above.

branches/try/mk/tests.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ $(eval $(call RUST_CRATE,coretest))
2121

2222
TEST_TARGET_CRATES = $(filter-out core unicode,$(TARGET_CRATES)) coretest
2323
TEST_DOC_CRATES = $(DOC_CRATES)
24-
TEST_HOST_CRATES = $(filter-out rustc_typeck rustc_borrowck rustc_resolve rustc_trans,\
24+
TEST_HOST_CRATES = $(filter-out rustc_typeck rustc_borrowck rustc_resolve rustc_trans rustc_lint,\
2525
$(HOST_CRATES))
2626
TEST_CRATES = $(TEST_TARGET_CRATES) $(TEST_HOST_CRATES)
2727

branches/try/src/compiletest/compiletest.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
#![feature(std_misc)]
2121
#![feature(test)]
2222
#![feature(unicode)]
23-
#![feature(env)]
2423
#![feature(core)]
2524

2625
#![deny(warnings)]

branches/try/src/doc/intro.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,7 @@ use std::thread::Thread;
536536
537537
fn main() {
538538
let numbers = vec![1, 2, 3];
539-
539+
540540
let guards: Vec<_> = (0..3).map(|i| {
541541
Thread::scoped(move || {
542542
println!("{}", numbers[i]);
@@ -565,7 +565,7 @@ while retaining safety. The answer is iterators:
565565
```{rust}
566566
let vec = vec![1, 2, 3];
567567
568-
for x in vec.iter() {
568+
for x in &vec {
569569
println!("{}", x);
570570
}
571571
```

branches/try/src/doc/reference.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ nonzero_dec: '1' | '2' | '3' | '4'
302302

303303
A _character literal_ is a single Unicode character enclosed within two
304304
`U+0027` (single-quote) characters, with the exception of `U+0027` itself,
305-
which must be _escaped_ by a preceding U+005C character (`\`).
305+
which must be _escaped_ by a preceding `U+005C` character (`\`).
306306

307307
##### String literals
308308

@@ -311,6 +311,19 @@ A _string literal_ is a sequence of any Unicode characters enclosed within two
311311
which must be _escaped_ by a preceding `U+005C` character (`\`), or a _raw
312312
string literal_.
313313

314+
A multi-line string literal may be defined by terminating each line with a
315+
`U+005C` character (`\`) immediately before the newline. This causes the
316+
`U+005C` character, the newline, and all whitespace at the beginning of the
317+
next line to be ignored.
318+
319+
```rust
320+
let a = "foobar";
321+
let b = "foo\
322+
bar";
323+
324+
assert_eq!(a,b);
325+
```
326+
314327
##### Character escapes
315328

316329
Some additional _escapes_ are available in either character or non-raw string
@@ -3752,9 +3765,9 @@ An example of creating and calling a closure:
37523765
```rust
37533766
let captured_var = 10;
37543767

3755-
let closure_no_args = |&:| println!("captured_var={}", captured_var);
3768+
let closure_no_args = || println!("captured_var={}", captured_var);
37563769

3757-
let closure_args = |&: arg: i32| -> i32 {
3770+
let closure_args = |arg: i32| -> i32 {
37583771
println!("captured_var={}, arg={}", captured_var, arg);
37593772
arg // Note lack of semicolon after 'arg'
37603773
};

branches/try/src/doc/trpl/hello-cargo.md

Lines changed: 62 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,15 @@ the Cargo
1818
README](https://github.com/rust-lang/cargo#installing-cargo-from-nightlies)
1919
for specific instructions about installing it.
2020

21+
## Converting to Cargo
22+
2123
Let's convert Hello World to Cargo.
2224

2325
To Cargo-ify our project, we need to do two things: Make a `Cargo.toml`
2426
configuration file, and put our source file in the right place. Let's
2527
do that part first:
2628

27-
```{bash}
29+
```bash
2830
$ mkdir src
2931
$ mv main.rs src/main.rs
3032
```
@@ -36,7 +38,7 @@ place for everything, and everything in its place.
3638

3739
Next, our configuration file:
3840

39-
```{bash}
41+
```bash
4042
$ editor Cargo.toml
4143
```
4244

@@ -73,7 +75,7 @@ well as what it is named.
7375

7476
Once you have this file in place, we should be ready to build! Try this:
7577

76-
```{bash}
78+
```bash
7779
$ cargo build
7880
Compiling hello_world v0.0.1 (file:///home/yourname/projects/hello_world)
7981
$ ./target/hello_world
@@ -103,6 +105,62 @@ That's it! We've successfully built `hello_world` with Cargo. Even though our
103105
program is simple, it's using much of the real tooling that you'll use for the
104106
rest of your Rust career.
105107

108+
## A New Project
109+
110+
You don't have to go through this whole process every time you want to start a new
111+
project! Cargo has the ability to make a bare-bones project directory in which you
112+
can start developing right away.
113+
114+
To start a new project with Cargo, use `cargo new`:
115+
116+
```bash
117+
$ cargo new hello_world --bin
118+
```
119+
120+
We're passing `--bin` because we're making a binary program: if we
121+
were making a library, we'd leave it off.
122+
123+
Let's check out what Cargo has generated for us:
124+
125+
```bash
126+
$ cd hello_world
127+
$ tree .
128+
.
129+
├── Cargo.toml
130+
└── src
131+
└── main.rs
132+
133+
1 directory, 2 files
134+
```
135+
136+
If you don't have the `tree` command, you can probably get it from your distro's package
137+
manager. It's not necessary, but it's certainly useful.
138+
139+
This is all we need to get started. First, let's check out `Cargo.toml`:
140+
141+
```toml
142+
[package]
143+
144+
name = "hello_world"
145+
version = "0.0.1"
146+
authors = ["Your Name <[email protected]>"]
147+
```
148+
149+
Cargo has populated this file with reasonable defaults based off the arguments you gave
150+
it and your `git` global configuration. You may notice that Cargo has also initialized
151+
the `hello_world` directory as a `git` repository.
152+
153+
Here's what's in `src/main.rs`:
154+
155+
```rust
156+
fn main() {
157+
println!("Hello, world!");
158+
}
159+
```
160+
161+
Cargo has generated a "Hello World!" for us, and you're ready to start coding! A
162+
much more in-depth guide to Cargo can be found [here](http://doc.crates.io/guide.html).
163+
106164
Now that you've got the tools down, let's actually learn more about the Rust
107165
language itself. These are the basics that will serve you well through the rest
108-
of your time with Rust.
166+
of your time with Rust.

branches/try/src/doc/trpl/installing-rust.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,10 @@ If you've got Rust installed, you can open up a shell, and type this:
7070
$ rustc --version
7171
```
7272

73-
You should see some output that looks something like this:
73+
You should see the version number, commit hash, commit date and build date:
7474

7575
```bash
76-
rustc 1.0.0-nightly (f11f3e7ba 2015-01-04 20:02:14 +0000)
76+
rustc 1.0.0-nightly (f11f3e7ba 2015-01-04) (built 2015-01-06)
7777
```
7878

7979
If you did, Rust has been installed successfully! Congrats!

branches/try/src/doc/trpl/plugins.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ extern crate rustc;
7171
use syntax::codemap::Span;
7272
use syntax::parse::token;
7373
use syntax::ast::{TokenTree, TtToken};
74-
use syntax::ext::base::{ExtCtxt, MacResult, DummyResult, MacExpr};
75-
use syntax::ext::build::AstBuilder; // trait for expr_uint
74+
use syntax::ext::base::{ExtCtxt, MacResult, DummyResult, MacEager};
75+
use syntax::ext::build::AstBuilder; // trait for expr_usize
7676
use rustc::plugin::Registry;
7777
7878
fn expand_rn(cx: &mut ExtCtxt, sp: Span, args: &[TokenTree])
@@ -107,7 +107,7 @@ fn expand_rn(cx: &mut ExtCtxt, sp: Span, args: &[TokenTree])
107107
}
108108
}
109109
110-
MacExpr::new(cx.expr_uint(sp, total))
110+
MacEager::expr(cx.expr_usize(sp, total))
111111
}
112112
113113
#[plugin_registrar]
@@ -183,7 +183,7 @@ with
183183
[`syntax::print::pprust::*_to_string`](http://doc.rust-lang.org/syntax/print/pprust/index.html#functions).
184184

185185
The example above produced an integer literal using
186-
[`AstBuilder::expr_uint`](../syntax/ext/build/trait.AstBuilder.html#tymethod.expr_uint).
186+
[`AstBuilder::expr_usize`](../syntax/ext/build/trait.AstBuilder.html#tymethod.expr_usize).
187187
As an alternative to the `AstBuilder` trait, `libsyntax` provides a set of
188188
[quasiquote macros](../syntax/ext/quote/index.html). They are undocumented and
189189
very rough around the edges. However, the implementation may be a good

branches/try/src/etc/htmldocck.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,9 @@
9696
highlights for example. If you want to simply check the presence of
9797
given node or attribute, use an empty string (`""`) as a `PATTERN`.
9898
99+
* `@count PATH XPATH COUNT' checks for the occurrence of given XPath
100+
in the given file. The number of occurrences must match the given count.
101+
99102
All conditions can be negated with `!`. `@!has foo/type.NoSuch.html`
100103
checks if the given file does not exist, for example.
101104
@@ -333,6 +336,11 @@ def check_tree_text(tree, path, pat, regexp):
333336
return ret
334337

335338

339+
def check_tree_count(tree, path, count):
340+
path = normalize_xpath(path)
341+
return len(tree.findall(path)) == count
342+
343+
336344
def check(target, commands):
337345
cache = CachedFiles(target)
338346
for c in commands:
@@ -360,6 +368,13 @@ def check(target, commands):
360368
raise RuntimeError('Invalid number of @{} arguments \
361369
at line {}'.format(c.cmd, c.lineno))
362370

371+
elif c.cmd == 'count': # count test
372+
if len(c.args) == 3: # @count <path> <pat> <count> = count test
373+
ret = check_tree_count(cache.get_tree(c.args[0]), c.args[1], int(c.args[2]))
374+
else:
375+
raise RuntimeError('Invalid number of @{} arguments \
376+
at line {}'.format(c.cmd, c.lineno))
377+
363378
elif c.cmd == 'valid-html':
364379
raise RuntimeError('Unimplemented @valid-html at line {}'.format(c.lineno))
365380

branches/try/src/liballoc/arc.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,13 @@ pub struct Weak<T> {
139139
unsafe impl<T: Sync + Send> Send for Weak<T> { }
140140
unsafe impl<T: Sync + Send> Sync for Weak<T> { }
141141

142+
#[stable(feature = "rust1", since = "1.0.0")]
143+
impl<T: fmt::Debug> fmt::Debug for Weak<T> {
144+
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
145+
write!(f, "(Weak)")
146+
}
147+
}
148+
142149
struct ArcInner<T> {
143150
strong: atomic::AtomicUsize,
144151
weak: atomic::AtomicUsize,

branches/try/src/liballoc/heap.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ mod imp {
300300
libc::realloc(ptr as *mut libc::c_void, size as libc::size_t) as *mut u8
301301
} else {
302302
let new_ptr = allocate(size, align);
303-
ptr::copy_memory(new_ptr, ptr, cmp::min(size, old_size));
303+
ptr::copy(new_ptr, ptr, cmp::min(size, old_size));
304304
deallocate(ptr, old_size, align);
305305
new_ptr
306306
}

branches/try/src/libcollections/btree/node.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1085,7 +1085,7 @@ impl<K, V> Node<K, V> {
10851085
vals: RawItems::from_slice(self.vals()),
10861086
edges: RawItems::from_slice(self.edges()),
10871087

1088-
ptr: *self.keys as *mut u8,
1088+
ptr: Unique::new(*self.keys as *mut u8),
10891089
capacity: self.capacity(),
10901090
is_leaf: self.is_leaf()
10911091
},
@@ -1354,11 +1354,14 @@ struct MoveTraversalImpl<K, V> {
13541354
edges: RawItems<Node<K, V>>,
13551355

13561356
// For deallocation when we are done iterating.
1357-
ptr: *mut u8,
1357+
ptr: Unique<u8>,
13581358
capacity: usize,
13591359
is_leaf: bool
13601360
}
13611361

1362+
unsafe impl<K: Sync, V: Sync> Sync for MoveTraversalImpl<K, V> {}
1363+
unsafe impl<K: Send, V: Send> Send for MoveTraversalImpl<K, V> {}
1364+
13621365
impl<K, V> TraversalImpl for MoveTraversalImpl<K, V> {
13631366
type Item = (K, V);
13641367
type Edge = Node<K, V>;
@@ -1401,7 +1404,7 @@ impl<K, V> Drop for MoveTraversalImpl<K, V> {
14011404

14021405
let (alignment, size) =
14031406
calculate_allocation_generic::<K, V>(self.capacity, self.is_leaf);
1404-
unsafe { heap::deallocate(self.ptr, size, alignment) };
1407+
unsafe { heap::deallocate(*self.ptr, size, alignment) };
14051408
}
14061409
}
14071410

@@ -1425,12 +1428,12 @@ pub enum TraversalItem<K, V, E> {
14251428
/// A traversal over a node's entries and edges
14261429
pub type Traversal<'a, K, V> = AbsTraversal<ElemsAndEdges<Zip<slice::Iter<'a, K>,
14271430
slice::Iter<'a, V>>,
1428-
slice::Iter<'a, Node<K, V>>>>;
1431+
slice::Iter<'a, Node<K, V>>>>;
14291432

14301433
/// A mutable traversal over a node's entries and edges
14311434
pub type MutTraversal<'a, K, V> = AbsTraversal<ElemsAndEdges<Zip<slice::Iter<'a, K>,
14321435
slice::IterMut<'a, V>>,
1433-
slice::IterMut<'a, Node<K, V>>>>;
1436+
slice::IterMut<'a, Node<K, V>>>>;
14341437

14351438
/// An owning traversal over a node's entries and edges
14361439
pub type MoveTraversal<K, V> = AbsTraversal<MoveTraversalImpl<K, V>>;

0 commit comments

Comments
 (0)