Skip to content

Commit 81820b4

Browse files
committed
---
yaml --- r: 95157 b: refs/heads/dist-snap c: 249b356 h: refs/heads/master i: 95155: 78e259b v: v3
1 parent b55b11d commit 81820b4

File tree

19 files changed

+175
-383
lines changed

19 files changed

+175
-383
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: c274a6888410ce3e357e014568b43310ed787d36
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/dist-snap: 6d598989f62c15b6093cdaf116f2f6318ed1b95c
9+
refs/heads/dist-snap: 249b356fb3dba0998dbaef34980c9dd1c1e42f48
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1212
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/src/libextra/extra.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ Rust extras are part of the standard Rust distribution.
2626
url = "https://github.com/mozilla/rust/tree/master/src/libextra")];
2727

2828
#[doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk.png",
29-
html_favicon_url = "http://www.rust-lang.org/favicon.ico",
30-
html_root_url = "http://static.rust-lang.org/doc/master")];
29+
html_favicon_url = "http://www.rust-lang.org/favicon.ico")];
3130

3231
#[comment = "Rust extras"];
3332
#[license = "MIT/ASL2"];

branches/dist-snap/src/librustc/middle/trans/common.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ pub fn type_is_immediate(ccx: &mut CrateContext, ty: ty::t) -> bool {
7575
}
7676
match ty::get(ty).sty {
7777
// FIXME: #9651: small `ty_struct` should also be immediate
78+
ty::ty_struct(def_id, ref substs) => {
79+
ty::struct_fields(tcx, def_id, substs).is_empty()
80+
}
7881
ty::ty_enum(*) | ty::ty_tup(*) => {
7982
let llty = sizing_type_of(ccx, ty);
8083
llsize_of_alloc(ccx, llty) <= llsize_of_alloc(ccx, ccx.int_type)

branches/dist-snap/src/librustdoc/clean.rs

Lines changed: 32 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,11 @@ use its = syntax::parse::token::ident_to_str;
1515

1616
use syntax;
1717
use syntax::ast;
18-
use syntax::ast_map;
1918
use syntax::ast_util;
2019
use syntax::attr;
2120
use syntax::attr::AttributeMethods;
2221

23-
use rustc::metadata::cstore;
24-
use rustc::metadata::csearch;
25-
use rustc::metadata::decoder;
26-
2722
use std;
28-
use std::hashmap::HashMap;
29-
3023
use doctree;
3124
use visit_ast;
3225
use std::local_data;
@@ -68,44 +61,19 @@ impl<T: Clean<U>, U> Clean<~[U]> for syntax::opt_vec::OptVec<T> {
6861
pub struct Crate {
6962
name: ~str,
7063
module: Option<Item>,
71-
externs: HashMap<ast::CrateNum, ExternalCrate>,
7264
}
7365

7466
impl Clean<Crate> for visit_ast::RustdocVisitor {
7567
fn clean(&self) -> Crate {
7668
use syntax::attr::{find_linkage_metas, last_meta_item_value_str_by_name};
77-
let maybe_meta = last_meta_item_value_str_by_name(
78-
find_linkage_metas(self.attrs), "name");
79-
let cx = local_data::get(super::ctxtkey, |x| *x.unwrap());
80-
81-
let mut externs = HashMap::new();
82-
do cstore::iter_crate_data(cx.sess.cstore) |n, meta| {
83-
externs.insert(n, meta.clean());
84-
}
69+
let maybe_meta = last_meta_item_value_str_by_name(find_linkage_metas(self.attrs), "name");
8570

8671
Crate {
8772
name: match maybe_meta {
8873
Some(x) => x.to_owned(),
89-
None => fail2!("rustdoc requires a \\#[link(name=\"foo\")] \
90-
crate attribute"),
74+
None => fail2!("rustdoc_ng requires a \\#[link(name=\"foo\")] crate attribute"),
9175
},
9276
module: Some(self.module.clean()),
93-
externs: externs,
94-
}
95-
}
96-
}
97-
98-
#[deriving(Clone, Encodable, Decodable)]
99-
pub struct ExternalCrate {
100-
name: ~str,
101-
attrs: ~[Attribute],
102-
}
103-
104-
impl Clean<ExternalCrate> for cstore::crate_metadata {
105-
fn clean(&self) -> ExternalCrate {
106-
ExternalCrate {
107-
name: self.name.to_owned(),
108-
attrs: decoder::get_crate_attributes(self.data).clean()
10977
}
11078
}
11179
}
@@ -574,15 +542,7 @@ pub enum Type {
574542
ResolvedPath {
575543
path: Path,
576544
typarams: Option<~[TyParamBound]>,
577-
id: ast::NodeId,
578-
},
579-
/// Same as above, but only external variants
580-
ExternalPath {
581-
path: Path,
582-
typarams: Option<~[TyParamBound]>,
583-
fqn: ~[~str],
584-
kind: TypeKind,
585-
crate: ast::CrateNum,
545+
did: ast::DefId
586546
},
587547
// I have no idea how to usefully use this.
588548
TyParamBinder(ast::NodeId),
@@ -612,14 +572,6 @@ pub enum Type {
612572
// region, raw, other boxes, mutable
613573
}
614574

615-
#[deriving(Clone, Encodable, Decodable)]
616-
pub enum TypeKind {
617-
TypeStruct,
618-
TypeEnum,
619-
TypeTrait,
620-
TypeFunction,
621-
}
622-
623575
impl Clean<Type> for ast::Ty {
624576
fn clean(&self) -> Type {
625577
use syntax::ast::*;
@@ -1147,12 +1099,26 @@ fn name_from_pat(p: &ast::Pat) -> ~str {
11471099
}
11481100
}
11491101

1102+
fn remove_comment_tags(s: &str) -> ~str {
1103+
if s.starts_with("/") {
1104+
match s.slice(0,3) {
1105+
&"///" => return s.slice(3, s.len()).trim().to_owned(),
1106+
&"/**" | &"/*!" => return s.slice(3, s.len() - 2).trim().to_owned(),
1107+
_ => return s.trim().to_owned()
1108+
}
1109+
} else {
1110+
return s.to_owned();
1111+
}
1112+
}
1113+
11501114
/// Given a Type, resolve it using the def_map
11511115
fn resolve_type(path: Path, tpbs: Option<~[TyParamBound]>,
11521116
id: ast::NodeId) -> Type {
1153-
let cx = local_data::get(super::ctxtkey, |x| *x.unwrap());
1117+
use syntax::ast::*;
1118+
1119+
let dm = local_data::get(super::ctxtkey, |x| *x.unwrap()).tycx.def_map;
11541120
debug2!("searching for {:?} in defmap", id);
1155-
let d = match cx.tycx.def_map.find(&id) {
1121+
let d = match dm.find(&id) {
11561122
Some(k) => k,
11571123
None => {
11581124
let ctxt = local_data::get(super::ctxtkey, |x| *x.unwrap());
@@ -1162,41 +1128,28 @@ fn resolve_type(path: Path, tpbs: Option<~[TyParamBound]>,
11621128
}
11631129
};
11641130

1165-
let (def_id, kind) = match *d {
1166-
ast::DefFn(i, _) => (i, TypeFunction),
1167-
ast::DefSelf(i) | ast::DefSelfTy(i) => return Self(i),
1168-
ast::DefTy(i) => (i, TypeEnum),
1169-
ast::DefTrait(i) => {
1131+
let def_id = match *d {
1132+
DefFn(i, _) => i,
1133+
DefSelf(i) | DefSelfTy(i) => return Self(i),
1134+
DefTy(i) => i,
1135+
DefTrait(i) => {
11701136
debug2!("saw DefTrait in def_to_id");
1171-
(i, TypeTrait)
1137+
i
11721138
},
1173-
ast::DefPrimTy(p) => match p {
1174-
ast::ty_str => return String,
1175-
ast::ty_bool => return Bool,
1139+
DefPrimTy(p) => match p {
1140+
ty_str => return String,
1141+
ty_bool => return Bool,
11761142
_ => return Primitive(p)
11771143
},
1178-
ast::DefTyParam(i, _) => return Generic(i.node),
1179-
ast::DefStruct(i) => (i, TypeStruct),
1180-
ast::DefTyParamBinder(i) => {
1144+
DefTyParam(i, _) => return Generic(i.node),
1145+
DefStruct(i) => i,
1146+
DefTyParamBinder(i) => {
11811147
debug2!("found a typaram_binder, what is it? {}", i);
11821148
return TyParamBinder(i);
11831149
},
11841150
x => fail2!("resolved type maps to a weird def {:?}", x),
11851151
};
1186-
if ast_util::is_local(def_id) {
1187-
ResolvedPath{ path: path, typarams: tpbs, id: def_id.node }
1188-
} else {
1189-
let fqn = csearch::get_item_path(cx.tycx, def_id);
1190-
let fqn = fqn.move_iter().map(|i| {
1191-
match i {
1192-
ast_map::path_mod(id) |
1193-
ast_map::path_name(id) |
1194-
ast_map::path_pretty_name(id, _) => id.clean()
1195-
}
1196-
}).to_owned_vec();
1197-
ExternalPath{ path: path, typarams: tpbs, fqn: fqn, kind: kind,
1198-
crate: def_id.crate }
1199-
}
1152+
ResolvedPath{ path: path, typarams: tpbs, did: def_id }
12001153
}
12011154

12021155
fn resolve_use_source(path: Path, id: ast::NodeId) -> ImportSource {

0 commit comments

Comments
 (0)