Skip to content

Commit 44bb0ba

Browse files
committed
---
yaml --- r: 149803 b: refs/heads/try2 c: 1c86179 h: refs/heads/master i: 149801: 4b6165c 149799: 1c80022 v: v3
1 parent 76d8d06 commit 44bb0ba

File tree

20 files changed

+46
-89
lines changed

20 files changed

+46
-89
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 3ade32145b41eaca9a66e716fc1eb868a32d9d75
8+
refs/heads/try2: 1c86179dba342857e782c97e9e9f53f0aa3bf8fc
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/RELEASES.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -745,8 +745,8 @@ Version 0.2 (March 2012)
745745
* Merged per-platform std::{os*, fs*} to core::{libc, os}
746746
* Extensive cleanup, regularization in libstd, libcore
747747

748-
Version 0.1 (January 2012)
749-
---------------------------
748+
Version 0.1 (January 20, 2012)
749+
-------------------------------
750750

751751
* Most language features work, including:
752752
* Unique pointers, unique closures, move semantics

branches/try2/src/librustc/front/feature_gate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ impl Visitor<()> for Context {
134134
}
135135
}
136136
}
137-
ast::ViewItemExternCrate(..) => {
137+
ast::ViewItemExternMod(..) => {
138138
for attr in i.attrs.iter() {
139139
if attr.name().get() == "phase"{
140140
self.gate_feature("phase", attr.span,

branches/try2/src/librustc/front/std_inject.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ pub fn with_version(krate: &str) -> Option<(InternedString, ast::StrStyle)> {
7474
impl fold::Folder for StandardLibraryInjector {
7575
fn fold_crate(&mut self, krate: ast::Crate) -> ast::Crate {
7676
let mut vis = vec!(ast::ViewItem {
77-
node: ast::ViewItemExternCrate(token::str_to_ident("std"),
77+
node: ast::ViewItemExternMod(token::str_to_ident("std"),
7878
with_version("std"),
7979
ast::DUMMY_NODE_ID),
8080
attrs: vec!(
@@ -90,15 +90,15 @@ impl fold::Folder for StandardLibraryInjector {
9090

9191
if use_uv(&krate) && !self.sess.building_library.get() {
9292
vis.push(ast::ViewItem {
93-
node: ast::ViewItemExternCrate(token::str_to_ident("green"),
93+
node: ast::ViewItemExternMod(token::str_to_ident("green"),
9494
with_version("green"),
9595
ast::DUMMY_NODE_ID),
9696
attrs: Vec::new(),
9797
vis: ast::Inherited,
9898
span: DUMMY_SP
9999
});
100100
vis.push(ast::ViewItem {
101-
node: ast::ViewItemExternCrate(token::str_to_ident("rustuv"),
101+
node: ast::ViewItemExternMod(token::str_to_ident("rustuv"),
102102
with_version("rustuv"),
103103
ast::DUMMY_NODE_ID),
104104
attrs: Vec::new(),

branches/try2/src/librustc/front/test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ fn mk_std(cx: &TestCtxt) -> ast::ViewItem {
306306
path_node(~[id_test]),
307307
ast::DUMMY_NODE_ID))))
308308
} else {
309-
ast::ViewItemExternCrate(id_test,
309+
ast::ViewItemExternMod(id_test,
310310
with_version("test"),
311311
ast::DUMMY_NODE_ID)
312312
};

branches/try2/src/librustc/metadata/creader.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ struct CrateInfo {
167167

168168
fn extract_crate_info(e: &Env, i: &ast::ViewItem) -> Option<CrateInfo> {
169169
match i.node {
170-
ast::ViewItemExternCrate(ident, ref path_opt, id) => {
170+
ast::ViewItemExternMod(ident, ref path_opt, id) => {
171171
let ident = token::get_ident(ident);
172172
debug!("resolving extern crate stmt. ident: {:?} path_opt: {:?}",
173173
ident, path_opt);

branches/try2/src/librustc/middle/privacy.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -845,7 +845,7 @@ impl<'a> Visitor<()> for PrivacyVisitor<'a> {
845845

846846
fn visit_view_item(&mut self, a: &ast::ViewItem, _: ()) {
847847
match a.node {
848-
ast::ViewItemExternCrate(..) => {}
848+
ast::ViewItemExternMod(..) => {}
849849
ast::ViewItemUse(ref uses) => {
850850
for vpath in uses.iter() {
851851
match vpath.node {
@@ -976,7 +976,7 @@ impl Visitor<()> for SanePrivacyVisitor {
976976
reachable");
977977
} else {
978978
match i.node {
979-
ast::ViewItemExternCrate(..) => {
979+
ast::ViewItemExternMod(..) => {
980980
self.tcx.sess.span_err(i.span, "`pub` visibility \
981981
is not allowed");
982982
}

branches/try2/src/librustc/middle/resolve.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1516,7 +1516,7 @@ impl Resolver {
15161516
}
15171517
}
15181518

1519-
ViewItemExternCrate(name, _, node_id) => {
1519+
ViewItemExternMod(name, _, node_id) => {
15201520
// n.b. we don't need to look at the path option here, because cstore already did
15211521
match self.session.cstore.find_extern_mod_stmt_cnum(node_id) {
15221522
Some(crate_id) => {
@@ -5415,7 +5415,7 @@ impl Resolver {
54155415
if vi.span == DUMMY_SP { return }
54165416

54175417
match vi.node {
5418-
ViewItemExternCrate(..) => {} // ignore
5418+
ViewItemExternMod(..) => {} // ignore
54195419
ViewItemUse(ref path) => {
54205420
for p in path.iter() {
54215421
match p.node {

branches/try2/src/librustc/util/nodemap.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,8 @@ impl Writer for FnvState {
118118
fn write(&mut self, bytes: &[u8]) -> io::IoResult<()> {
119119
let FnvState(mut hash) = *self;
120120
for byte in bytes.iter() {
121-
hash = hash ^ (*byte as u64);
122121
hash = hash * 0x100000001b3;
122+
hash = hash ^ (*byte as u64);
123123
}
124124
*self = FnvState(hash);
125125
Ok(())

branches/try2/src/librustdoc/clean.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1066,19 +1066,19 @@ impl Clean<Item> for ast::ViewItem {
10661066

10671067
#[deriving(Clone, Encodable, Decodable)]
10681068
pub enum ViewItemInner {
1069-
ExternCrate(~str, Option<~str>, ast::NodeId),
1069+
ExternMod(~str, Option<~str>, ast::NodeId),
10701070
Import(~[ViewPath])
10711071
}
10721072

10731073
impl Clean<ViewItemInner> for ast::ViewItem_ {
10741074
fn clean(&self) -> ViewItemInner {
10751075
match self {
1076-
&ast::ViewItemExternCrate(ref i, ref p, ref id) => {
1076+
&ast::ViewItemExternMod(ref i, ref p, ref id) => {
10771077
let string = match *p {
10781078
None => None,
10791079
Some((ref x, _)) => Some(x.get().to_owned()),
10801080
};
1081-
ExternCrate(i.clean(), string, *id)
1081+
ExternMod(i.clean(), string, *id)
10821082
}
10831083
&ast::ViewItemUse(ref vp) => {
10841084
Import(vp.clean().move_iter().collect())

branches/try2/src/librustdoc/html/render.rs

Lines changed: 13 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ use std::io;
3939
use std::io::{fs, File, BufferedWriter};
4040
use std::str;
4141
use std::vec;
42-
use std::vec_ng::Vec;
4342
use collections::{HashMap, HashSet};
4443

4544
use sync::Arc;
@@ -161,13 +160,6 @@ pub struct Cache {
161160
priv search_index: ~[IndexItem],
162161
priv privmod: bool,
163162
priv public_items: NodeSet,
164-
165-
// In rare case where a structure is defined in one module but implemented
166-
// in another, if the implementing module is parsed before defining module,
167-
// then the fully qualified name of the structure isn't presented in `paths`
168-
// yet when its implementation methods are being indexed. Caches such methods
169-
// and their parent id here and indexes them at the end of crate parsing.
170-
priv orphan_methods: Vec<(ast::NodeId, clean::Item)>,
171163
}
172164

173165
/// Helper struct to render all source code to HTML pages
@@ -257,31 +249,10 @@ pub fn run(mut krate: clean::Crate, dst: Path) -> io::IoResult<()> {
257249
extern_locations: HashMap::new(),
258250
privmod: false,
259251
public_items: public_items,
260-
orphan_methods: Vec::new(),
261252
}
262253
});
263254
cache.stack.push(krate.name.clone());
264255
krate = cache.fold_crate(krate);
265-
{
266-
// Attach all orphan methods to the type's definition if the type
267-
// has since been learned.
268-
let Cache { search_index: ref mut index,
269-
orphan_methods: ref meths, paths: ref paths, ..} = cache;
270-
for &(ref pid, ref item) in meths.iter() {
271-
match paths.find(pid) {
272-
Some(&(ref fqp, _)) => {
273-
index.push(IndexItem {
274-
ty: shortty(item),
275-
name: item.name.clone().unwrap(),
276-
path: fqp.slice_to(fqp.len() - 1).connect("::"),
277-
desc: shorter(item.doc_value()).to_owned(),
278-
parent: Some(*pid),
279-
});
280-
},
281-
None => {}
282-
}
283-
};
284-
}
285256

286257
// Add all the static files
287258
let mut dst = cx.dst.join(krate.name.as_slice());
@@ -556,33 +527,26 @@ impl DocFolder for Cache {
556527
clean::TyMethodItem(..) |
557528
clean::StructFieldItem(..) |
558529
clean::VariantItem(..) => {
559-
(Some(*self.parent_stack.last().unwrap()),
560-
Some(self.stack.slice_to(self.stack.len() - 1)))
530+
Some((Some(*self.parent_stack.last().unwrap()),
531+
self.stack.slice_to(self.stack.len() - 1)))
561532

562533
}
563534
clean::MethodItem(..) => {
564535
if self.parent_stack.len() == 0 {
565-
(None, None)
536+
None
566537
} else {
567538
let last = self.parent_stack.last().unwrap();
568-
let path = match self.paths.find(last) {
569-
Some(&(_, "trait")) =>
570-
Some(self.stack.slice_to(self.stack.len() - 1)),
571-
// The current stack not necessarily has correlation for
572-
// where the type was defined. On the other hand,
573-
// `paths` always has the right information if present.
574-
Some(&(ref fqp, "struct")) | Some(&(ref fqp, "enum")) =>
575-
Some(fqp.slice_to(fqp.len() - 1)),
576-
Some(..) => Some(self.stack.as_slice()),
577-
None => None
539+
let amt = match self.paths.find(last) {
540+
Some(&(_, "trait")) => self.stack.len() - 1,
541+
Some(..) | None => self.stack.len(),
578542
};
579-
(Some(*last), path)
543+
Some((Some(*last), self.stack.slice_to(amt)))
580544
}
581545
}
582-
_ => (None, Some(self.stack.as_slice()))
546+
_ => Some((None, self.stack.as_slice()))
583547
};
584548
match parent {
585-
(parent, Some(path)) if !self.privmod => {
549+
Some((parent, path)) if !self.privmod => {
586550
self.search_index.push(IndexItem {
587551
ty: shortty(&item),
588552
name: s.to_owned(),
@@ -591,12 +555,7 @@ impl DocFolder for Cache {
591555
parent: parent,
592556
});
593557
}
594-
(Some(parent), None) if !self.privmod => {
595-
// We have a parent, but we don't know where they're
596-
// defined yet. Wait for later to index this item.
597-
self.orphan_methods.push((parent, item.clone()))
598-
}
599-
_ => {}
558+
Some(..) | None => {}
600559
}
601560
}
602561
None => {}
@@ -1001,8 +960,8 @@ fn item_module(w: &mut Writer, cx: &Context,
1001960
match (&i1.inner, &i2.inner) {
1002961
(&clean::ViewItemItem(ref a), &clean::ViewItemItem(ref b)) => {
1003962
match (&a.inner, &b.inner) {
1004-
(&clean::ExternCrate(..), _) => Less,
1005-
(_, &clean::ExternCrate(..)) => Greater,
963+
(&clean::ExternMod(..), _) => Less,
964+
(_, &clean::ExternMod(..)) => Greater,
1006965
_ => idx1.cmp(&idx2),
1007966
}
1008967
}
@@ -1097,7 +1056,7 @@ fn item_module(w: &mut Writer, cx: &Context,
10971056

10981057
clean::ViewItemItem(ref item) => {
10991058
match item.inner {
1100-
clean::ExternCrate(ref name, ref src, _) => {
1059+
clean::ExternMod(ref name, ref src, _) => {
11011060
try!(write!(w, "<tr><td><code>extern crate {}",
11021061
name.as_slice()));
11031062
match *src {

branches/try2/src/librustdoc/visit_ast.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ impl<'a> RustdocVisitor<'a> {
147147
}
148148
}
149149
}
150-
ast::ViewItemExternCrate(..) => item.clone()
150+
ast::ViewItemExternMod(..) => item.clone()
151151
};
152152
om.view_items.push(item);
153153
}

branches/try2/src/libstd/macros.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -366,14 +366,12 @@ macro_rules! try(
366366
($e:expr) => (match $e { Ok(e) => e, Err(e) => return Err(e) })
367367
)
368368

369-
/// Create a `std::vec_ng::Vec` containing the arguments.
370369
#[macro_export]
371370
macro_rules! vec(
372371
($($e:expr),*) => ({
373-
// leading _ to allow empty construction without a warning.
374-
let mut _temp = ::std::vec_ng::Vec::new();
375-
$(_temp.push($e);)*
376-
_temp
372+
let mut temp = ::std::vec_ng::Vec::new();
373+
$(temp.push($e);)*
374+
temp
377375
})
378376
)
379377

branches/try2/src/libsyntax/ast.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1019,7 +1019,7 @@ pub enum ViewItem_ {
10191019
// optional (InternedString,StrStyle): if present, this is a location
10201020
// (containing arbitrary characters) from which to fetch the crate sources
10211021
// For example, extern crate whatever = "github.com/mozilla/rust"
1022-
ViewItemExternCrate(Ident, Option<(InternedString,StrStyle)>, NodeId),
1022+
ViewItemExternMod(Ident, Option<(InternedString,StrStyle)>, NodeId),
10231023
ViewItemUse(Vec<@ViewPath> ),
10241024
}
10251025

branches/try2/src/libsyntax/ast_util.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ impl<'a, O: IdVisitingOperation> Visitor<()> for IdVisitor<'a, O> {
375375

376376
fn visit_view_item(&mut self, view_item: &ViewItem, env: ()) {
377377
match view_item.node {
378-
ViewItemExternCrate(_, _, node_id) => {
378+
ViewItemExternMod(_, _, node_id) => {
379379
self.operation.visit_id(node_id)
380380
}
381381
ViewItemUse(ref view_paths) => {

branches/try2/src/libsyntax/ext/expand.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ pub fn expand_view_item(vi: &ast::ViewItem,
424424
fld: &mut MacroExpander)
425425
-> ast::ViewItem {
426426
match vi.node {
427-
ast::ViewItemExternCrate(..) => {
427+
ast::ViewItemExternMod(..) => {
428428
let should_load = vi.attrs.iter().any(|attr| {
429429
attr.name().get() == "phase" &&
430430
attr.meta_item_list().map_or(false, |phases| {
@@ -446,7 +446,7 @@ fn load_extern_macros(krate: &ast::ViewItem, fld: &mut MacroExpander) {
446446
let MacroCrate { lib, cnum } = fld.cx.ecfg.loader.load_crate(krate);
447447

448448
let crate_name = match krate.node {
449-
ast::ViewItemExternCrate(name, _, _) => name,
449+
ast::ViewItemExternMod(name, _, _) => name,
450450
_ => unreachable!()
451451
};
452452
let name = format!("<{} macros>", token::get_ident(crate_name));

branches/try2/src/libsyntax/fold.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -514,8 +514,8 @@ fn fold_variant_arg_<T: Folder>(va: &VariantArg, folder: &mut T) -> VariantArg {
514514
pub fn noop_fold_view_item<T: Folder>(vi: &ViewItem, folder: &mut T)
515515
-> ViewItem{
516516
let inner_view_item = match vi.node {
517-
ViewItemExternCrate(ref ident, ref string, node_id) => {
518-
ViewItemExternCrate(ident.clone(),
517+
ViewItemExternMod(ref ident, ref string, node_id) => {
518+
ViewItemExternMod(ident.clone(),
519519
(*string).clone(),
520520
folder.new_id(node_id))
521521
}

branches/try2/src/libsyntax/parse/parser.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ use ast::{TyInfer, TypeMethod};
5555
use ast::{TyNil, TyParam, TyParamBound, TyPath, TyPtr, TyRptr};
5656
use ast::{TyTup, TyU32, TyUniq, TyVec, UnUniq};
5757
use ast::{UnnamedField, UnsafeBlock, UnsafeFn, ViewItem};
58-
use ast::{ViewItem_, ViewItemExternCrate, ViewItemUse};
58+
use ast::{ViewItem_, ViewItemExternMod, ViewItemUse};
5959
use ast::{ViewPath, ViewPathGlob, ViewPathList, ViewPathSimple};
6060
use ast::Visibility;
6161
use ast;
@@ -4361,7 +4361,7 @@ impl Parser {
43614361
};
43624362

43634363
IoviViewItem(ast::ViewItem {
4364-
node: ViewItemExternCrate(ident, maybe_path, ast::DUMMY_NODE_ID),
4364+
node: ViewItemExternMod(ident, maybe_path, ast::DUMMY_NODE_ID),
43654365
attrs: attrs,
43664366
vis: visibility,
43674367
span: mk_sp(lo, self.last_span.hi)
@@ -5017,11 +5017,11 @@ impl Parser {
50175017
// `extern crate` must precede `use`.
50185018
extern_mod_allowed = false;
50195019
}
5020-
ViewItemExternCrate(..) if !extern_mod_allowed => {
5020+
ViewItemExternMod(..) if !extern_mod_allowed => {
50215021
self.span_err(view_item.span,
50225022
"\"extern crate\" declarations are not allowed here");
50235023
}
5024-
ViewItemExternCrate(..) => {}
5024+
ViewItemExternMod(..) => {}
50255025
}
50265026
view_items.push(view_item);
50275027
}

branches/try2/src/libsyntax/print/pprust.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2065,7 +2065,7 @@ pub fn print_view_item(s: &mut State, item: &ast::ViewItem) -> io::IoResult<()>
20652065
try!(print_outer_attributes(s, item.attrs.as_slice()));
20662066
try!(print_visibility(s, item.vis));
20672067
match item.node {
2068-
ast::ViewItemExternCrate(id, ref optional_path, _) => {
2068+
ast::ViewItemExternMod(id, ref optional_path, _) => {
20692069
try!(head(s, "extern crate"));
20702070
try!(print_ident(s, id));
20712071
for &(ref p, style) in optional_path.iter() {

branches/try2/src/libsyntax/visit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ pub fn walk_mod<E: Clone, V: Visitor<E>>(visitor: &mut V, module: &Mod, env: E)
148148

149149
pub fn walk_view_item<E: Clone, V: Visitor<E>>(visitor: &mut V, vi: &ViewItem, env: E) {
150150
match vi.node {
151-
ViewItemExternCrate(name, _, _) => {
151+
ViewItemExternMod(name, _, _) => {
152152
visitor.visit_ident(vi.span, name, env)
153153
}
154154
ViewItemUse(ref paths) => {

0 commit comments

Comments
 (0)