Skip to content

Commit bcb9ff8

Browse files
committed
---
yaml --- r: 212598 b: refs/heads/auto c: 15b028c h: refs/heads/master v: v3
1 parent 0913f8e commit bcb9ff8

Some content is hidden

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

78 files changed

+134
-201
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1010
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1111
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1212
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
13-
refs/heads/auto: ae8a3c92a77e9295a764fc98998245aa1e0336b1
13+
refs/heads/auto: 15b028c5859f98b32cde69b81dd62468039db0be
1414
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1515
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1616
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/src/doc/trpl/enums.md

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -64,45 +64,3 @@ equality yet, but we’ll find out in the [`traits`][traits] section.
6464
[match]: match.html
6565
[if-let]: if-let.html
6666
[traits]: traits.html
67-
68-
# Constructors as functions
69-
70-
An enum’s constructors can also be used like functions. For example:
71-
72-
```rust
73-
# enum Message {
74-
# Write(String),
75-
# }
76-
let m = Message::Write("Hello, world".to_string());
77-
```
78-
79-
Is the same as
80-
81-
```rust
82-
# enum Message {
83-
# Write(String),
84-
# }
85-
fn foo(x: String) -> Message {
86-
Message::Write(x)
87-
}
88-
89-
let x = foo("Hello, world".to_string());
90-
```
91-
92-
This is not immediately useful to us, but when we get to
93-
[`closures`][closures], we’ll talk about passing functions as arguments to
94-
other functions. For example, with [`iterators`][iterators], we can do this
95-
to convert a vector of `String`s into a vector of `Message::Write`s:
96-
97-
```rust
98-
# enum Message {
99-
# Write(String),
100-
# }
101-
102-
let v = vec!["Hello".to_string(), "World".to_string()];
103-
104-
let v1: Vec<Message> = v.into_iter().map(Message::Write).collect();
105-
```
106-
107-
[closures]: closures.html
108-
[iterators]: iterators.html

branches/auto/src/doc/trpl/ffi.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ However it is often desired that the callback is targeted to a special
238238
Rust object. This could be the object that represents the wrapper for the
239239
respective C object.
240240
241-
This can be achieved by passing an raw pointer to the object down to the
241+
This can be achieved by passing an unsafe pointer to the object down to the
242242
C library. The C library can then include the pointer to the Rust object in
243243
the notification. This will allow the callback to unsafely access the
244244
referenced Rust object.
@@ -370,7 +370,7 @@ On OSX, frameworks behave with the same semantics as a dynamic library.
370370
371371
# Unsafe blocks
372372
373-
Some operations, like dereferencing raw pointers or calling functions that have been marked
373+
Some operations, like dereferencing unsafe pointers or calling functions that have been marked
374374
unsafe are only allowed inside unsafe blocks. Unsafe blocks isolate unsafety and are a promise to
375375
the compiler that the unsafety does not leak out of the block.
376376

branches/auto/src/doc/trpl/functions.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,7 @@ an expression, and a `let` can only begin a statement, not an expression.
144144
Note that assigning to an already-bound variable (e.g. `y = 5`) is still an
145145
expression, although its value is not particularly useful. Unlike other
146146
languages where an assignment evaluates to the assigned value (e.g. `5` in the
147-
previous example), in Rust the value of an assignment is an empty tuple `()`
148-
because the assigned value can have [just one owner](ownership.html), and any
149-
other returned value would be too surprising:
147+
previous example), in Rust the value of an assignment is an empty tuple `()`:
150148

151149
```rust
152150
let mut y = 5;

branches/auto/src/doc/trpl/raw-pointers.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ println!("raw points at {}", *raw);
5252
It gives this error:
5353

5454
```text
55-
error: dereference of raw pointer requires unsafe function or block [E0133]
56-
println!("raw points at {}", *raw);
57-
^~~~
55+
error: dereference of unsafe pointer requires unsafe function or block [E0133]
56+
println!("raw points at{}", *raw);
57+
^~~~
5858
```
5959

6060
When you dereference a raw pointer, you’re taking responsibility that it’s not

branches/auto/src/doc/trpl/strings.md

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -117,30 +117,6 @@ let dog = hachiko.chars().nth(1); // kinda like hachiko[1]
117117

118118
This emphasizes that we have to go through the whole list of `chars`.
119119

120-
## Slicing
121-
122-
You can get a slice of a string with slicing syntax:
123-
124-
```rust
125-
let dog = "hachiko";
126-
let hachi = &dog[0..5];
127-
```
128-
129-
But note that these are _byte_ offsets, not _character_ offsets. So
130-
this will fail at runtime:
131-
132-
```rust,should_panic
133-
let dog = "忠犬ハチ公";
134-
let hachi = &dog[0..2];
135-
```
136-
137-
with this error:
138-
139-
```text
140-
thread '<main>' panicked at 'index 0 and/or 2 in `忠犬ハチ公` do not lie on
141-
character boundary'
142-
```
143-
144120
## Concatenation
145121

146122
If you have a `String`, you can concatenate a `&str` to the end of it:

branches/auto/src/liballoc/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@
2222
//!
2323
//! ## Boxed values
2424
//!
25-
//! The [`Box`](boxed/index.html) type is a smart pointer type. There can
26-
//! only be one owner of a `Box`, and the owner can decide to mutate the
27-
//! contents, which live on the heap.
25+
//! The [`Box`](boxed/index.html) type is the core owned pointer type in Rust.
26+
//! There can only be one owner of a `Box`, and the owner can decide to mutate
27+
//! the contents, which live on the heap.
2828
//!
2929
//! This type can be sent among threads efficiently as the size of a `Box` value
3030
//! is the same as that of a pointer. Tree-like data structures are often built

branches/auto/src/libcollections/slice.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ impl<T> [T] {
370370
core_slice::SliceExt::get_unchecked_mut(self, index)
371371
}
372372

373-
/// Returns an raw pointer to the slice's buffer
373+
/// Returns an unsafe pointer to the slice's buffer
374374
///
375375
/// The caller must ensure that the slice outlives the pointer this
376376
/// function returns, or else it will end up pointing to garbage.

branches/auto/src/libcollections/str.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ impl str {
525525
core_str::StrExt::as_bytes(&self[..])
526526
}
527527

528-
/// Returns a raw pointer to the `&str`'s buffer.
528+
/// Returns an unsafe pointer to the `&str`'s buffer.
529529
///
530530
/// The caller must ensure that the string outlives this pointer, and
531531
/// that it is not

branches/auto/src/libcollections/vec.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1213,9 +1213,9 @@ impl<T: PartialEq> Vec<T> {
12131213
// Duplicate, advance r. End of vec. Truncate to w.
12141214

12151215
let ln = self.len();
1216-
if ln <= 1 { return; }
1216+
if ln < 1 { return; }
12171217

1218-
// Avoid bounds checks by using raw pointers.
1218+
// Avoid bounds checks by using unsafe pointers.
12191219
let p = self.as_mut_ptr();
12201220
let mut r: usize = 1;
12211221
let mut w: usize = 1;

branches/auto/src/libcore/fmt/mod.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -731,6 +731,13 @@ impl<'a> Formatter<'a> {
731731
self.buf.write_str(data)
732732
}
733733

734+
/// Writes a `char` to the underlying buffer contained within this
735+
/// formatter.
736+
#[stable(feature = "fmt_write_char", since = "1.1.0")]
737+
pub fn write_char(&mut self, c: char) -> Result {
738+
self.buf.write_char(c)
739+
}
740+
734741
/// Writes some formatted information into this instance
735742
#[stable(feature = "rust1", since = "1.0.0")]
736743
pub fn write_fmt(&mut self, fmt: Arguments) -> Result {
@@ -965,10 +972,7 @@ impl Debug for char {
965972
#[stable(feature = "rust1", since = "1.0.0")]
966973
impl Display for char {
967974
fn fmt(&self, f: &mut Formatter) -> Result {
968-
let mut utf8 = [0; 4];
969-
let amt = self.encode_utf8(&mut utf8).unwrap_or(0);
970-
let s: &str = unsafe { mem::transmute(&utf8[..amt]) };
971-
Display::fmt(s, f)
975+
f.write_char(*self)
972976
}
973977
}
974978

branches/auto/src/libcore/intrinsics.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ use marker::Sized;
4646

4747
extern "rust-intrinsic" {
4848

49-
// NB: These intrinsics take raw pointers because they mutate aliased
49+
// NB: These intrinsics take unsafe pointers because they mutate aliased
5050
// memory, which is not valid for either `&` or `&mut`.
5151

5252
pub fn atomic_cxchg<T>(dst: *mut T, old: T, src: T) -> T;

branches/auto/src/libcore/marker.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ macro_rules! impls{
357357
/// struct is dropped, it may in turn drop one or more instances of
358358
/// the type `T`, though that may not be apparent from the other
359359
/// structure of the type itself. This is commonly necessary if the
360-
/// structure is using a raw pointer like `*mut T` whose referent
360+
/// structure is using an unsafe pointer like `*mut T` whose referent
361361
/// may be dropped when the type is dropped, as a `*mut T` is
362362
/// otherwise not treated as owned.
363363
///

branches/auto/src/libcore/ptr.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@
1010

1111
// FIXME: talk about offset, copy_memory, copy_nonoverlapping_memory
1212

13-
//! Operations on raw pointers, `*const T`, and `*mut T`.
13+
//! Operations on unsafe pointers, `*const T`, and `*mut T`.
1414
//!
15-
//! Working with raw pointers in Rust is uncommon,
15+
//! Working with unsafe pointers in Rust is uncommon,
1616
//! typically limited to a few patterns.
1717
//!
1818
//! Use the `null` function to create null pointers, and the `is_null` method
1919
//! of the `*const T` type to check for null. The `*const T` type also defines
2020
//! the `offset` method, for pointer math.
2121
//!
22-
//! # Common ways to create raw pointers
22+
//! # Common ways to create unsafe pointers
2323
//!
2424
//! ## 1. Coerce a reference (`&T`) or mutable reference (`&mut T`).
2525
//!
@@ -86,7 +86,7 @@
8686
//!
8787
//! Usually you wouldn't literally use `malloc` and `free` from Rust,
8888
//! but C APIs hand out a lot of pointers generally, so are a common source
89-
//! of raw pointers in Rust.
89+
//! of unsafe pointers in Rust.
9090
9191
#![stable(feature = "rust1", since = "1.0.0")]
9292
#![doc(primitive = "pointer")]

branches/auto/src/librustc/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,6 @@ pub mod back {
9292
pub use rustc_back::x86_64;
9393
}
9494

95-
pub mod ast_map;
96-
9795
pub mod middle {
9896
pub mod astconv_util;
9997
pub mod astencode;

branches/auto/src/librustc/metadata/csearch.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
// Searching for information from the cstore
1212

13-
use ast_map;
1413
use metadata::common::*;
1514
use metadata::cstore;
1615
use metadata::decoder;
@@ -21,6 +20,7 @@ use rbml;
2120
use rbml::reader;
2221
use std::rc::Rc;
2322
use syntax::ast;
23+
use syntax::ast_map;
2424
use syntax::attr;
2525
use syntax::attr::AttrMetaMethods;
2626
use syntax::diagnostic::expect;

branches/auto/src/librustc/metadata/decoder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
pub use self::DefLike::*;
1616
use self::Family::*;
1717

18-
use ast_map;
1918
use back::svh::Svh;
2019
use metadata::cstore::crate_metadata;
2120
use metadata::common::*;
@@ -45,6 +44,7 @@ use std::str;
4544
use rbml::reader;
4645
use rbml;
4746
use serialize::Decodable;
47+
use syntax::ast_map;
4848
use syntax::attr;
4949
use syntax::parse::token::{IdentInterner, special_idents};
5050
use syntax::parse::token;

branches/auto/src/librustc/metadata/encoder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616
pub use self::InlinedItemRef::*;
1717

18-
use ast_map::{self, LinkedPath, PathElem, PathElems};
1918
use back::svh::Svh;
2019
use session::config;
2120
use metadata::common::*;
@@ -35,6 +34,7 @@ use std::io::prelude::*;
3534
use std::io::{Cursor, SeekFrom};
3635
use syntax::abi;
3736
use syntax::ast::{self, DefId, NodeId};
37+
use syntax::ast_map::{self, LinkedPath, PathElem, PathElems};
3838
use syntax::ast_util::*;
3939
use syntax::ast_util;
4040
use syntax::attr;

branches/auto/src/librustc/middle/astencode.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
// FIXME: remove this after snapshot, and Results are handled
1313
#![allow(unused_must_use)]
1414

15-
use ast_map;
1615
use metadata::common as c;
1716
use metadata::cstore as cstore;
1817
use session::Session;
@@ -33,7 +32,7 @@ use middle::subst::VecPerParamSpace;
3332
use middle::ty::{self, Ty, MethodCall, MethodCallee, MethodOrigin};
3433
use util::ppaux::ty_to_string;
3534

36-
use syntax::{ast, ast_util, codemap, fold};
35+
use syntax::{ast, ast_map, ast_util, codemap, fold};
3736
use syntax::codemap::Span;
3837
use syntax::fold::Folder;
3938
use syntax::parse::token;

branches/auto/src/librustc/middle/cfg/graphviz.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ use std::borrow::IntoCow;
1717
use graphviz as dot;
1818

1919
use syntax::ast;
20+
use syntax::ast_map;
2021

21-
use ast_map;
2222
use middle::cfg;
2323

2424
pub type Node<'a> = (cfg::CFGIndex, &'a cfg::CFGNode);

branches/auto/src/librustc/middle/check_const.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
//
1414
// - For each *mutable* static item, it checks that its **type**:
1515
// - doesn't have a destructor
16-
// - doesn't own a box
16+
// - doesn't own an owned pointer
1717
//
1818
// - For each *immutable* static item, it checks that its **value**:
19-
// - doesn't own a box
19+
// - doesn't own owned, managed pointers
2020
// - doesn't contain a struct literal or a call to an enum variant / struct constructor where
2121
// - the type of the struct/enum has a dtor
2222
//

branches/auto/src/librustc/middle/check_static_recursion.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111
// This compiler pass detects static items that refer to themselves
1212
// recursively.
1313

14-
use ast_map;
1514
use session::Session;
1615
use middle::def::{DefStatic, DefConst, DefAssociatedConst, DefMap};
1716

18-
use syntax::{ast, ast_util};
17+
use syntax::ast;
18+
use syntax::{ast_util, ast_map};
1919
use syntax::codemap::Span;
2020
use syntax::visit::Visitor;
2121
use syntax::visit;

branches/auto/src/librustc/middle/const_eval.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ pub use self::const_val::*;
1515

1616
use self::ErrKind::*;
1717

18-
use ast_map;
19-
use ast_map::blocks::FnLikeNode;
2018
use metadata::csearch;
2119
use middle::{astencode, def, infer, subst, traits};
2220
use middle::pat_util::def_to_path;
@@ -26,12 +24,13 @@ use util::num::ToPrimitive;
2624
use util::ppaux::Repr;
2725

2826
use syntax::ast::{self, Expr};
27+
use syntax::ast_map::blocks::FnLikeNode;
2928
use syntax::ast_util;
3029
use syntax::codemap::Span;
3130
use syntax::feature_gate;
3231
use syntax::parse::token::InternedString;
3332
use syntax::ptr::P;
34-
use syntax::{codemap, visit};
33+
use syntax::{ast_map, codemap, visit};
3534

3635
use std::borrow::{Cow, IntoCow};
3736
use std::num::wrapping::OverflowingOps;

branches/auto/src/librustc/middle/dead.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,12 @@
1212
// closely. The idea is that all reachable symbols are live, codes called
1313
// from live codes are live, and everything else is dead.
1414

15-
use ast_map;
1615
use middle::{def, pat_util, privacy, ty};
1716
use lint;
1817
use util::nodemap::NodeSet;
1918

2019
use std::collections::HashSet;
21-
use syntax::{ast, codemap};
20+
use syntax::{ast, ast_map, codemap};
2221
use syntax::ast_util::{local_def, is_local};
2322
use syntax::attr::{self, AttrMetaMethods};
2423
use syntax::visit::{self, Visitor};

0 commit comments

Comments
 (0)