Skip to content

Commit 0c0a713

Browse files
committed
---
yaml --- r: 225271 b: refs/heads/stable c: 1742a01 h: refs/heads/master i: 225269: eb5d4de 225267: d5ffc58 225263: 23ff1ba v: v3
1 parent 865b0ab commit 0c0a713

Some content is hidden

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

43 files changed

+590
-590
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,6 @@ refs/heads/tmp: e5d90d98402475b6e154ce216f9efcb80da1a747
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3030
refs/tags/homu-tmp: 1fe32ca12c51afcd761d9962f51a74ff0d07a591
3131
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828
32-
refs/heads/stable: 87038831f1d1eafe6978a823cdbb353d3a7d3f8d
32+
refs/heads/stable: 1742a01f8d5717f1ab2f445c4d4656633b4c88b9
3333
refs/tags/1.0.0: 55bd4f8ff2b323f317ae89e254ce87162d52a375
3434
refs/tags/1.1.0: bc3c16f09287e5545c1d3f76b7abd54f2eca868b

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ Some people, and somewhat rightfully so, get very upset when we tell you to
4343
`curl | sh`. Basically, when you do this, you are trusting that the good
4444
people who maintain Rust aren't going to hack your computer and do bad things.
4545
That's a good instinct! If you're one of those people, please check out the
46-
documentation on [building Rust from Source][from source], or [the official
47-
binary downloads][install page].
46+
documentation on [building Rust from Source][from-source], or [the official
47+
binary downloads][install-page].
4848

49-
[from source]: https://github.com/rust-lang/rust#building-from-source
50-
[install page]: http://www.rust-lang.org/install.html
49+
[from-source]: https://github.com/rust-lang/rust#building-from-source
50+
[install-page]: http://www.rust-lang.org/install.html
5151

5252
Oh, we should also mention the officially supported platforms:
5353

branches/stable/src/doc/trpl/macros.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ mind.
3030

3131
# Defining a macro
3232

33-
You may have seen the `vec!` macro, used to initialize a [vector][] with any
34-
number of elements.
33+
You may have seen the `vec!` macro, used to initialize a [vector][vector] with
34+
any number of elements.
3535

3636
[vector]: vectors.html
3737

@@ -349,7 +349,7 @@ fn main() {
349349
}
350350
```
351351

352-
This holds for `let` bindings and loop labels, but not for [items][].
352+
This holds for `let` bindings and loop labels, but not for [items][items].
353353
So the following code does compile:
354354

355355
```rust
@@ -470,7 +470,7 @@ which syntactic form it matches.
470470
* `stmt`: a single statement. Example: `let x = 3`.
471471
* `block`: a brace-delimited sequence of statements. Example:
472472
`{ log(error, "hi"); return 12; }`.
473-
* `item`: an [item][]. Examples: `fn foo() { }`; `struct Bar;`.
473+
* `item`: an [item][item]. Examples: `fn foo() { }`; `struct Bar;`.
474474
* `meta`: a "meta item", as found in attributes. Example: `cfg(target_os = "windows")`.
475475
* `tt`: a single token tree.
476476

branches/stable/src/doc/trpl/nightly-rust.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@ Some people, and somewhat rightfully so, get very upset when we tell you to
4646
`curl | sh`. Basically, when you do this, you are trusting that the good
4747
people who maintain Rust aren't going to hack your computer and do bad things.
4848
That's a good instinct! If you're one of those people, please check out the
49-
documentation on [building Rust from Source][from source], or [the official
50-
binary downloads][install page].
49+
documentation on [building Rust from Source][from-source], or [the official
50+
binary downloads][install-page].
5151

52-
[from source]: https://github.com/rust-lang/rust#building-from-source
53-
[install page]: http://www.rust-lang.org/install.html
52+
[from-source]: https://github.com/rust-lang/rust#building-from-source
53+
[install-page]: http://www.rust-lang.org/install.html
5454

5555
Oh, we should also mention the officially supported platforms:
5656

@@ -91,9 +91,9 @@ If not, there are a number of places where you can get help. The easiest is
9191
[the #rust IRC channel on irc.mozilla.org][irc], which you can access through
9292
[Mibbit][mibbit]. Click that link, and you'll be chatting with other Rustaceans
9393
(a silly nickname we call ourselves), and we can help you out. Other great
94-
resources include [the user’s forum][users], and [Stack Overflow][stack overflow].
94+
resources include [the user’s forum][users], and [Stack Overflow][stackoverflow].
9595

9696
[irc]: irc://irc.mozilla.org/#rust
9797
[mibbit]: http://chat.mibbit.com/?server=irc.mozilla.org&channel=%23rust
9898
[users]: http://users.rust-lang.org/
99-
[stack overflow]: http://stackoverflow.com/questions/tagged/rust
99+
[stackoverflow]: http://stackoverflow.com/questions/tagged/rust

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,20 @@ fn main() {
4949
}
5050
```
5151

52+
This coercion does not happen for functions that accept one of `&str`’s traits
53+
instead of `&str`. For example, [`TcpStream::connect`][connect] has a parameter
54+
of type `ToSocketAddrs`. A `&str` is okay but a `String` must be explicitly
55+
converted using `&*`.
56+
57+
```rust,no_run
58+
use std::net::TcpStream;
59+
60+
TcpStream::connect("192.168.0.1:3000"); // &str parameter
61+
62+
let addr_string = "192.168.0.1:3000".to_string();
63+
TcpStream::connect(&*addr_string); // convert addr_string to &str
64+
```
65+
5266
Viewing a `String` as a `&str` is cheap, but converting the `&str` to a
5367
`String` involves allocating memory. No reason to do that unless you have to!
5468

@@ -127,3 +141,4 @@ This is because `&String` can automatically coerce to a `&str`. This is a
127141
feature called ‘[`Deref` coercions][dc]’.
128142

129143
[dc]: deref-coercions.html
144+
[connect]: ../std/net/struct.TcpStream.html#method.connect

branches/stable/src/liballoc/boxed.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -139,24 +139,20 @@ impl<T : ?Sized> Box<T> {
139139
/// convert pointer back to `Box` with `Box::from_raw` function, because
140140
/// `Box` does not specify, how memory is allocated.
141141
///
142-
/// Function is unsafe, because result of this function is no longer
143-
/// automatically managed that may lead to memory or other resource
144-
/// leak.
145-
///
146142
/// # Examples
147143
/// ```
148144
/// # #![feature(alloc)]
149145
/// use std::boxed;
150146
///
151147
/// let seventeen = Box::new(17u32);
152-
/// let raw = unsafe { boxed::into_raw(seventeen) };
148+
/// let raw = boxed::into_raw(seventeen);
153149
/// let boxed_again = unsafe { Box::from_raw(raw) };
154150
/// ```
155151
#[unstable(feature = "alloc",
156152
reason = "may be renamed")]
157153
#[inline]
158-
pub unsafe fn into_raw<T : ?Sized>(b: Box<T>) -> *mut T {
159-
mem::transmute(b)
154+
pub fn into_raw<T : ?Sized>(b: Box<T>) -> *mut T {
155+
unsafe { mem::transmute(b) }
160156
}
161157

162158
#[stable(feature = "rust1", since = "1.0.0")]

branches/stable/src/libcore/iter.rs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -452,20 +452,19 @@ pub trait Iterator {
452452
Scan{iter: self, f: f, state: initial_state}
453453
}
454454

455-
/// Creates an iterator that maps each element to an iterator,
456-
/// and yields the elements of the produced iterators.
455+
/// Takes a function that maps each element to a new iterator and yields
456+
/// all the elements of the produced iterators.
457+
///
458+
/// This is useful for unraveling nested structures.
457459
///
458460
/// # Examples
459461
///
460462
/// ```
461-
/// # #![feature(core)]
462-
/// let xs = [2, 3];
463-
/// let ys = [0, 1, 0, 1, 2];
464-
/// let it = xs.iter().flat_map(|&x| (0..).take(x));
465-
/// // Check that `it` has the same elements as `ys`
466-
/// for (i, x) in it.enumerate() {
467-
/// assert_eq!(x, ys[i]);
468-
/// }
463+
/// let words = ["alpha", "beta", "gamma"];
464+
/// let merged: String = words.iter()
465+
/// .flat_map(|s| s.chars())
466+
/// .collect();
467+
/// assert_eq!(merged, "alphabetagamma");
469468
/// ```
470469
#[inline]
471470
#[stable(feature = "rust1", since = "1.0.0")]

branches/stable/src/librustc/metadata/common.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ enum_from_u32! {
146146
tag_table_closure_kinds = 0x65,
147147
tag_table_upvar_capture_map = 0x66,
148148
tag_table_capture_modes = 0x67,
149-
tag_table_object_cast_map = 0x68,
149+
// GAP 0x68
150150
tag_table_const_qualif = 0x69,
151151
tag_table_cast_kinds = 0x6a,
152152
}

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

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -297,15 +297,6 @@ pub fn get_impl_trait<'tcx>(tcx: &ty::ctxt<'tcx>,
297297
decoder::get_impl_trait(&*cdata, def.node, tcx)
298298
}
299299

300-
// Given a def_id for an impl, return information about its vtables
301-
pub fn get_impl_vtables<'tcx>(tcx: &ty::ctxt<'tcx>,
302-
def: ast::DefId)
303-
-> ty::vtable_res<'tcx> {
304-
let cstore = &tcx.sess.cstore;
305-
let cdata = cstore.get_crate_data(def.krate);
306-
decoder::get_impl_vtables(&*cdata, def.node, tcx)
307-
}
308-
309300
pub fn get_native_libraries(cstore: &cstore::CStore, crate_num: ast::CrateNum)
310301
-> Vec<(cstore::NativeLibraryKind, String)> {
311302
let cdata = cstore.get_crate_data(crate_num);
@@ -389,15 +380,20 @@ pub fn is_const_fn(cstore: &cstore::CStore, did: ast::DefId) -> bool {
389380
decoder::is_const_fn(&*cdata, did.node)
390381
}
391382

383+
pub fn is_impl(cstore: &cstore::CStore, did: ast::DefId) -> bool {
384+
let cdata = cstore.get_crate_data(did.krate);
385+
decoder::is_impl(&*cdata, did.node)
386+
}
387+
392388
pub fn get_stability(cstore: &cstore::CStore,
393389
def: ast::DefId)
394390
-> Option<attr::Stability> {
395391
let cdata = cstore.get_crate_data(def.krate);
396392
decoder::get_stability(&*cdata, def.node)
397393
}
398394

399-
pub fn is_staged_api(cstore: &cstore::CStore, def: ast::DefId) -> bool {
400-
let cdata = cstore.get_crate_data(def.krate);
395+
pub fn is_staged_api(cstore: &cstore::CStore, krate: ast::CrateNum) -> bool {
396+
let cdata = cstore.get_crate_data(krate);
401397
let attrs = decoder::get_crate_attributes(cdata.data());
402398
for attr in &attrs {
403399
if &attr.name()[..] == "staged_api" {
@@ -414,11 +410,6 @@ pub fn get_repr_attrs(cstore: &cstore::CStore, def: ast::DefId)
414410
decoder::get_repr_attrs(&*cdata, def.node)
415411
}
416412

417-
pub fn is_associated_type(cstore: &cstore::CStore, def: ast::DefId) -> bool {
418-
let cdata = cstore.get_crate_data(def.krate);
419-
decoder::is_associated_type(&*cdata, def.node)
420-
}
421-
422413
pub fn is_defaulted_trait(cstore: &cstore::CStore, trait_def_id: ast::DefId) -> bool {
423414
let cdata = cstore.get_crate_data(trait_def_id.krate);
424415
decoder::is_defaulted_trait(&*cdata, trait_def_id.node)

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

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ use middle::lang_items;
3030
use middle::subst;
3131
use middle::ty::{ImplContainer, TraitContainer};
3232
use middle::ty::{self, Ty};
33-
use middle::astencode::vtable_decoder_helpers;
3433
use util::nodemap::FnvHashMap;
3534

3635
use std::cell::{Cell, RefCell};
@@ -522,18 +521,6 @@ pub fn get_impl_trait<'tcx>(cdata: Cmd,
522521
}
523522
}
524523

525-
pub fn get_impl_vtables<'tcx>(cdata: Cmd,
526-
id: ast::NodeId,
527-
tcx: &ty::ctxt<'tcx>)
528-
-> ty::vtable_res<'tcx>
529-
{
530-
let item_doc = lookup_item(id, cdata.data());
531-
let vtables_doc = reader::get_doc(item_doc, tag_item_impl_vtables);
532-
let mut decoder = reader::Decoder::new(vtables_doc);
533-
decoder.read_vtable_res(tcx, cdata)
534-
}
535-
536-
537524
pub fn get_symbol(data: &[u8], id: ast::NodeId) -> String {
538525
return item_symbol(lookup_item(id, data));
539526
}
@@ -1546,6 +1533,14 @@ pub fn is_const_fn(cdata: Cmd, id: ast::NodeId) -> bool {
15461533
}
15471534
}
15481535

1536+
pub fn is_impl(cdata: Cmd, id: ast::NodeId) -> bool {
1537+
let item_doc = lookup_item(id, cdata.data());
1538+
match item_family(item_doc) {
1539+
Impl => true,
1540+
_ => false,
1541+
}
1542+
}
1543+
15491544
fn doc_generics<'tcx>(base_doc: rbml::Doc,
15501545
tcx: &ty::ctxt<'tcx>,
15511546
cdata: Cmd,
@@ -1623,14 +1618,6 @@ fn doc_predicates<'tcx>(base_doc: rbml::Doc,
16231618
ty::GenericPredicates { predicates: predicates }
16241619
}
16251620

1626-
pub fn is_associated_type(cdata: Cmd, id: ast::NodeId) -> bool {
1627-
let items = reader::get_doc(rbml::Doc::new(cdata.data()), tag_items);
1628-
match maybe_find_item(id, items) {
1629-
None => false,
1630-
Some(item) => item_sort(item) == Some('t'),
1631-
}
1632-
}
1633-
16341621
pub fn is_defaulted_trait(cdata: Cmd, trait_id: ast::NodeId) -> bool {
16351622
let trait_doc = lookup_item(trait_id, cdata.data());
16361623
assert!(item_family(trait_doc) == Family::Trait);

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -999,7 +999,7 @@ fn encode_extension_implementations(ecx: &EncodeContext,
999999
});
10001000
}
10011001

1002-
fn encode_stability(rbml_w: &mut Encoder, stab_opt: Option<attr::Stability>) {
1002+
fn encode_stability(rbml_w: &mut Encoder, stab_opt: Option<&attr::Stability>) {
10031003
stab_opt.map(|stab| {
10041004
rbml_w.start_tag(tag_items_data_item_stability);
10051005
stab.encode(rbml_w).unwrap();
@@ -1215,11 +1215,11 @@ fn encode_info_for_item(ecx: &EncodeContext,
12151215
encode_name(rbml_w, item.ident.name);
12161216
encode_unsafety(rbml_w, unsafety);
12171217

1218-
let trait_ref = ty::impl_id_to_trait_ref(tcx, item.id);
1218+
let trait_ref = ty::impl_trait_ref(tcx, local_def(item.id)).unwrap();
12191219
encode_trait_ref(rbml_w, ecx, trait_ref, tag_item_trait_ref);
12201220
rbml_w.end_tag();
12211221
}
1222-
ast::ItemImpl(unsafety, polarity, _, ref opt_trait, ref ty, ref ast_items) => {
1222+
ast::ItemImpl(unsafety, polarity, _, _, ref ty, ref ast_items) => {
12231223
// We need to encode information about the default methods we
12241224
// have inherited, so we drive this based on the impl structure.
12251225
let impl_items = tcx.impl_items.borrow();
@@ -1269,8 +1269,7 @@ fn encode_info_for_item(ecx: &EncodeContext,
12691269
}
12701270
rbml_w.end_tag();
12711271
}
1272-
if opt_trait.is_some() {
1273-
let trait_ref = ty::impl_id_to_trait_ref(tcx, item.id);
1272+
if let Some(trait_ref) = ty::impl_trait_ref(tcx, local_def(item.id)) {
12741273
encode_trait_ref(rbml_w, ecx, trait_ref, tag_item_trait_ref);
12751274
}
12761275
encode_path(rbml_w, path.clone());

0 commit comments

Comments
 (0)