Skip to content

Commit 06cf35e

Browse files
frewsxcvalexcrichton
authored andcommitted
---
yaml --- r: 165403 b: refs/heads/master c: 98af642 h: refs/heads/master i: 165401: 136d857 165399: d03a1e6 v: v3
1 parent 70a7d13 commit 06cf35e

File tree

40 files changed

+210
-245
lines changed

40 files changed

+210
-245
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: bc99ced5708599c5644a189eca8834453691965e
2+
refs/heads/master: 98af642f5c8f60ae141a5d3ff92e8cc4e4317342
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 658529467d9d69ac9e09cacf98a6d61d781c2c76
55
refs/heads/try: aee614fc4973262a5a68efc643026e2b1458d65b

trunk/src/compiletest/runtest.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1609,7 +1609,7 @@ fn _arm_exec_compiled_test(config: &Config,
16091609
stderr_out.as_slice());
16101610

16111611
ProcRes {
1612-
status: process::ExitStatus(exitcode),
1612+
status: process::ProcessExit::ExitStatus(exitcode),
16131613
stdout: stdout_out,
16141614
stderr: stderr_out,
16151615
cmdline: cmdline

trunk/src/doc/guide.md

Lines changed: 78 additions & 76 deletions
Large diffs are not rendered by default.

trunk/src/doc/rust.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
2+
* Copyright 2013 The Rust Project Developers. See the COPYRIGHT
33
* file at the top-level directory of this distribution and at
44
* http://rust-lang.org/COPYRIGHT.
55
* With elements taken from Bootstrap v3.0.2 (MIT licensed).
@@ -209,6 +209,7 @@ pre {
209209
code {
210210
padding: 0 2px;
211211
color: #8D1A38;
212+
white-space: pre-wrap;
212213
}
213214
pre code {
214215
padding: 0;

trunk/src/libcollections/str.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
5252
#![doc(primitive = "str")]
5353

54-
pub use self::MaybeOwned::*;
54+
use self::MaybeOwned::*;
5555
use self::RecompositionState::*;
5656
use self::DecompositionType::*;
5757

@@ -842,7 +842,7 @@ mod tests {
842842
use core::iter::AdditiveIterator;
843843
use super::{eq_slice, from_utf8, is_utf8, is_utf16, raw};
844844
use super::truncate_utf16_at_nul;
845-
use super::{Owned, Slice};
845+
use super::MaybeOwned::{Owned, Slice};
846846

847847
#[test]
848848
fn test_eq_slice() {

trunk/src/libcollections/string.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ use core::raw::Slice as RawSlice;
2626

2727
use slice::CloneSliceExt;
2828
use str;
29-
use str::{CharRange, CowString, FromStr, StrAllocating, Owned};
29+
use str::{CharRange, CowString, FromStr, StrAllocating};
30+
use str::MaybeOwned::Owned;
3031
use vec::{DerefVec, Vec, as_vec};
3132

3233
/// A growable string stored as a UTF-8 encoded buffer.

trunk/src/libcore/intrinsics.rs

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ extern "rust-intrinsic" {
222222
/// Both types must have the same size and alignment, and this guarantee
223223
/// is enforced at compile-time.
224224
///
225-
/// # Examples
225+
/// # Example
226226
///
227227
/// ```rust
228228
/// use std::mem;
@@ -253,20 +253,14 @@ extern "rust-intrinsic" {
253253
/// integer, since the conversion would throw away aliasing information.
254254
pub fn offset<T>(dst: *const T, offset: int) -> *const T;
255255

256-
/// Copies `count * size_of<T>` bytes from `src` to `dst`. The source
256+
/// Copies data from one location to another.
257+
///
258+
/// Copies `count` elements (not bytes) from `src` to `dst`. The source
257259
/// and destination may *not* overlap.
258260
///
259261
/// `copy_nonoverlapping_memory` is semantically equivalent to C's `memcpy`.
260262
///
261-
/// # Safety
262-
///
263-
/// Beyond requiring that both regions of memory be allocated, it is Undefined Behaviour
264-
/// for source and destination to overlap. Care must also be taken with the ownership of
265-
/// `src` and `dst`. This method semantically moves the values of `src` into `dst`.
266-
/// However it does not drop the contents of `dst`, or prevent the contents of `src`
267-
/// from being dropped or used.
268-
///
269-
/// # Examples
263+
/// # Example
270264
///
271265
/// A safe swap function:
272266
///
@@ -290,22 +284,22 @@ extern "rust-intrinsic" {
290284
/// }
291285
/// }
292286
/// ```
287+
///
288+
/// # Safety Note
289+
///
290+
/// If the source and destination overlap then the behavior of this
291+
/// function is undefined.
293292
#[unstable]
294293
pub fn copy_nonoverlapping_memory<T>(dst: *mut T, src: *const T, count: uint);
295294

296-
/// Copies `count * size_of<T>` bytes from `src` to `dst`. The source
295+
/// Copies data from one location to another.
296+
///
297+
/// Copies `count` elements (not bytes) from `src` to `dst`. The source
297298
/// and destination may overlap.
298299
///
299300
/// `copy_memory` is semantically equivalent to C's `memmove`.
300301
///
301-
/// # Safety
302-
///
303-
/// Care must be taken with the ownership of `src` and `dst`.
304-
/// This method semantically moves the values of `src` into `dst`.
305-
/// However it does not drop the contents of `dst`, or prevent the contents of `src`
306-
/// from being dropped or used.
307-
///
308-
/// # Examples
302+
/// # Example
309303
///
310304
/// Efficiently create a Rust vector from an unsafe buffer:
311305
///

trunk/src/libcore/kinds.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,9 +252,11 @@ pub mod marker {
252252
/// and this pointer is itself stored in an inherently mutable
253253
/// location (such as a `Cell`).
254254
#[lang="invariant_lifetime"]
255-
#[deriving(Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
255+
#[deriving(Clone, PartialEq, Eq, PartialOrd, Ord)]
256256
pub struct InvariantLifetime<'a>;
257257

258+
impl<'a> Copy for InvariantLifetime<'a> {}
259+
258260
/// A type which is considered "not sendable", meaning that it cannot
259261
/// be safely sent between tasks, even if it is owned. This is
260262
/// typically embedded in other types, such as `Gc`, to ensure that

trunk/src/libcore/ptr.rs

Lines changed: 26 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -97,20 +97,13 @@ use cmp::{PartialEq, Eq, Ord, PartialOrd, Equiv};
9797
use cmp::Ordering;
9898
use cmp::Ordering::{Less, Equal, Greater};
9999

100-
// FIXME #19649: instrinsic docs don't render, so these have no docs :(
101-
102-
#[unstable]
103-
pub use intrinsics::copy_nonoverlapping_memory;
104-
105-
#[unstable]
106100
pub use intrinsics::copy_memory;
107-
108-
#[experimental = "uncertain about naming and semantics"]
101+
pub use intrinsics::copy_nonoverlapping_memory;
109102
pub use intrinsics::set_memory;
110103

111-
/// Creates a null raw pointer.
104+
/// Create a null pointer.
112105
///
113-
/// # Examples
106+
/// # Example
114107
///
115108
/// ```
116109
/// use std::ptr;
@@ -122,9 +115,9 @@ pub use intrinsics::set_memory;
122115
#[unstable = "may need a different name after pending changes to pointer types"]
123116
pub fn null<T>() -> *const T { 0 as *const T }
124117

125-
/// Creates a null mutable raw pointer.
118+
/// Create an unsafe mutable null pointer.
126119
///
127-
/// # Examples
120+
/// # Example
128121
///
129122
/// ```
130123
/// use std::ptr;
@@ -136,26 +129,16 @@ pub fn null<T>() -> *const T { 0 as *const T }
136129
#[unstable = "may need a different name after pending changes to pointer types"]
137130
pub fn null_mut<T>() -> *mut T { 0 as *mut T }
138131

139-
/// Zeroes out `count * size_of::<T>` bytes of memory at `dst`. `count` may be `0`.
140-
///
141-
/// # Safety
142-
///
143-
/// Beyond accepting a raw pointer, this is unsafe because it will not drop the contents of `dst`,
144-
/// and may be used to create invalid instances of `T`.
132+
/// Zeroes out `count * size_of::<T>` bytes of memory at `dst`
145133
#[inline]
146134
#[experimental = "uncertain about naming and semantics"]
147135
#[allow(experimental)]
148136
pub unsafe fn zero_memory<T>(dst: *mut T, count: uint) {
149137
set_memory(dst, 0, count);
150138
}
151139

152-
/// Swaps the values at two mutable locations of the same type, without
153-
/// deinitialising either. They may overlap, unlike `mem::swap` which is otherwise
154-
/// equivalent.
155-
///
156-
/// # Safety
157-
///
158-
/// This is only unsafe because it accepts a raw pointer.
140+
/// Swap the values at two mutable locations of the same type, without
141+
/// deinitialising either. They may overlap.
159142
#[inline]
160143
#[unstable]
161144
pub unsafe fn swap<T>(x: *mut T, y: *mut T) {
@@ -173,31 +156,16 @@ pub unsafe fn swap<T>(x: *mut T, y: *mut T) {
173156
mem::forget(tmp);
174157
}
175158

176-
/// Replaces the value at `dest` with `src`, returning the old
177-
/// value, without dropping either.
178-
///
179-
/// # Safety
180-
///
181-
/// This is only unsafe because it accepts a raw pointer.
182-
/// Otherwise, this operation is identical to `mem::replace`.
159+
/// Replace the value at a mutable location with a new one, returning the old
160+
/// value, without deinitialising either.
183161
#[inline]
184162
#[unstable]
185163
pub unsafe fn replace<T>(dest: *mut T, mut src: T) -> T {
186164
mem::swap(mem::transmute(dest), &mut src); // cannot overlap
187165
src
188166
}
189167

190-
/// Reads the value from `src` without dropping it. This leaves the
191-
/// memory in `src` unchanged.
192-
///
193-
/// # Safety
194-
///
195-
/// Beyond accepting a raw pointer, this is unsafe because it semantically
196-
/// moves the value out of `src` without preventing further usage of `src`.
197-
/// If `T` is not `Copy`, then care must be taken to ensure that the value at
198-
/// `src` is not used before the data is overwritten again (e.g. with `write`,
199-
/// `zero_memory`, or `copy_memory`). Note that `*src = foo` counts as a use
200-
/// because it will attempt to drop the value previously at `*src`.
168+
/// Reads the value from `*src` and returns it.
201169
#[inline(always)]
202170
#[unstable]
203171
pub unsafe fn read<T>(src: *const T) -> T {
@@ -206,11 +174,8 @@ pub unsafe fn read<T>(src: *const T) -> T {
206174
tmp
207175
}
208176

209-
/// Reads the value from `src` and nulls it out without dropping it.
210-
///
211-
/// # Safety
212-
///
213-
/// This is unsafe for the same reasons that `read` is unsafe.
177+
/// Reads the value from `*src` and nulls it out.
178+
/// This currently prevents destructors from executing.
214179
#[inline(always)]
215180
#[experimental]
216181
#[allow(experimental)]
@@ -224,17 +189,12 @@ pub unsafe fn read_and_zero<T>(dest: *mut T) -> T {
224189
tmp
225190
}
226191

227-
/// Overwrites a memory location with the given value without reading or dropping
192+
/// Unsafely overwrite a memory location with the given value without destroying
228193
/// the old value.
229194
///
230-
/// # Safety
231-
///
232-
/// Beyond accepting a raw pointer, this operation is unsafe because it does
233-
/// not drop the contents of `dst`. This could leak allocations or resources,
234-
/// so care must be taken not to overwrite an object that should be dropped.
235-
///
236-
/// This is appropriate for initializing uninitialized memory, or overwritting memory
237-
/// that has previously been `read` from.
195+
/// This operation is unsafe because it does not destroy the previous value
196+
/// contained at the location `dst`. This could leak allocations or resources,
197+
/// so care must be taken to previously deallocate the value at `dst`.
238198
#[inline]
239199
#[unstable]
240200
pub unsafe fn write<T>(dst: *mut T, src: T) {
@@ -243,47 +203,39 @@ pub unsafe fn write<T>(dst: *mut T, src: T) {
243203

244204
/// Methods on raw pointers
245205
pub trait RawPtr<T> {
246-
/// Returns a null raw pointer.
206+
/// Returns the null pointer.
247207
fn null() -> Self;
248208

249-
/// Returns true if the pointer is null.
209+
/// Returns true if the pointer is equal to the null pointer.
250210
fn is_null(&self) -> bool;
251211

252-
/// Returns true if the pointer is not null.
212+
/// Returns true if the pointer is not equal to the null pointer.
253213
fn is_not_null(&self) -> bool { !self.is_null() }
254214

255-
/// Returns the address of the pointer.
215+
/// Returns the value of this pointer (ie, the address it points to)
256216
fn to_uint(&self) -> uint;
257217

258218
/// Returns `None` if the pointer is null, or else returns a reference to the
259219
/// value wrapped in `Some`.
260220
///
261-
/// # Safety
221+
/// # Safety Notes
262222
///
263223
/// While this method and its mutable counterpart are useful for null-safety,
264224
/// it is important to note that this is still an unsafe operation because
265225
/// the returned value could be pointing to invalid memory.
266226
unsafe fn as_ref<'a>(&self) -> Option<&'a T>;
267227

268-
/// Calculates the offset from a pointer. `count` is in units of T; e.g. a
228+
/// Calculates the offset from a pointer. The offset *must* be in-bounds of
229+
/// the object, or one-byte-past-the-end. `count` is in units of T; e.g. a
269230
/// `count` of 3 represents a pointer offset of `3 * sizeof::<T>()` bytes.
270-
///
271-
/// # Safety
272-
///
273-
/// The offset must be in-bounds of the object, or one-byte-past-the-end. Otherwise
274-
/// `offset` invokes Undefined Behaviour, regardless of whether the pointer is used.
275231
unsafe fn offset(self, count: int) -> Self;
276232
}
277233

278234
/// Methods on mutable raw pointers
279235
pub trait RawMutPtr<T>{
280236
/// Returns `None` if the pointer is null, or else returns a mutable reference
281-
/// to the value wrapped in `Some`.
282-
///
283-
/// # Safety
284-
///
285-
/// As with `as_ref`, this is unsafe because it cannot verify the validity
286-
/// of the returned pointer.
237+
/// to the value wrapped in `Some`. As with `as_ref`, this is unsafe because
238+
/// it cannot verify the validity of the returned pointer.
287239
unsafe fn as_mut<'a>(&self) -> Option<&'a mut T>;
288240
}
289241

trunk/src/librustc/lint/builtin.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ use util::nodemap::{FnvHashMap, NodeSet};
3737
use lint::{Context, LintPass, LintArray};
3838

3939
use std::{cmp, slice};
40-
use std::collections::hash_map::{Occupied, Vacant};
40+
use std::collections::hash_map::Entry::{Occupied, Vacant};
4141
use std::num::SignedInt;
4242
use std::{i8, i16, i32, i64, u8, u16, u32, u64, f32, f64};
4343
use syntax::{abi, ast, ast_map};

trunk/src/librustc/metadata/creader.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use plugin::load::PluginMetadata;
2323
use util::nodemap::FnvHashMap;
2424

2525
use std::rc::Rc;
26-
use std::collections::hash_map::{Occupied, Vacant};
26+
use std::collections::hash_map::Entry::{Occupied, Vacant};
2727
use syntax::ast;
2828
use syntax::abi;
2929
use syntax::attr;

trunk/src/librustc/metadata/loader.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ use util::fs;
228228

229229
use std::c_str::ToCStr;
230230
use std::cmp;
231-
use std::collections::hash_map::{Occupied, Vacant};
231+
use std::collections::hash_map::Entry::{Occupied, Vacant};
232232
use std::collections::{HashMap, HashSet};
233233
use std::io::fs::PathExtensions;
234234
use std::io;

trunk/src/librustc/middle/const_eval.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ use syntax::visit::{mod, Visitor};
2828
use syntax::{ast_map, ast_util, codemap};
2929

3030
use std::rc::Rc;
31-
use std::collections::hash_map::Vacant;
31+
use std::collections::hash_map::Entry::Vacant;
3232

3333
//
3434
// This pass classifies expressions by their constant-ness.

trunk/src/librustc/middle/infer/freshen.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ use middle::ty::{mod, Ty};
3434
use middle::ty_fold;
3535
use middle::ty_fold::TypeFoldable;
3636
use middle::ty_fold::TypeFolder;
37-
use std::collections::hash_map;
37+
use std::collections::hash_map::{mod, Entry};
3838

3939
use super::InferCtxt;
4040
use super::unify::InferCtxtMethodsForSimplyUnifiableTypes;
@@ -67,8 +67,8 @@ impl<'a, 'tcx> TypeFreshener<'a, 'tcx> {
6767
}
6868

6969
match self.freshen_map.entry(key) {
70-
hash_map::Occupied(entry) => *entry.get(),
71-
hash_map::Vacant(entry) => {
70+
Entry::Occupied(entry) => *entry.get(),
71+
Entry::Vacant(entry) => {
7272
let index = self.freshen_count;
7373
self.freshen_count += 1;
7474
let t = ty::mk_infer(self.infcx.tcx, freshener(index));

trunk/src/librustc/middle/infer/region_inference/graphviz.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ use session::config;
2626
use util::nodemap::{FnvHashMap, FnvHashSet};
2727
use util::ppaux::Repr;
2828

29-
use std::collections::hash_map::Vacant;
29+
use std::collections::hash_map::Entry::Vacant;
3030
use std::io::{mod, File};
3131
use std::os;
3232
use std::sync::atomic;

0 commit comments

Comments
 (0)