Skip to content

Commit 2740571

Browse files
committed
---
yaml --- r: 125903 b: refs/heads/try c: 431622e h: refs/heads/master i: 125901: 7680d6a 125899: 6b64692 125895: 128a977 125887: 514f303 v: v3
1 parent 35a6bf2 commit 2740571

File tree

3 files changed

+49
-15
lines changed

3 files changed

+49
-15
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: f2fa55903e378368ed9173560f03a0ef16e371c2
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 9fc8394d3bce22ab483f98842434c84c396212ae
5-
refs/heads/try: 15a727bba1b3a93d58c786460de6926c138d9507
5+
refs/heads/try: 431622e1e202467e0ba61cdf2df7ceb501926547
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/src/librustdoc/clean/mod.rs

Lines changed: 45 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -747,7 +747,6 @@ pub enum SelfTy {
747747
SelfStatic,
748748
SelfValue,
749749
SelfBorrowed(Option<Lifetime>, Mutability),
750-
SelfOwned,
751750
SelfExplicit(Type),
752751
}
753752

@@ -971,28 +970,27 @@ impl Clean<Item> for ty::Method {
971970
fn clean(&self) -> Item {
972971
let cx = get_cx();
973972
let (self_, sig) = match self.explicit_self {
974-
ty::StaticExplicitSelfCategory => (ast::SelfStatic.clean(), self.fty.sig.clone()),
973+
ty::StaticExplicitSelfCategory => (ast::SelfStatic.clean(),
974+
self.fty.sig.clone()),
975975
s => {
976976
let sig = ty::FnSig {
977977
inputs: Vec::from_slice(self.fty.sig.inputs.slice_from(1)),
978978
..self.fty.sig.clone()
979979
};
980980
let s = match s {
981+
ty::ByValueExplicitSelfCategory => SelfValue,
981982
ty::ByReferenceExplicitSelfCategory(..) => {
982983
match ty::get(self.fty.sig.inputs[0]).sty {
983984
ty::ty_rptr(r, mt) => {
984985
SelfBorrowed(r.clean(), mt.mutbl.clean())
985986
}
986-
_ => {
987-
// FIXME(pcwalton): This is wrong.
988-
SelfStatic
989-
}
987+
_ => unreachable!(),
990988
}
991989
}
992-
_ => {
993-
// FIXME(pcwalton): This is wrong.
994-
SelfStatic
990+
ty::ByBoxExplicitSelfCategory => {
991+
SelfExplicit(self.fty.sig.inputs[0].clean())
995992
}
993+
ty::StaticExplicitSelfCategory => unreachable!(),
996994
};
997995
(s, sig)
998996
}
@@ -1213,8 +1211,18 @@ impl Clean<Type> for ty::t {
12131211
ty::ty_float(ast::TyF32) => Primitive(F32),
12141212
ty::ty_float(ast::TyF64) => Primitive(F64),
12151213
ty::ty_str => Primitive(Str),
1216-
ty::ty_box(t) => Managed(box t.clean()),
1217-
ty::ty_uniq(t) => Unique(box t.clean()),
1214+
ty::ty_box(t) => {
1215+
let gc_did = get_cx().tcx_opt().and_then(|tcx| {
1216+
tcx.lang_items.gc()
1217+
});
1218+
lang_struct(gc_did, t, "Gc", Managed)
1219+
}
1220+
ty::ty_uniq(t) => {
1221+
let box_did = get_cx().tcx_opt().and_then(|tcx| {
1222+
tcx.lang_items.owned_box()
1223+
});
1224+
lang_struct(box_did, t, "Box", Unique)
1225+
}
12181226
ty::ty_vec(mt, None) => Vector(box mt.ty.clean()),
12191227
ty::ty_vec(mt, Some(i)) => FixedVector(box mt.ty.clean(),
12201228
format!("{}", i)),
@@ -2094,3 +2102,29 @@ impl Clean<Stability> for attr::Stability {
20942102
}
20952103
}
20962104
}
2105+
2106+
fn lang_struct(did: Option<ast::DefId>, t: ty::t, name: &str,
2107+
fallback: fn(Box<Type>) -> Type) -> Type {
2108+
let did = match did {
2109+
Some(did) => did,
2110+
None => return fallback(box t.clean()),
2111+
};
2112+
let fqn = csearch::get_item_path(get_cx().tcx(), did);
2113+
let fqn: Vec<String> = fqn.move_iter().map(|i| {
2114+
i.to_string()
2115+
}).collect();
2116+
get_cx().external_paths.borrow_mut().get_mut_ref()
2117+
.insert(did, (fqn, TypeStruct));
2118+
ResolvedPath {
2119+
typarams: None,
2120+
did: did,
2121+
path: Path {
2122+
global: false,
2123+
segments: vec![PathSegment {
2124+
name: name.to_string(),
2125+
lifetimes: vec![],
2126+
types: vec![t.clean()],
2127+
}],
2128+
},
2129+
}
2130+
}

branches/try/src/librustdoc/html/format.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -444,8 +444,6 @@ impl fmt::Show for clean::Type {
444444
format!("[{}, ..{}]", **t, *s).as_slice())
445445
}
446446
clean::Bottom => f.write("!".as_bytes()),
447-
clean::Unique(ref t) => write!(f, "Box<{}>", **t),
448-
clean::Managed(ref t) => write!(f, "Gc<{}>", **t),
449447
clean::RawPointer(m, ref t) => {
450448
write!(f, "*{}{}", RawMutableSpace(m), **t)
451449
}
@@ -456,6 +454,9 @@ impl fmt::Show for clean::Type {
456454
};
457455
write!(f, "&amp;{}{}{}", lt, MutableSpace(mutability), **ty)
458456
}
457+
clean::Unique(..) | clean::Managed(..) => {
458+
fail!("should have been cleaned")
459+
}
459460
}
460461
}
461462
}
@@ -491,7 +492,6 @@ impl<'a> fmt::Show for Method<'a> {
491492
match *selfty {
492493
clean::SelfStatic => {},
493494
clean::SelfValue => args.push_str("self"),
494-
clean::SelfOwned => args.push_str("self: Box<Self>"),
495495
clean::SelfBorrowed(Some(ref lt), mtbl) => {
496496
args.push_str(format!("&amp;{} {}self", *lt,
497497
MutableSpace(mtbl)).as_slice());

0 commit comments

Comments
 (0)