Skip to content

Commit 4b60fd2

Browse files
committed
---
yaml --- r: 272191 b: refs/heads/auto c: 10caca2 h: refs/heads/master i: 272189: aa24f46 272187: 9377726 272183: a8a9f7e 272175: 1cdbda6 272159: ad28d03 272127: 1f8791f
1 parent e8b2308 commit 4b60fd2

File tree

160 files changed

+929
-761
lines changed

Some content is hidden

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

160 files changed

+929
-761
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
88
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
99
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1010
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
11-
refs/heads/auto: d611cc080c4f7a5e078990e6cf74083a1d8c4823
11+
refs/heads/auto: 10caca24f0052a033cac648884d2393125bc24a3
1212
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1313
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336
1414
refs/tags/0.2: 1754d02027f2924bed83b0160ee340c7f41d5ea1

branches/auto/README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,11 +177,10 @@ To contribute to Rust, please see [CONTRIBUTING](CONTRIBUTING.md).
177177
Rust has an [IRC] culture and most real-time collaboration happens in a
178178
variety of channels on Mozilla's IRC network, irc.mozilla.org. The
179179
most popular channel is [#rust], a venue for general discussion about
180-
Rust. And a good place to ask for help would be [#rust-beginners].
180+
Rust, and a good place to ask for help.
181181
182182
[IRC]: https://en.wikipedia.org/wiki/Internet_Relay_Chat
183183
[#rust]: irc://irc.mozilla.org/rust
184-
[#rust-beginners]: irc://irc.mozilla.org/rust-beginners
185184
186185
## License
187186

branches/auto/src/doc/book/getting-started.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -164,15 +164,13 @@ installed. Doing so will depend on your specific system, consult its
164164
documentation for more details.
165165

166166
If not, there are a number of places where we can get help. The easiest is
167-
[the #rust-beginners IRC channel on irc.mozilla.org][irc-beginners] and for
168-
general discussion [the #rust IRC channel on irc.mozilla.org][irc], which we
169-
can access through [Mibbit][mibbit]. Then we'll be chatting with other
170-
Rustaceans (a silly nickname we call ourselves) who can help us out. Other great
171-
resources include [the user’s forum][users] and [Stack Overflow][stackoverflow].
167+
[the #rust IRC channel on irc.mozilla.org][irc], which we can access through
168+
[Mibbit][mibbit]. Click that link, and we'll be chatting with other Rustaceans
169+
(a silly nickname we call ourselves) who can help us out. Other great resources
170+
include [the user’s forum][users], and [Stack Overflow][stackoverflow].
172171

173-
[irc-beginners]: irc://irc.mozilla.org/#rust-beginners
174172
[irc]: irc://irc.mozilla.org/#rust
175-
[mibbit]: http://chat.mibbit.com/?server=irc.mozilla.org&channel=%23rust-beginners,%23rust
173+
[mibbit]: http://chat.mibbit.com/?server=irc.mozilla.org&channel=%23rust
176174
[users]: https://users.rust-lang.org/
177175
[stackoverflow]: http://stackoverflow.com/questions/tagged/rust
178176

branches/auto/src/doc/nomicon/vec.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
To bring everything together, we're going to write `std::Vec` from scratch.
44
Because all the best tools for writing unsafe code are unstable, this
5-
project will only work on nightly (as of Rust 1.9.0). With the exception of the
5+
project will only work on nightly (as of Rust 1.2.0). With the exception of the
66
allocator API, much of the unstable code we'll use is expected to be stabilized
77
in a similar form as it is today.
88

branches/auto/src/libcollections/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
#![feature(placement_new_protocol)]
4949
#![feature(shared)]
5050
#![feature(slice_patterns)]
51-
#![feature(specialization)]
5251
#![feature(staged_api)]
5352
#![feature(step_by)]
5453
#![feature(str_char)]

branches/auto/src/libcollections/string.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1755,7 +1755,7 @@ pub trait ToString {
17551755
#[stable(feature = "rust1", since = "1.0.0")]
17561756
impl<T: fmt::Display + ?Sized> ToString for T {
17571757
#[inline]
1758-
default fn to_string(&self) -> String {
1758+
fn to_string(&self) -> String {
17591759
use core::fmt::Write;
17601760
let mut buf = String::new();
17611761
let _ = buf.write_fmt(format_args!("{}", self));
@@ -1764,14 +1764,6 @@ impl<T: fmt::Display + ?Sized> ToString for T {
17641764
}
17651765
}
17661766

1767-
#[stable(feature = "str_to_string_specialization", since = "1.9.0")]
1768-
impl ToString for str {
1769-
#[inline]
1770-
fn to_string(&self) -> String {
1771-
String::from(self)
1772-
}
1773-
}
1774-
17751767
#[stable(feature = "rust1", since = "1.0.0")]
17761768
impl AsRef<str> for String {
17771769
#[inline]

branches/auto/src/libcore/cell.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,10 @@ impl<T:Copy> Cell<T> {
216216

217217
/// Returns a reference to the underlying `UnsafeCell`.
218218
///
219+
/// # Safety
220+
///
221+
/// This function is `unsafe` because `UnsafeCell`'s field is public.
222+
///
219223
/// # Examples
220224
///
221225
/// ```
@@ -225,11 +229,11 @@ impl<T:Copy> Cell<T> {
225229
///
226230
/// let c = Cell::new(5);
227231
///
228-
/// let uc = c.as_unsafe_cell();
232+
/// let uc = unsafe { c.as_unsafe_cell() };
229233
/// ```
230234
#[inline]
231235
#[unstable(feature = "as_unsafe_cell", issue = "27708")]
232-
pub fn as_unsafe_cell(&self) -> &UnsafeCell<T> {
236+
pub unsafe fn as_unsafe_cell(&self) -> &UnsafeCell<T> {
233237
&self.value
234238
}
235239
}

branches/auto/src/librustc/diagnostics.rs

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1033,6 +1033,47 @@ fn main() {
10331033
some_func(5i32); // ok!
10341034
}
10351035
```
1036+
1037+
Or in a generic context, an erroneous code example would look like:
1038+
```compile_fail
1039+
fn some_func<T>(foo: T) {
1040+
println!("{:?}", foo); // error: the trait `core::fmt::Debug` is not
1041+
// implemented for the type `T`
1042+
}
1043+
1044+
fn main() {
1045+
// We now call the method with the i32 type,
1046+
// which *does* implement the Debug trait.
1047+
some_func(5i32);
1048+
}
1049+
```
1050+
1051+
Note that the error here is in the definition of the generic function: Although
1052+
we only call it with a parameter that does implement `Debug`, the compiler
1053+
still rejects the function: It must work with all possible input types. In
1054+
order to make this example compile, we need to restrict the generic type we're
1055+
accepting:
1056+
```
1057+
use std::fmt;
1058+
1059+
// Restrict the input type to types that implement Debug.
1060+
fn some_func<T: fmt::Debug>(foo: T) {
1061+
println!("{:?}", foo);
1062+
}
1063+
1064+
fn main() {
1065+
// Calling the method is still fine, as i32 implements Debug.
1066+
some_func(5i32);
1067+
1068+
// This would fail to compile now:
1069+
// struct WithoutDebug;
1070+
// some_func(WithoutDebug);
1071+
}
1072+
1073+
Rust only looks at the signature of the called function, as such it must
1074+
already specify all requirements that will be used for every type parameter.
1075+
```
1076+
10361077
"##,
10371078

10381079
E0281: r##"

branches/auto/src/librustc/front/map/mod.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -581,6 +581,14 @@ impl<'ast> Map<'ast> {
581581
}
582582
}
583583

584+
pub fn get_foreign_vis(&self, id: NodeId) -> Visibility {
585+
let vis = self.expect_foreign_item(id).vis; // read recorded by `expect_foreign_item`
586+
match self.find(self.get_parent(id)) { // read recorded by `find`
587+
Some(NodeItem(i)) => vis.inherit_from(i.vis),
588+
_ => vis
589+
}
590+
}
591+
584592
pub fn expect_item(&self, id: NodeId) -> &'ast Item {
585593
match self.find(id) { // read recorded by `find`
586594
Some(NodeItem(item)) => item,

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ use mir::repr::Mir;
3232
use mir::mir_map::MirMap;
3333
use session::Session;
3434
use session::search_paths::PathKind;
35-
use util::nodemap::{FnvHashMap, NodeMap, NodeSet, DefIdMap};
35+
use util::nodemap::{FnvHashMap, NodeMap, NodeSet};
3636
use std::any::Any;
3737
use std::cell::RefCell;
3838
use std::rc::Rc;
@@ -169,7 +169,6 @@ pub trait CrateStore<'tcx> : Any {
169169
fn item_type(&self, tcx: &TyCtxt<'tcx>, def: DefId)
170170
-> ty::TypeScheme<'tcx>;
171171
fn relative_item_path(&self, def: DefId) -> Vec<hir_map::PathElem>;
172-
fn visible_parent_map<'a>(&'a self) -> ::std::cell::RefMut<'a, DefIdMap<DefId>>;
173172
fn extern_item_path(&self, def: DefId) -> Vec<hir_map::PathElem>;
174173
fn item_name(&self, def: DefId) -> ast::Name;
175174
fn item_predicates(&self, tcx: &TyCtxt<'tcx>, def: DefId)
@@ -348,9 +347,6 @@ impl<'tcx> CrateStore<'tcx> for DummyCrateStore {
348347
fn item_type(&self, tcx: &TyCtxt<'tcx>, def: DefId)
349348
-> ty::TypeScheme<'tcx> { unimplemented!() }
350349
fn relative_item_path(&self, def: DefId) -> Vec<hir_map::PathElem> { unimplemented!() }
351-
fn visible_parent_map<'a>(&'a self) -> ::std::cell::RefMut<'a, DefIdMap<DefId>> {
352-
unimplemented!()
353-
}
354350
fn extern_item_path(&self, def: DefId) -> Vec<hir_map::PathElem> { unimplemented!() }
355351
fn item_name(&self, def: DefId) -> ast::Name { unimplemented!() }
356352
fn item_predicates(&self, tcx: &TyCtxt<'tcx>, def: DefId)

branches/auto/src/librustc/ty/item_path.rs

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

1111
use front::map::DefPathData;
1212
use middle::cstore::LOCAL_CRATE;
13-
use middle::def_id::{DefId, CRATE_DEF_INDEX};
13+
use middle::def_id::DefId;
1414
use ty::{self, Ty, TyCtxt};
1515
use syntax::ast;
1616

@@ -75,51 +75,9 @@ impl<'tcx> TyCtxt<'tcx> {
7575
}
7676
}
7777

78-
/// If possible, this pushes a global path resolving to `external_def_id` that is visible
79-
/// from at least one local module and returns true. If the crate defining `external_def_id` is
80-
/// declared with an `extern crate`, the path is guarenteed to use the `extern crate`.
81-
pub fn try_push_visible_item_path<T>(&self, buffer: &mut T, external_def_id: DefId) -> bool
82-
where T: ItemPathBuffer
83-
{
84-
let visible_parent_map = self.sess.cstore.visible_parent_map();
85-
86-
let (mut cur_def, mut cur_path) = (external_def_id, Vec::<ast::Name>::new());
87-
loop {
88-
// If `cur_def` is a direct or injected extern crate, push the path to the crate
89-
// followed by the path to the item within the crate and return.
90-
if cur_def.index == CRATE_DEF_INDEX {
91-
match self.sess.cstore.extern_crate(cur_def.krate) {
92-
Some(extern_crate) if extern_crate.direct => {
93-
self.push_item_path(buffer, extern_crate.def_id);
94-
cur_path.iter().rev().map(|segment| buffer.push(&segment.as_str())).count();
95-
return true;
96-
}
97-
None => {
98-
buffer.push(&self.crate_name(cur_def.krate));
99-
cur_path.iter().rev().map(|segment| buffer.push(&segment.as_str())).count();
100-
return true;
101-
}
102-
_ => {},
103-
}
104-
}
105-
106-
cur_path.push(self.sess.cstore.item_name(cur_def));
107-
match visible_parent_map.get(&cur_def) {
108-
Some(&def) => cur_def = def,
109-
None => return false,
110-
};
111-
}
112-
}
113-
11478
pub fn push_item_path<T>(&self, buffer: &mut T, def_id: DefId)
11579
where T: ItemPathBuffer
11680
{
117-
match *buffer.root_mode() {
118-
RootMode::Local if !def_id.is_local() =>
119-
if self.try_push_visible_item_path(buffer, def_id) { return },
120-
_ => {}
121-
}
122-
12381
let key = self.def_key(def_id);
12482
match key.disambiguated_data.data {
12583
DefPathData::CrateRoot => {

branches/auto/src/librustc_metadata/csearch.rs

Lines changed: 3 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,17 @@ use decoder;
1313
use encoder;
1414
use loader;
1515

16-
use middle::cstore::{CrateStore, CrateSource, ChildItem, ExternCrate, FoundAst, DefLike};
16+
use middle::cstore::{CrateStore, CrateSource, ChildItem, ExternCrate, FoundAst};
1717
use middle::cstore::{NativeLibraryKind, LinkMeta, LinkagePreference};
1818
use middle::def;
1919
use middle::lang_items;
2020
use rustc::ty::{self, Ty, TyCtxt, VariantKind};
21-
use middle::def_id::{DefId, DefIndex, CRATE_DEF_INDEX};
21+
use middle::def_id::{DefId, DefIndex};
2222

2323
use rustc::front::map as hir_map;
2424
use rustc::mir::repr::Mir;
2525
use rustc::mir::mir_map::MirMap;
26-
use rustc::util::nodemap::{FnvHashMap, NodeMap, NodeSet, DefIdMap};
26+
use rustc::util::nodemap::{FnvHashMap, NodeMap, NodeSet};
2727

2828
use std::cell::RefCell;
2929
use std::rc::Rc;
@@ -544,60 +544,4 @@ impl<'tcx> CrateStore<'tcx> for cstore::CStore {
544544
{
545545
encoder::metadata_encoding_version
546546
}
547-
548-
/// Returns a map from a sufficiently visible external item (i.e. an external item that is
549-
/// visible from at least one local module) to a sufficiently visible parent (considering
550-
/// modules that re-export the external item to be parents).
551-
fn visible_parent_map<'a>(&'a self) -> ::std::cell::RefMut<'a, DefIdMap<DefId>> {
552-
let mut visible_parent_map = self.visible_parent_map.borrow_mut();
553-
if !visible_parent_map.is_empty() { return visible_parent_map; }
554-
555-
use rustc_front::hir;
556-
use rustc::middle::cstore::{CrateStore, ChildItem};
557-
use std::collections::vec_deque::VecDeque;
558-
use std::collections::hash_map::Entry;
559-
for cnum in 1 .. self.next_crate_num() {
560-
let cdata = self.get_crate_data(cnum);
561-
562-
match cdata.extern_crate.get() {
563-
// Ignore crates without a corresponding local `extern crate` item.
564-
Some(extern_crate) if !extern_crate.direct => continue,
565-
_ => {},
566-
}
567-
568-
let mut bfs_queue = &mut VecDeque::new();
569-
let mut add_child = |bfs_queue: &mut VecDeque<_>, child: ChildItem, parent: DefId| {
570-
let child = match child.def {
571-
DefLike::DlDef(def) if child.vis == hir::Public => def.def_id(),
572-
_ => return,
573-
};
574-
575-
match visible_parent_map.entry(child) {
576-
Entry::Occupied(mut entry) => {
577-
// If `child` is defined in crate `cnum`, ensure
578-
// that it is mapped to a parent in `cnum`.
579-
if child.krate == cnum && entry.get().krate != cnum {
580-
entry.insert(parent);
581-
}
582-
}
583-
Entry::Vacant(entry) => {
584-
entry.insert(parent);
585-
bfs_queue.push_back(child);
586-
}
587-
}
588-
};
589-
590-
let croot = DefId { krate: cnum, index: CRATE_DEF_INDEX };
591-
for child in self.crate_top_level_items(cnum) {
592-
add_child(bfs_queue, child, croot);
593-
}
594-
while let Some(def) = bfs_queue.pop_front() {
595-
for child in self.item_children(def) {
596-
add_child(bfs_queue, child, def);
597-
}
598-
}
599-
}
600-
601-
visible_parent_map
602-
}
603547
}

branches/auto/src/librustc_metadata/cstore.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ use loader;
2222

2323
use rustc::back::svh::Svh;
2424
use rustc::middle::cstore::{ExternCrate};
25-
use rustc::util::nodemap::{FnvHashMap, NodeMap, NodeSet, DefIdMap};
26-
use rustc::middle::def_id::DefId;
25+
use rustc::util::nodemap::{FnvHashMap, NodeMap, NodeSet};
2726

2827
use std::cell::{RefCell, Ref, Cell};
2928
use std::rc::Rc;
@@ -93,7 +92,6 @@ pub struct CStore {
9392
used_link_args: RefCell<Vec<String>>,
9493
statically_included_foreign_items: RefCell<NodeSet>,
9594
pub intr: Rc<IdentInterner>,
96-
pub visible_parent_map: RefCell<DefIdMap<DefId>>,
9795
}
9896

9997
impl CStore {
@@ -106,7 +104,6 @@ impl CStore {
106104
used_link_args: RefCell::new(Vec::new()),
107105
intr: intr,
108106
statically_included_foreign_items: RefCell::new(NodeSet()),
109-
visible_parent_map: RefCell::new(FnvHashMap()),
110107
}
111108
}
112109

0 commit comments

Comments
 (0)