Skip to content

Commit f251dab

Browse files
committed
---
yaml --- r: 196027 b: refs/heads/beta c: 15b58fe h: refs/heads/master i: 196025: 2e1a504 196023: 0d5e094 v: v3
1 parent b096c8f commit f251dab

File tree

3 files changed

+20
-10
lines changed

3 files changed

+20
-10
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
2929
refs/heads/automation-fail: 1bf06495443584539b958873e04cc2f864ab10e4
3030
refs/heads/batch: b7fd822592a4fb577552d93010c4a4e14f314346
3131
refs/heads/building: 126db549b038c84269a1e4fe46f051b2c15d6970
32-
refs/heads/beta: 30b2d9e7643de3a267029c2763edb0b44ff2396e
32+
refs/heads/beta: 15b58fedcacba7d10a9f7d460a83da645a09ad3e
3333
refs/heads/windistfix: 7608dbad651f02e837ed05eef3d74a6662a6e928
3434
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
3535
refs/heads/tmp: 9de34a84bb300bab1bf0227f577331620cd60511

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ use std::io::prelude::*;
3434
use std::io::{Cursor, SeekFrom};
3535
use syntax::abi;
3636
use syntax::ast::{self, DefId, NodeId};
37-
use syntax::ast_map::{PathElem, PathElems};
38-
use syntax::ast_map;
37+
use syntax::ast_map::{self, LinkedPath, PathElem, PathElems};
3938
use syntax::ast_util::*;
4039
use syntax::ast_util;
4140
use syntax::attr;
@@ -1513,7 +1512,7 @@ fn encode_info_for_items(ecx: &EncodeContext,
15131512
&krate.module,
15141513
&[],
15151514
ast::CRATE_NODE_ID,
1516-
[].iter().cloned().chain(None),
1515+
[].iter().cloned().chain(LinkedPath::empty()),
15171516
syntax::parse::token::special_idents::invalid,
15181517
ast::Public);
15191518

@@ -1874,7 +1873,7 @@ fn encode_misc_info(ecx: &EncodeContext,
18741873
}
18751874

18761875
// Encode reexports for the root module.
1877-
encode_reexports(ecx, rbml_w, 0, [].iter().cloned().chain(None));
1876+
encode_reexports(ecx, rbml_w, 0, [].iter().cloned().chain(LinkedPath::empty()));
18781877

18791878
rbml_w.end_tag();
18801879
rbml_w.end_tag();

branches/beta/src/libsyntax/ast_map/mod.rs

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,18 +53,29 @@ impl fmt::Display for PathElem {
5353
}
5454

5555
#[derive(Clone)]
56-
struct LinkedPathNode<'a> {
56+
pub struct LinkedPathNode<'a> {
5757
node: PathElem,
5858
next: LinkedPath<'a>,
5959
}
6060

61-
type LinkedPath<'a> = Option<&'a LinkedPathNode<'a>>;
61+
#[derive(Copy, Clone)]
62+
pub struct LinkedPath<'a>(Option<&'a LinkedPathNode<'a>>);
63+
64+
impl<'a> LinkedPath<'a> {
65+
pub fn empty() -> LinkedPath<'a> {
66+
LinkedPath(None)
67+
}
68+
69+
pub fn from(node: &'a LinkedPathNode) -> LinkedPath<'a> {
70+
LinkedPath(Some(node))
71+
}
72+
}
6273

6374
impl<'a> Iterator for LinkedPath<'a> {
6475
type Item = PathElem;
6576

6677
fn next(&mut self) -> Option<PathElem> {
67-
match *self {
78+
match self.0 {
6879
Some(node) => {
6980
*self = node.next;
7081
Some(node.node)
@@ -384,7 +395,7 @@ impl<'ast> Map<'ast> {
384395
pub fn with_path<T, F>(&self, id: NodeId, f: F) -> T where
385396
F: FnOnce(PathElems) -> T,
386397
{
387-
self.with_path_next(id, None, f)
398+
self.with_path_next(id, LinkedPath::empty(), f)
388399
}
389400

390401
pub fn path_to_string(&self, id: NodeId) -> String {
@@ -422,7 +433,7 @@ impl<'ast> Map<'ast> {
422433
_ => f([].iter().cloned().chain(next))
423434
}
424435
} else {
425-
self.with_path_next(parent, Some(&LinkedPathNode {
436+
self.with_path_next(parent, LinkedPath::from(&LinkedPathNode {
426437
node: self.get_path_elem(id),
427438
next: next
428439
}), f)

0 commit comments

Comments
 (0)