Skip to content

Commit 1c1ab59

Browse files
committed
---
yaml --- r: 272817 b: refs/heads/beta c: 13f5fca h: refs/heads/master i: 272815: a7c7dbb
1 parent 10e7ec9 commit 1c1ab59

File tree

20 files changed

+424
-614
lines changed

20 files changed

+424
-614
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ refs/tags/0.9: 36870b185fc5f5486636d4515f0e22677493f225
2323
refs/tags/0.10: ac33f2b15782272ae348dbd7b14b8257b2148b5a
2424
refs/tags/0.11.0: e1247cb1d0d681be034adb4b558b5a0c0d5720f9
2525
refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
26-
refs/heads/beta: 52e0bda644823089f16795cc9e071cf827b4810b
26+
refs/heads/beta: 13f5fca0f2c72b8af256f052b51bd636b6932c8a
2727
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
2828
refs/heads/tmp: e06d2ad9fcd5027bcaac5b08fc9aa39a49d0ecd3
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f

branches/beta/mk/cfg/i686-pc-windows-gnu.mk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,5 @@ CFG_GNU_TRIPLE_i686-pc-windows-gnu := i686-w64-mingw32
2525
CFG_THIRD_PARTY_OBJECTS_i686-pc-windows-gnu := crt2.o dllcrt2.o
2626
CFG_INSTALLED_OBJECTS_i686-pc-windows-gnu := crt2.o dllcrt2.o rsbegin.o rsend.o
2727
CFG_RUSTRT_HAS_STARTUP_OBJS_i686-pc-windows-gnu := 1
28+
# FIXME(#31030) - there's not a great reason to disable jemalloc here
29+
CFG_DISABLE_JEMALLOC_i686-pc-windows-gnu := 1

branches/beta/mk/cfg/x86_64-pc-windows-gnu.mk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,5 @@ CFG_GNU_TRIPLE_x86_64-pc-windows-gnu := x86_64-w64-mingw32
2525
CFG_THIRD_PARTY_OBJECTS_x86_64-pc-windows-gnu := crt2.o dllcrt2.o
2626
CFG_INSTALLED_OBJECTS_x86_64-pc-windows-gnu := crt2.o dllcrt2.o rsbegin.o rsend.o
2727
CFG_RUSTRT_HAS_STARTUP_OBJS_x86_64-pc-windows-gnu := 1
28+
# FIXME(#31030) - there's not a great reason to disable jemalloc here
29+
CFG_DISABLE_JEMALLOC_x86_64-pc-windows-gnu := 1

branches/beta/src/bootstrap/build/sanity.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ pub fn check(build: &mut Build) {
7979
}
8080

8181
// Make sure musl-root is valid if specified
82-
if target.contains("musl") && target.contains("x86_64") {
82+
if target.contains("musl") {
8383
match build.config.musl_root {
8484
Some(ref root) => {
8585
if fs::metadata(root.join("lib/libc.a")).is_err() {

branches/beta/src/doc/book/vectors.md

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -115,36 +115,6 @@ for i in v {
115115
}
116116
```
117117

118-
Note: You cannot use the vector again once you have iterated by taking ownership of the vector.
119-
You can iterate the vector multiple times by taking a reference to the vector whilst iterating.
120-
For example, the following code does not compile.
121-
122-
```rust,ignore
123-
let mut v = vec![1, 2, 3, 4, 5];
124-
125-
for i in v {
126-
println!("Take ownership of the vector and its element {}", i);
127-
}
128-
129-
for i in v {
130-
println!("Take ownership of the vector and its element {}", i);
131-
}
132-
```
133-
134-
Whereas the following works perfectly,
135-
136-
```rust
137-
let mut v = vec![1, 2, 3, 4, 5];
138-
139-
for i in &v {
140-
println!("This is a reference to {}", i);
141-
}
142-
143-
for i in &v {
144-
println!("This is a reference to {}", i);
145-
}
146-
```
147-
148118
Vectors have many more useful methods, which you can read about in [their
149119
API documentation][vec].
150120

branches/beta/src/jemalloc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Subproject commit aab1c0a0e0b39825b16673128729ef46310a5da8
1+
Subproject commit e24a1a025a1f214e40eedafe3b9c7b1d69937922

branches/beta/src/libcore/iter.rs

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1532,7 +1532,7 @@ pub trait Iterator {
15321532
/// An iterator adaptor that applies a function, producing a single, final value.
15331533
///
15341534
/// `fold()` takes two arguments: an initial value, and a closure with two
1535-
/// arguments: an 'accumulator', and an element. The closure returns the value that
1535+
/// arguments: an 'accumulator', and an element. It returns the value that
15361536
/// the accumulator should have for the next iteration.
15371537
///
15381538
/// The initial value is the value the accumulator will have on the first
@@ -3851,17 +3851,6 @@ impl<I> Iterator for Skip<I> where I: Iterator {
38513851
#[stable(feature = "rust1", since = "1.0.0")]
38523852
impl<I> ExactSizeIterator for Skip<I> where I: ExactSizeIterator {}
38533853

3854-
#[stable(feature = "double_ended_skip_iterator", since = "1.8.0")]
3855-
impl<I> DoubleEndedIterator for Skip<I> where I: DoubleEndedIterator + ExactSizeIterator {
3856-
fn next_back(&mut self) -> Option<Self::Item> {
3857-
if self.len() > 0 {
3858-
self.iter.next_back()
3859-
} else {
3860-
None
3861-
}
3862-
}
3863-
}
3864-
38653854
/// An iterator that only iterates over the first `n` iterations of `iter`.
38663855
///
38673856
/// This `struct` is created by the [`take()`] method on [`Iterator`]. See its

branches/beta/src/libcore/str/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1095,6 +1095,8 @@ fn eq_slice(a: &str, b: &str) -> bool {
10951095
/// faster than comparing each byte in a loop.
10961096
#[inline]
10971097
unsafe fn cmp_slice(a: &str, b: &str, len: usize) -> i32 {
1098+
// NOTE: In theory n should be libc::size_t and not usize, but libc is not available here
1099+
#[allow(improper_ctypes)]
10981100
extern { fn memcmp(s1: *const i8, s2: *const i8, n: usize) -> i32; }
10991101
memcmp(a.as_ptr() as *const i8, b.as_ptr() as *const i8, len)
11001102
}

branches/beta/src/libcoretest/iter.rs

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -303,44 +303,6 @@ fn test_iterator_skip() {
303303
assert_eq!(it.len(), 0);
304304
}
305305

306-
#[test]
307-
fn test_iterator_skip_doubleended() {
308-
let xs = [0, 1, 2, 3, 5, 13, 15, 16, 17, 19, 20, 30];
309-
let mut it = xs.iter().rev().skip(5);
310-
assert_eq!(it.next(), Some(&15));
311-
assert_eq!(it.by_ref().rev().next(), Some(&0));
312-
assert_eq!(it.next(), Some(&13));
313-
assert_eq!(it.by_ref().rev().next(), Some(&1));
314-
assert_eq!(it.next(), Some(&5));
315-
assert_eq!(it.by_ref().rev().next(), Some(&2));
316-
assert_eq!(it.next(), Some(&3));
317-
assert_eq!(it.next(), None);
318-
let mut it = xs.iter().rev().skip(5).rev();
319-
assert_eq!(it.next(), Some(&0));
320-
assert_eq!(it.rev().next(), Some(&15));
321-
let mut it_base = xs.iter();
322-
{
323-
let mut it = it_base.by_ref().skip(5).rev();
324-
assert_eq!(it.next(), Some(&30));
325-
assert_eq!(it.next(), Some(&20));
326-
assert_eq!(it.next(), Some(&19));
327-
assert_eq!(it.next(), Some(&17));
328-
assert_eq!(it.next(), Some(&16));
329-
assert_eq!(it.next(), Some(&15));
330-
assert_eq!(it.next(), Some(&13));
331-
assert_eq!(it.next(), None);
332-
}
333-
// make sure the skipped parts have not been consumed
334-
assert_eq!(it_base.next(), Some(&0));
335-
assert_eq!(it_base.next(), Some(&1));
336-
assert_eq!(it_base.next(), Some(&2));
337-
assert_eq!(it_base.next(), Some(&3));
338-
assert_eq!(it_base.next(), Some(&5));
339-
assert_eq!(it_base.next(), None);
340-
let it = xs.iter().skip(5).rev();
341-
assert_eq!(it.last(), Some(&13));
342-
}
343-
344306
#[test]
345307
fn test_iterator_skip_nth() {
346308
let xs = [0, 1, 2, 3, 5, 13, 15, 16, 17, 19, 20, 30];

branches/beta/src/librustc_privacy/lib.rs

Lines changed: 38 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -492,11 +492,6 @@ enum FieldName {
492492
}
493493

494494
impl<'a, 'tcx> PrivacyVisitor<'a, 'tcx> {
495-
// used when debugging
496-
fn nodestr(&self, id: ast::NodeId) -> String {
497-
self.tcx.map.node_to_string(id).to_string()
498-
}
499-
500495
// Determines whether the given definition is public from the point of view
501496
// of the current item.
502497
fn def_privacy(&self, did: DefId) -> PrivacyResult {
@@ -604,75 +599,50 @@ impl<'a, 'tcx> PrivacyVisitor<'a, 'tcx> {
604599
return Allowable;
605600
}
606601

607-
// We now know that there is at least one private member between the
608-
// destination and the root.
609-
let mut closest_private_id = node_id;
610-
loop {
611-
debug!("privacy - examining {}", self.nodestr(closest_private_id));
612-
let vis = match self.tcx.map.find(closest_private_id) {
613-
// If this item is a method, then we know for sure that it's an
614-
// actual method and not a static method. The reason for this is
615-
// that these cases are only hit in the ExprMethodCall
616-
// expression, and ExprCall will have its path checked later
617-
// (the path of the trait/impl) if it's a static method.
618-
//
619-
// With this information, then we can completely ignore all
620-
// trait methods. The privacy violation would be if the trait
621-
// couldn't get imported, not if the method couldn't be used
622-
// (all trait methods are public).
623-
//
624-
// However, if this is an impl method, then we dictate this
625-
// decision solely based on the privacy of the method
626-
// invocation.
627-
// FIXME(#10573) is this the right behavior? Why not consider
628-
// where the method was defined?
629-
Some(ast_map::NodeImplItem(ii)) => {
630-
match ii.node {
631-
hir::ImplItemKind::Const(..) |
632-
hir::ImplItemKind::Method(..) => {
633-
let imp = self.tcx.map
634-
.get_parent_did(closest_private_id);
635-
match self.tcx.impl_trait_ref(imp) {
636-
Some(..) => return Allowable,
637-
_ if ii.vis == hir::Public => {
638-
return Allowable
639-
}
640-
_ => ii.vis
641-
}
602+
let vis = match self.tcx.map.find(node_id) {
603+
// If this item is a method, then we know for sure that it's an
604+
// actual method and not a static method. The reason for this is
605+
// that these cases are only hit in the ExprMethodCall
606+
// expression, and ExprCall will have its path checked later
607+
// (the path of the trait/impl) if it's a static method.
608+
//
609+
// With this information, then we can completely ignore all
610+
// trait methods. The privacy violation would be if the trait
611+
// couldn't get imported, not if the method couldn't be used
612+
// (all trait methods are public).
613+
//
614+
// However, if this is an impl method, then we dictate this
615+
// decision solely based on the privacy of the method
616+
// invocation.
617+
Some(ast_map::NodeImplItem(ii)) => {
618+
match ii.node {
619+
hir::ImplItemKind::Const(..) |
620+
hir::ImplItemKind::Method(..) => {
621+
let imp = self.tcx.map.get_parent_did(node_id);
622+
match self.tcx.impl_trait_ref(imp) {
623+
Some(..) => hir::Public,
624+
_ => ii.vis
642625
}
643-
hir::ImplItemKind::Type(_) => return Allowable,
644626
}
627+
hir::ImplItemKind::Type(_) => hir::Public,
645628
}
646-
Some(ast_map::NodeTraitItem(_)) => {
647-
return Allowable;
648-
}
629+
}
630+
Some(ast_map::NodeTraitItem(_)) => hir::Public,
649631

650-
// This is not a method call, extract the visibility as one
651-
// would normally look at it
652-
Some(ast_map::NodeItem(it)) => it.vis,
653-
Some(ast_map::NodeForeignItem(_)) => {
654-
self.tcx.map.get_foreign_vis(closest_private_id)
655-
}
656-
Some(ast_map::NodeVariant(..)) => {
657-
hir::Public // need to move up a level (to the enum)
658-
}
659-
_ => hir::Public,
660-
};
661-
if vis != hir::Public { break }
662-
// if we've reached the root, then everything was allowable and this
663-
// access is public.
664-
if closest_private_id == ast::CRATE_NODE_ID { return Allowable }
665-
closest_private_id = *self.parents.get(&closest_private_id).unwrap();
666-
667-
// If we reached the top, then we were public all the way down and
668-
// we can allow this access.
669-
if closest_private_id == ast::DUMMY_NODE_ID { return Allowable }
670-
}
671-
debug!("privacy - closest priv {}", self.nodestr(closest_private_id));
672-
if self.private_accessible(closest_private_id) {
632+
// This is not a method call, extract the visibility as one
633+
// would normally look at it
634+
Some(ast_map::NodeItem(it)) => it.vis,
635+
Some(ast_map::NodeForeignItem(_)) => {
636+
self.tcx.map.get_foreign_vis(node_id)
637+
}
638+
_ => hir::Public,
639+
};
640+
if vis == hir::Public { return Allowable }
641+
642+
if self.private_accessible(node_id) {
673643
Allowable
674644
} else {
675-
DisallowedBy(closest_private_id)
645+
DisallowedBy(node_id)
676646
}
677647
}
678648

branches/beta/src/librustc_resolve/build_reduced_graph.rs

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -98,14 +98,14 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> {
9898
fn try_define<T>(&self, parent: Module<'b>, name: Name, ns: Namespace, def: T)
9999
where T: ToNameBinding<'b>
100100
{
101-
let _ = parent.try_define_child(name, ns, def.to_name_binding());
101+
let _ = parent.try_define_child(name, ns, self.new_name_binding(def.to_name_binding()));
102102
}
103103

104104
/// Defines `name` in namespace `ns` of module `parent` to be `def` if it is not yet defined;
105105
/// otherwise, reports an error.
106106
fn define<T: ToNameBinding<'b>>(&self, parent: Module<'b>, name: Name, ns: Namespace, def: T) {
107-
let binding = def.to_name_binding();
108-
let old_binding = match parent.try_define_child(name, ns, binding.clone()) {
107+
let binding = self.new_name_binding(def.to_name_binding());
108+
let old_binding = match parent.try_define_child(name, ns, binding) {
109109
Ok(()) => return,
110110
Err(old_binding) => old_binding,
111111
};
@@ -207,7 +207,7 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> {
207207
ResolutionError::SelfImportsOnlyAllowedWithin);
208208
}
209209

210-
let subclass = ImportDirectiveSubclass::single(binding, source_name);
210+
let subclass = SingleImport(binding, source_name);
211211
self.build_import_directive(parent,
212212
module_path,
213213
subclass,
@@ -258,10 +258,9 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> {
258258
(module_path.to_vec(), name, rename)
259259
}
260260
};
261-
let subclass = ImportDirectiveSubclass::single(rename, name);
262261
self.build_import_directive(parent,
263262
module_path,
264-
subclass,
263+
SingleImport(rename, name),
265264
source_item.span,
266265
source_item.node.id(),
267266
is_public,
@@ -295,6 +294,14 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> {
295294
let module = self.new_extern_crate_module(parent_link, def, is_public, item.id);
296295
self.define(parent, name, TypeNS, (module, sp));
297296

297+
if is_public {
298+
let export = Export { name: name, def_id: def_id };
299+
if let Some(def_id) = parent.def_id() {
300+
let node_id = self.resolver.ast_map.as_local_node_id(def_id).unwrap();
301+
self.export_map.entry(node_id).or_insert(Vec::new()).push(export);
302+
}
303+
}
304+
298305
self.build_reduced_graph_for_external_crate(module);
299306
}
300307
parent
@@ -676,25 +683,33 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> {
676683
id: NodeId,
677684
is_public: bool,
678685
shadowable: Shadowable) {
686+
module_.unresolved_imports
687+
.borrow_mut()
688+
.push(ImportDirective::new(module_path, subclass, span, id, is_public, shadowable));
689+
self.unresolved_imports += 1;
690+
691+
if is_public {
692+
module_.inc_pub_count();
693+
}
694+
679695
// Bump the reference count on the name. Or, if this is a glob, set
680696
// the appropriate flag.
681697

682698
match subclass {
683-
SingleImport { target, .. } => {
699+
SingleImport(target, _) => {
684700
module_.increment_outstanding_references_for(target, ValueNS);
685701
module_.increment_outstanding_references_for(target, TypeNS);
686702
}
687703
GlobImport => {
688704
// Set the glob flag. This tells us that we don't know the
689705
// module's exports ahead of time.
690-
module_.inc_glob_count(is_public)
706+
707+
module_.inc_glob_count();
708+
if is_public {
709+
module_.inc_pub_glob_count();
710+
}
691711
}
692712
}
693-
694-
let directive =
695-
ImportDirective::new(module_path, subclass, span, id, is_public, shadowable);
696-
module_.add_import_directive(directive);
697-
self.unresolved_imports += 1;
698713
}
699714
}
700715

0 commit comments

Comments
 (0)