Skip to content

Commit 1724495

Browse files
committed
---
yaml --- r: 171111 b: refs/heads/try c: 4d98cbb h: refs/heads/master i: 171109: 884273c 171107: 8e46bf8 171103: d535243 v: v3
1 parent 0232f43 commit 1724495

File tree

810 files changed

+4839
-6277
lines changed

Some content is hidden

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

810 files changed

+4839
-6277
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: 73a25f55ad748b4d3516417c711b99ce446591af
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 5b3cd3900ceda838f5798c30ab96ceb41f962534
5-
refs/heads/try: 0dc48b47a8c67eb28e7b89a6c0810dc9446377f7
5+
refs/heads/try: 4d98cbb3f3692c1fd53cd27a45a9bb1e813be942
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: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -599,18 +599,6 @@ then
599599
fi
600600
putvar CFG_RELEASE_CHANNEL
601601

602-
# A magic value that allows the compiler to use unstable features
603-
# during the bootstrap even when doing so would normally be an error
604-
# because of feature staging or because the build turns on
605-
# warnings-as-errors and unstable features default to warnings. The
606-
# build has to match this key in an env var. Meant to be a mild
607-
# deterrent from users just turning on unstable features on the stable
608-
# channel.
609-
# Basing CFG_BOOTSTRAP_KEY on CFG_BOOTSTRAP_KEY lets it get picked up
610-
# during a Makefile reconfig.
611-
CFG_BOOTSTRAP_KEY="${CFG_BOOTSTRAP_KEY-`date +%N`}"
612-
putvar CFG_BOOTSTRAP_KEY
613-
614602
step_msg "looking for build programs"
615603

616604
probe_need CFG_PERL perl

branches/try/mk/main.mk

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,11 @@ ifeq ($(CFG_RELEASE_CHANNEL),stable)
2525
CFG_RELEASE=$(CFG_RELEASE_NUM)
2626
# This is the string used in dist artifact file names, e.g. "0.12.0", "nightly"
2727
CFG_PACKAGE_VERS=$(CFG_RELEASE_NUM)
28-
CFG_DISABLE_UNSTABLE_FEATURES=1
2928
endif
3029
ifeq ($(CFG_RELEASE_CHANNEL),beta)
3130
# The beta channel is temporarily called 'alpha'
3231
CFG_RELEASE=$(CFG_RELEASE_NUM)-alpha$(CFG_BETA_CYCLE)
3332
CFG_PACKAGE_VERS=$(CFG_RELEASE_NUM)-alpha$(CFG_BETA_CYCLE)
34-
CFG_DISABLE_UNSTABLE_FEATURES=1
3533
endif
3634
ifeq ($(CFG_RELEASE_CHANNEL),nightly)
3735
CFG_RELEASE=$(CFG_RELEASE_NUM)-nightly
@@ -123,9 +121,11 @@ CFG_JEMALLOC_FLAGS += $(JEMALLOC_FLAGS)
123121

124122
ifdef CFG_DISABLE_DEBUG
125123
CFG_RUSTC_FLAGS += --cfg ndebug
124+
CFG_GCCISH_CFLAGS += -DRUST_NDEBUG
126125
else
127126
$(info cfg: enabling more debugging (CFG_ENABLE_DEBUG))
128127
CFG_RUSTC_FLAGS += --cfg debug
128+
CFG_GCCISH_CFLAGS += -DRUST_DEBUG
129129
endif
130130

131131
ifdef SAVE_TEMPS
@@ -319,20 +319,11 @@ export CFG_VERSION_WIN
319319
export CFG_RELEASE
320320
export CFG_PACKAGE_NAME
321321
export CFG_BUILD
322-
export CFG_RELEASE_CHANNEL
323322
export CFG_LLVM_ROOT
324323
export CFG_PREFIX
325324
export CFG_LIBDIR
326325
export CFG_LIBDIR_RELATIVE
327326
export CFG_DISABLE_INJECT_STD_VERSION
328-
ifdef CFG_DISABLE_UNSTABLE_FEATURES
329-
CFG_INFO := $(info cfg: disabling unstable features (CFG_DISABLE_UNSTABLE_FEATURES))
330-
# Turn on feature-staging
331-
export CFG_DISABLE_UNSTABLE_FEATURES
332-
endif
333-
# Subvert unstable feature lints to do the self-build
334-
export CFG_BOOTSTRAP_KEY
335-
export RUSTC_BOOTSTRAP_KEY:=$(CFG_BOOTSTRAP_KEY)
336327

337328
######################################################################
338329
# Per-stage targets and runner

branches/try/src/compiletest/compiletest.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@
99
// except according to those terms.
1010

1111
#![crate_type = "bin"]
12-
#![allow(unknown_features)]
1312
#![feature(slicing_syntax, unboxed_closures)]
14-
#![feature(box_syntax)]
1513

1614
#![deny(warnings)]
1715

branches/try/src/compiletest/runtest.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -908,7 +908,8 @@ fn check_error_patterns(props: &TestProps,
908908
}
909909
if done { return; }
910910

911-
let missing_patterns = &props.error_patterns[next_err_idx..];
911+
let missing_patterns =
912+
props.error_patterns.index(&(next_err_idx..));
912913
if missing_patterns.len() == 1u {
913914
fatal_proc_rec(format!("error pattern '{}' not found!",
914915
missing_patterns[0]).as_slice(),

branches/try/src/doc/footer.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<footer><p>
2-
Copyright &copy; 2011-2015 The Rust Project Developers. Licensed under the
2+
Copyright &copy; 2011-2014 The Rust Project Developers. Licensed under the
33
<a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>
44
or the <a href="http://opensource.org/licenses/MIT">MIT license</a>, at your option.
55
</p><p>

branches/try/src/doc/guide-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(Show)]
150+
#[deriving(Show)]
151151
enum Version { Version1, Version2 }
152152

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

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

branches/try/src/doc/guide-ffi.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,6 @@ referenced Rust object.
262262
Rust code:
263263
264264
~~~~no_run
265-
# use std::boxed::Box;
266265
267266
#[repr(C)]
268267
struct RustObject {
@@ -287,7 +286,7 @@ extern {
287286
288287
fn main() {
289288
// Create the object that will be referenced in the callback
290-
let mut rust_object = Box::new(RustObject { a: 5 });
289+
let mut rust_object = box RustObject { a: 5 };
291290
292291
unsafe {
293292
register_callback(&mut *rust_object, callback);

branches/try/src/doc/guide-ownership.md

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -81,29 +81,27 @@ therefore deallocates the memory for you. Here's the equivalent example in
8181
Rust:
8282

8383
```rust
84-
# use std::boxed::Box;
8584
{
86-
let x = Box::new(5i);
85+
let x = box 5i;
8786
}
8887
```
8988

90-
The `Box::new` function creates a `Box<T>` (specifically `Box<int>` in this
91-
case) by allocating a small segment of memory on the heap with enough space to
92-
fit an `int`. But where in the code is the box deallocated? We said before that
93-
we must have a deallocation for each allocation. Rust handles this for you. It
89+
The `box` keyword creates a `Box<T>` (specifically `Box<int>` in this case) by
90+
allocating a small segment of memory on the heap with enough space to fit an
91+
`int`. But where in the code is the box deallocated? We said before that we
92+
must have a deallocation for each allocation. Rust handles this for you. It
9493
knows that our handle, `x`, is the owning reference to our box. Rust knows that
9594
`x` will go out of scope at the end of the block, and so it inserts a call to
9695
deallocate the memory at the end of the scope. Because the compiler does this
97-
for us, it's impossible to forget. We always have exactly one deallocation
98-
paired with each of our allocations.
96+
for us, it's impossible to forget. We always have exactly one deallocation paired
97+
with each of our allocations.
9998

10099
This is pretty straightforward, but what happens when we want to pass our box
101100
to a function? Let's look at some code:
102101

103102
```rust
104-
# use std::boxed::Box;
105103
fn main() {
106-
let x = Box::new(5i);
104+
let x = box 5i;
107105

108106
add_one(x);
109107
}
@@ -117,9 +115,8 @@ This code works, but it's not ideal. For example, let's add one more line of
117115
code, where we print out the value of `x`:
118116

119117
```{rust,ignore}
120-
# use std::boxed::Box;
121118
fn main() {
122-
let x = Box::new(5i);
119+
let x = box 5i;
123120
124121
add_one(x);
125122
@@ -151,9 +148,8 @@ To fix this, we can have `add_one` give ownership back when it's done with the
151148
box:
152149

153150
```rust
154-
# use std::boxed::Box;
155151
fn main() {
156-
let x = Box::new(5i);
152+
let x = box 5i;
157153

158154
let y = add_one(x);
159155

@@ -462,7 +458,7 @@ lifetime, and so if you elide a lifetime (like `&T` instead of `&'a T`), Rust
462458
will do three things to determine what those lifetimes should be.
463459

464460
When talking about lifetime elision, we use the term 'input lifetime' and
465-
'output lifetime'. An 'input lifetime' is a lifetime associated with a parameter
461+
'output lifetime'. An 'input liftime' is a lifetime associated with a parameter
466462
of a function, and an 'output lifetime' is a lifetime associated with the return
467463
value of a function. For example, this function has an input lifetime:
468464

branches/try/src/doc/guide-pointers.md

Lines changed: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -455,13 +455,12 @@ fn rc_succ(x: Rc<int>) -> int { *x + 1 }
455455
Note that the caller of your function will have to modify their calls slightly:
456456

457457
```{rust}
458-
# use std::boxed::Box;
459458
use std::rc::Rc;
460459
461460
fn succ(x: &int) -> int { *x + 1 }
462461
463462
let ref_x = &5i;
464-
let box_x = Box::new(5i);
463+
let box_x = box 5i;
465464
let rc_x = Rc::new(5i);
466465
467466
succ(ref_x);
@@ -478,17 +477,24 @@ those contents.
478477
heap allocation in Rust. Creating a box looks like this:
479478

480479
```{rust}
481-
# use std::boxed::Box;
482-
let x = Box::new(5i);
480+
let x = box(std::boxed::HEAP) 5i;
483481
```
484482

485-
Boxes are heap allocated and they are deallocated automatically by Rust when
486-
they go out of scope:
483+
`box` is a keyword that does 'placement new,' which we'll talk about in a bit.
484+
`box` will be useful for creating a number of heap-allocated types, but is not
485+
quite finished yet. In the meantime, `box`'s type defaults to
486+
`std::boxed::HEAP`, and so you can leave it off:
487+
488+
```{rust}
489+
let x = box 5i;
490+
```
491+
492+
As you might assume from the `HEAP`, boxes are heap allocated. They are
493+
deallocated automatically by Rust when they go out of scope:
487494

488495
```{rust}
489-
# use std::boxed::Box;
490496
{
491-
let x = Box::new(5i);
497+
let x = box 5i;
492498
493499
// stuff happens
494500
@@ -507,9 +513,8 @@ You don't need to fully grok the theory of affine types or regions to grok
507513
boxes, though. As a rough approximation, you can treat this Rust code:
508514

509515
```{rust}
510-
# use std::boxed::Box;
511516
{
512-
let x = Box::new(5i);
517+
let x = box 5i;
513518
514519
// stuff happens
515520
}
@@ -548,13 +553,12 @@ for more detail on how lifetimes work.
548553
Using boxes and references together is very common. For example:
549554

550555
```{rust}
551-
# use std::boxed::Box;
552556
fn add_one(x: &int) -> int {
553557
*x + 1
554558
}
555559
556560
fn main() {
557-
let x = Box::new(5i);
561+
let x = box 5i;
558562
559563
println!("{}", add_one(&*x));
560564
}
@@ -566,13 +570,12 @@ function, and since it's only reading the value, allows it.
566570
We can borrow `x` multiple times, as long as it's not simultaneous:
567571

568572
```{rust}
569-
# use std::boxed::Box;
570573
fn add_one(x: &int) -> int {
571574
*x + 1
572575
}
573576
574577
fn main() {
575-
let x = Box::new(5i);
578+
let x = box 5i;
576579
577580
println!("{}", add_one(&*x));
578581
println!("{}", add_one(&*x));
@@ -583,13 +586,12 @@ fn main() {
583586
Or as long as it's not a mutable borrow. This will error:
584587

585588
```{rust,ignore}
586-
# use std::boxed::Box;
587589
fn add_one(x: &mut int) -> int {
588590
*x + 1
589591
}
590592
591593
fn main() {
592-
let x = Box::new(5i);
594+
let x = box 5i;
593595
594596
println!("{}", add_one(&*x)); // error: cannot borrow immutable dereference
595597
// of `&`-pointer as mutable
@@ -610,23 +612,22 @@ Sometimes, you need a recursive data structure. The simplest is known as a
610612

611613

612614
```{rust}
613-
# use std::boxed::Box;
614-
#[derive(Show)]
615+
#[deriving(Show)]
615616
enum List<T> {
616617
Cons(T, Box<List<T>>),
617618
Nil,
618619
}
619620
620621
fn main() {
621-
let list: List<int> = List::Cons(1, Box::new(List::Cons(2, Box::new(List::Cons(3, Box::new(List::Nil))))));
622+
let list: List<int> = List::Cons(1, box List::Cons(2, box List::Cons(3, box List::Nil)));
622623
println!("{:?}", list);
623624
}
624625
```
625626

626627
This prints:
627628

628629
```text
629-
Cons(1, Box(Cons(2, Box(Cons(3, Box(Nil))))))
630+
Cons(1, box Cons(2, box Cons(3, box Nil)))
630631
```
631632

632633
The reference to another `List` inside of the `Cons` enum variant must be a box,
@@ -666,7 +667,6 @@ In many languages with pointers, you'd return a pointer from a function
666667
so as to avoid copying a large data structure. For example:
667668

668669
```{rust}
669-
# use std::boxed::Box;
670670
struct BigStruct {
671671
one: int,
672672
two: int,
@@ -675,15 +675,15 @@ struct BigStruct {
675675
}
676676
677677
fn foo(x: Box<BigStruct>) -> Box<BigStruct> {
678-
return Box::new(*x);
678+
return box *x;
679679
}
680680
681681
fn main() {
682-
let x = Box::new(BigStruct {
682+
let x = box BigStruct {
683683
one: 1,
684684
two: 2,
685685
one_hundred: 100,
686-
});
686+
};
687687
688688
let y = foo(x);
689689
}
@@ -695,7 +695,6 @@ than the hundred `int`s that make up the `BigStruct`.
695695
This is an antipattern in Rust. Instead, write this:
696696

697697
```{rust}
698-
# use std::boxed::Box;
699698
struct BigStruct {
700699
one: int,
701700
two: int,
@@ -708,13 +707,13 @@ fn foo(x: Box<BigStruct>) -> BigStruct {
708707
}
709708
710709
fn main() {
711-
let x = Box::new(BigStruct {
710+
let x = box BigStruct {
712711
one: 1,
713712
two: 2,
714713
one_hundred: 100,
715-
});
714+
};
716715
717-
let y = Box::new(foo(x));
716+
let y = box foo(x);
718717
}
719718
```
720719

0 commit comments

Comments
 (0)