Skip to content

Commit 9db95f4

Browse files
committed
---
yaml --- r: 228724 b: refs/heads/try c: 36d8529 h: refs/heads/master v: v3
1 parent 55045b7 commit 9db95f4

File tree

101 files changed

+783
-2429
lines changed

Some content is hidden

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

101 files changed

+783
-2429
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: aca2057ed5fb7af3f8905b2bc01f72fa001c35c8
33
refs/heads/snap-stage3: 1af31d4974e33027a68126fa5a5a3c2c6491824f
4-
refs/heads/try: 82d40cb2ba44a27b7db8ec185b5c532237db4b3e
4+
refs/heads/try: 36d852918f5de255a706667af9373edea7429d3f
55
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
66
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
77
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try/src/doc/reference.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1636,10 +1636,6 @@ The type of a function declared in an extern block is `extern "abi" fn(A1, ...,
16361636
An) -> R`, where `A1...An` are the declared types of its arguments and `R` is
16371637
the declared return type.
16381638

1639-
It is valid to add the `link` attribute on an empty extern block. You can use
1640-
this to satisfy the linking requirements of extern blocks elsewhere in your code
1641-
(including upstream crates) instead of adding the attribute to each extern block.
1642-
16431639
## Visibility and Privacy
16441640

16451641
These two terms are often used interchangeably, and what they are attempting to

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
* [No stdlib](no-stdlib.md)
6464
* [Intrinsics](intrinsics.md)
6565
* [Lang items](lang-items.md)
66-
* [Advanced linking](advanced-linking.md)
66+
* [Link args](link-args.md)
6767
* [Benchmark Tests](benchmark-tests.md)
6868
* [Box Syntax and Patterns](box-syntax-and-patterns.md)
6969
* [Slice Patterns](slice-patterns.md)

branches/try/src/doc/trpl/advanced-linking.md

Lines changed: 0 additions & 151 deletions
This file was deleted.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
% Link args
2+
3+
There is one other way to tell rustc how to customize linking, and that is via
4+
the `link_args` attribute. This attribute is applied to `extern` blocks and
5+
specifies raw flags which need to get passed to the linker when producing an
6+
artifact. An example usage would be:
7+
8+
``` no_run
9+
#![feature(link_args)]
10+
11+
#[link_args = "-foo -bar -baz"]
12+
extern {}
13+
# fn main() {}
14+
```
15+
16+
Note that this feature is currently hidden behind the `feature(link_args)` gate
17+
because this is not a sanctioned way of performing linking. Right now rustc
18+
shells out to the system linker, so it makes sense to provide extra command line
19+
arguments, but this will not always be the case. In the future rustc may use
20+
LLVM directly to link native libraries, in which case `link_args` will have no
21+
meaning.
22+
23+
It is highly recommended to *not* use this attribute, and rather use the more
24+
formal `#[link(...)]` attribute on `extern` blocks instead.
25+

branches/try/src/doc/trpl/while-loops.md

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -88,24 +88,6 @@ for x in 0..10 {
8888
}
8989
```
9090

91-
You may also encounter situations where you have nested loops and need to
92-
specify which one your `break` or `continue` statement is for. Like most
93-
other languages, by default a `break` or `continue` will apply to innermost
94-
loop. In a sitation where you would like to a `break` or `continue` for one
95-
of the outer loops, you can use labels to specify which loop the `break` or
96-
`continue` statement applies to. This will only print when both `x` and `y` are
97-
odd:
98-
99-
```rust
100-
'outer: for x in 0..10 {
101-
'inner: for y in 0..10 {
102-
if x % 2 == 0 { continue 'outer; } // continues the loop over x
103-
if y % 2 == 0 { continue 'inner; } // continues the loop over y
104-
println!("x: {}, y: {}", x, y);
105-
}
106-
}
107-
```
108-
10991
Both `continue` and `break` are valid in both `while` loops and [`for` loops][for].
11092

11193
[for]: for-loops.html

branches/try/src/liballoc/boxed.rs

Lines changed: 6 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,13 @@
5555

5656
use core::prelude::*;
5757

58-
use heap;
59-
6058
use core::any::Any;
6159
use core::cmp::Ordering;
6260
use core::fmt;
6361
use core::hash::{self, Hash};
64-
use core::marker::{self, Unsize};
62+
use core::marker::Unsize;
6563
use core::mem;
6664
use core::ops::{CoerceUnsized, Deref, DerefMut};
67-
use core::ops::{Placer, Boxed, Place, InPlace, BoxPlace};
6865
use core::ptr::Unique;
6966
use core::raw::{TraitObject};
7067

@@ -75,7 +72,7 @@ use core::raw::{TraitObject};
7572
///
7673
/// ```
7774
/// # #![feature(box_heap)]
78-
/// #![feature(box_syntax, placement_in_syntax)]
75+
/// #![feature(box_syntax)]
7976
/// use std::boxed::HEAP;
8077
///
8178
/// fn main() {
@@ -86,110 +83,15 @@ use core::raw::{TraitObject};
8683
#[lang = "exchange_heap"]
8784
#[unstable(feature = "box_heap",
8885
reason = "may be renamed; uncertain about custom allocator design")]
89-
pub const HEAP: ExchangeHeapSingleton =
90-
ExchangeHeapSingleton { _force_singleton: () };
91-
92-
/// This the singleton type used solely for `boxed::HEAP`.
93-
#[derive(Copy, Clone)]
94-
pub struct ExchangeHeapSingleton { _force_singleton: () }
86+
pub const HEAP: () = ();
9587

9688
/// A pointer type for heap allocation.
9789
///
9890
/// See the [module-level documentation](../../std/boxed/index.html) for more.
9991
#[lang = "owned_box"]
10092
#[stable(feature = "rust1", since = "1.0.0")]
10193
#[fundamental]
102-
pub struct Box<T: ?Sized>(Unique<T>);
103-
104-
/// `IntermediateBox` represents uninitialized backing storage for `Box`.
105-
///
106-
/// FIXME (pnkfelix): Ideally we would just reuse `Box<T>` instead of
107-
/// introducing a separate `IntermediateBox<T>`; but then you hit
108-
/// issues when you e.g. attempt to destructure an instance of `Box`,
109-
/// since it is a lang item and so it gets special handling by the
110-
/// compiler. Easier just to make this parallel type for now.
111-
///
112-
/// FIXME (pnkfelix): Currently the `box` protocol only supports
113-
/// creating instances of sized types. This IntermediateBox is
114-
/// designed to be forward-compatible with a future protocol that
115-
/// supports creating instances of unsized types; that is why the type
116-
/// parameter has the `?Sized` generalization marker, and is also why
117-
/// this carries an explicit size. However, it probably does not need
118-
/// to carry the explicit alignment; that is just a work-around for
119-
/// the fact that the `align_of` intrinsic currently requires the
120-
/// input type to be Sized (which I do not think is strictly
121-
/// necessary).
122-
#[unstable(feature = "placement_in", reason = "placement box design is still being worked out.")]
123-
pub struct IntermediateBox<T: ?Sized>{
124-
ptr: *mut u8,
125-
size: usize,
126-
align: usize,
127-
marker: marker::PhantomData<*mut T>,
128-
}
129-
130-
impl<T> Place<T> for IntermediateBox<T> {
131-
fn pointer(&mut self) -> *mut T {
132-
unsafe { ::core::mem::transmute(self.ptr) }
133-
}
134-
}
135-
136-
unsafe fn finalize<T>(b: IntermediateBox<T>) -> Box<T> {
137-
let p = b.ptr as *mut T;
138-
mem::forget(b);
139-
mem::transmute(p)
140-
}
141-
142-
fn make_place<T>() -> IntermediateBox<T> {
143-
let size = mem::size_of::<T>();
144-
let align = mem::align_of::<T>();
145-
146-
let p = if size == 0 {
147-
heap::EMPTY as *mut u8
148-
} else {
149-
let p = unsafe {
150-
heap::allocate(size, align)
151-
};
152-
if p.is_null() {
153-
panic!("Box make_place allocation failure.");
154-
}
155-
p
156-
};
157-
158-
IntermediateBox { ptr: p, size: size, align: align, marker: marker::PhantomData }
159-
}
160-
161-
impl<T> BoxPlace<T> for IntermediateBox<T> {
162-
fn make_place() -> IntermediateBox<T> { make_place() }
163-
}
164-
165-
impl<T> InPlace<T> for IntermediateBox<T> {
166-
type Owner = Box<T>;
167-
unsafe fn finalize(self) -> Box<T> { finalize(self) }
168-
}
169-
170-
impl<T> Boxed for Box<T> {
171-
type Data = T;
172-
type Place = IntermediateBox<T>;
173-
unsafe fn finalize(b: IntermediateBox<T>) -> Box<T> { finalize(b) }
174-
}
175-
176-
impl<T> Placer<T> for ExchangeHeapSingleton {
177-
type Place = IntermediateBox<T>;
178-
179-
fn make_place(self) -> IntermediateBox<T> {
180-
make_place()
181-
}
182-
}
183-
184-
impl<T: ?Sized> Drop for IntermediateBox<T> {
185-
fn drop(&mut self) {
186-
if self.size > 0 {
187-
unsafe {
188-
heap::deallocate(self.ptr, self.size, self.align)
189-
}
190-
}
191-
}
192-
}
94+
pub struct Box<T>(Unique<T>);
19395

19496
impl<T> Box<T> {
19597
/// Allocates memory on the heap and then moves `x` into it.
@@ -297,7 +199,8 @@ impl<T: Clone> Clone for Box<T> {
297199
/// let y = x.clone();
298200
/// ```
299201
#[inline]
300-
fn clone(&self) -> Box<T> { box (HEAP) {(**self).clone()} }
202+
fn clone(&self) -> Box<T> { box {(**self).clone()} }
203+
301204
/// Copies `source`'s contents into `self` without creating a new allocation.
302205
///
303206
/// # Examples

branches/try/src/liballoc/lib.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,6 @@
7070
test(no_crate_inject))]
7171
#![no_std]
7272

73-
// SNAP d4432b3
74-
#![allow(unused_features)] // until feature(placement_in_syntax) is in snap
7573
#![feature(allocator)]
7674
#![feature(box_syntax)]
7775
#![feature(coerce_unsized)]
@@ -84,8 +82,6 @@
8482
#![feature(no_std)]
8583
#![feature(nonzero)]
8684
#![feature(optin_builtin_traits)]
87-
#![feature(placement_in_syntax)]
88-
#![feature(placement_new_protocol)]
8985
#![feature(raw)]
9086
#![feature(staged_api)]
9187
#![feature(unboxed_closures)]

0 commit comments

Comments
 (0)