Skip to content

Commit 2b02d7b

Browse files
committed
---
yaml --- r: 95037 b: refs/heads/dist-snap c: 9883a62 h: refs/heads/master i: 95035: e3edb44 v: v3
1 parent 3020dbf commit 2b02d7b

File tree

18 files changed

+366
-195
lines changed

18 files changed

+366
-195
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: 6c8e6aad7344a62d91d5cf10e0dd1769602a5257
9+
refs/heads/dist-snap: 9883a6250b61eb4bb715684f9b25304f4f0d437e
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1212
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/Makefile.in

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -608,6 +608,10 @@ config.stamp: $(S)configure $(S)Makefile.in $(S)src/snapshots.txt
608608
# Primary-target makefiles
609609
######################################################################
610610

611+
# Issue #9531: If you change the order of any of the following (or add
612+
# new definitions), make sure definitions always precede their uses,
613+
# especially for the dependency lists of recipes.
614+
611615
include $(CFG_SRC_DIR)mk/target.mk
612616
include $(CFG_SRC_DIR)mk/host.mk
613617
include $(CFG_SRC_DIR)mk/stage0.mk

branches/dist-snap/doc/tutorial.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,7 @@ fn area(sh: Shape) -> float {
737737
match sh {
738738
Circle { radius: radius, _ } => float::consts::pi * square(radius),
739739
Rectangle { top_left: top_left, bottom_right: bottom_right } => {
740-
(bottom_right.x - top_left.x) * (bottom_right.y - top_left.y)
740+
(bottom_right.x - top_left.x) * (top_left.y - bottom_right.y)
741741
}
742742
}
743743
}

branches/dist-snap/mk/docs.mk

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -217,10 +217,6 @@ endif
217217
# Rustdoc (libstd/extra)
218218
######################################################################
219219

220-
ifeq ($(CFG_PANDOC),)
221-
$(info cfg: no pandoc found, omitting library doc build)
222-
else
223-
224220
# The rustdoc executable
225221
RUSTDOC = $(HBIN2_H_$(CFG_BUILD_TRIPLE))/rustdoc$(X_$(CFG_BUILD_TRIPLE))
226222

@@ -238,7 +234,6 @@ endef
238234

239235
$(eval $(call libdoc,std,$(STDLIB_CRATE),$(CFG_BUILD_TRIPLE)))
240236
$(eval $(call libdoc,extra,$(EXTRALIB_CRATE),$(CFG_BUILD_TRIPLE)))
241-
endif
242237

243238

244239
ifdef CFG_DISABLE_DOCS

branches/dist-snap/mk/stage0.mk

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ $(HBIN0_H_$(CFG_BUILD_TRIPLE))/:
66
$(HLIB0_H_$(CFG_BUILD_TRIPLE))/:
77
mkdir -p $@
88

9-
SNAPSHOT_RUSTC_POST_CLEANUP=$(HBIN0_H_$(CFG_BUILD_TRIPLE))/rustc$(X_$(CFG_BUILD_TRIPLE))
10-
119
$(SNAPSHOT_RUSTC_POST_CLEANUP): \
1210
$(S)src/snapshots.txt \
1311
$(S)src/etc/get-snapshot.py $(MKFILE_DEPS) \

branches/dist-snap/mk/target.mk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ WFLAGS_ST2 = -D warnings
3636
# had its chance to clean it out; otherwise the other products will be
3737
# inadvertantly included in the clean out.
3838

39+
SNAPSHOT_RUSTC_POST_CLEANUP=$(HBIN0_H_$(CFG_BUILD_TRIPLE))/rustc$(X_$(CFG_BUILD_TRIPLE))
40+
3941
define TARGET_STAGE_N
4042

4143
$$(TLIB$(1)_T_$(2)_H_$(3))/libmorestack.a: \

branches/dist-snap/src/librustc/middle/check_match.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -773,12 +773,12 @@ pub fn specialize(cx: &MatchCheckCtxt,
773773
let num_elements = before.len() + after.len();
774774
if num_elements < arity && slice.is_some() {
775775
Some(vec::append(
776-
vec::concat(&[
776+
[
777777
before,
778778
vec::from_elem(
779779
arity - num_elements, wild()),
780780
after
781-
]),
781+
].concat_vec(),
782782
r.tail()
783783
))
784784
} else if num_elements == arity {

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

Lines changed: 35 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ impl Clean<Crate> for visit_ast::RustdocVisitor {
8484
#[deriving(Clone, Encodable, Decodable)]
8585
pub struct Item {
8686
/// Stringified span
87-
source: ~str,
87+
source: Span,
8888
/// Not everything has a name. E.g., impls
8989
name: Option<~str>,
9090
attrs: ~[Attribute],
@@ -173,12 +173,11 @@ impl Clean<Item> for doctree::Module {
173173
visibility: self.vis.clean(),
174174
id: self.id,
175175
inner: ModuleItem(Module {
176-
items: std::vec::concat(&[self.structs.clean(),
177-
self.enums.clean(), self.fns.clean(),
178-
std::vec::concat(self.foreigns.clean()),
179-
self.mods.clean(), self.typedefs.clean(),
180-
self.statics.clean(), self.traits.clean(),
181-
self.impls.clean(), self.view_items.clean()])
176+
items: [self.structs.clean(), self.enums.clean(),
177+
self.fns.clean(), self.foreigns.clean().concat_vec(),
178+
self.mods.clean(), self.typedefs.clean(),
179+
self.statics.clean(), self.traits.clean(),
180+
self.impls.clean(), self.view_items.clean()].concat_vec()
182181
})
183182
}
184183
}
@@ -540,9 +539,11 @@ impl Clean<TraitMethod> for ast::trait_method {
540539
#[deriving(Clone, Encodable, Decodable)]
541540
pub enum Type {
542541
/// structs/enums/traits (anything that'd be an ast::ty_path)
543-
ResolvedPath { path: Path, typarams: Option<~[TyParamBound]>, id: ast::NodeId },
544-
/// Reference to an item in an external crate (fully qualified path)
545-
External(~str, ~str),
542+
ResolvedPath {
543+
path: Path,
544+
typarams: Option<~[TyParamBound]>,
545+
did: ast::DefId
546+
},
546547
// I have no idea how to usefully use this.
547548
TyParamBinder(ast::NodeId),
548549
/// For parameterized types, so the consumer of the JSON don't go looking
@@ -737,10 +738,28 @@ impl Clean<VariantKind> for ast::variant_kind {
737738
}
738739
}
739740

740-
impl Clean<~str> for syntax::codemap::Span {
741-
fn clean(&self) -> ~str {
742-
let cm = local_data::get(super::ctxtkey, |x| x.unwrap().clone()).sess.codemap;
743-
cm.span_to_str(*self)
741+
#[deriving(Clone, Encodable, Decodable)]
742+
pub struct Span {
743+
filename: ~str,
744+
loline: uint,
745+
locol: uint,
746+
hiline: uint,
747+
hicol: uint,
748+
}
749+
750+
impl Clean<Span> for syntax::codemap::Span {
751+
fn clean(&self) -> Span {
752+
let cm = local_data::get(super::ctxtkey, |x| *x.unwrap()).sess.codemap;
753+
let filename = cm.span_to_filename(*self);
754+
let lo = cm.lookup_char_pos(self.lo);
755+
let hi = cm.lookup_char_pos(self.hi);
756+
Span {
757+
filename: filename.to_owned(),
758+
loline: lo.line,
759+
locol: *lo.col,
760+
hiline: hi.line,
761+
hicol: *hi.col,
762+
}
744763
}
745764
}
746765

@@ -1034,7 +1053,7 @@ trait ToSource {
10341053

10351054
impl ToSource for syntax::codemap::Span {
10361055
fn to_src(&self) -> ~str {
1037-
debug!("converting span %s to snippet", self.clean());
1056+
debug!("converting span %? to snippet", self.clean());
10381057
let cm = local_data::get(super::ctxtkey, |x| x.unwrap().clone()).sess.codemap.clone();
10391058
let sn = match cm.span_to_snippet(*self) {
10401059
Some(x) => x,
@@ -1130,39 +1149,7 @@ fn resolve_type(path: Path, tpbs: Option<~[TyParamBound]>,
11301149
},
11311150
x => fail!("resolved type maps to a weird def %?", x),
11321151
};
1133-
1134-
if def_id.crate != ast::CRATE_NODE_ID {
1135-
use rustc::metadata::decoder::*;
1136-
1137-
let sess = local_data::get(super::ctxtkey, |x| *x.unwrap()).sess;
1138-
let cratedata = ::rustc::metadata::cstore::get_crate_data(sess.cstore, def_id.crate);
1139-
let doc = lookup_item(def_id.node, cratedata.data);
1140-
let path = syntax::ast_map::path_to_str_with_sep(item_path(doc), "::", sess.intr());
1141-
let ty = match def_like_to_def(item_to_def_like(doc, def_id, def_id.crate)) {
1142-
DefFn(*) => ~"fn",
1143-
DefTy(*) => ~"enum",
1144-
DefTrait(*) => ~"trait",
1145-
DefPrimTy(p) => match p {
1146-
ty_str => ~"str",
1147-
ty_bool => ~"bool",
1148-
ty_int(t) => match t.to_str() {
1149-
~"" => ~"i",
1150-
s => s
1151-
},
1152-
ty_uint(t) => t.to_str(),
1153-
ty_float(t) => t.to_str(),
1154-
ty_char => ~"char",
1155-
},
1156-
DefTyParam(*) => ~"generic",
1157-
DefStruct(*) => ~"struct",
1158-
DefTyParamBinder(*) => ~"typaram_binder",
1159-
x => fail!("resolved external maps to a weird def %?", x),
1160-
};
1161-
let cname = cratedata.name.to_owned();
1162-
External(cname + "::" + path, ty)
1163-
} else {
1164-
ResolvedPath {path: path.clone(), typarams: tpbs, id: def_id.node}
1165-
}
1152+
ResolvedPath{ path: path, typarams: tpbs, did: def_id }
11661153
}
11671154

11681155
fn resolve_use_source(path: Path, id: ast::NodeId) -> ImportSource {
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
use std::fmt;
12+
13+
pub struct Escape<'self>(&'self str);
14+
15+
impl<'self> fmt::Default for Escape<'self> {
16+
fn fmt(s: &Escape<'self>, fmt: &mut fmt::Formatter) {
17+
// Because the internet is always right, turns out there's not that many
18+
// characters to escape: http://stackoverflow.com/questions/7381974
19+
let pile_o_bits = s.as_slice();
20+
let mut last = 0;
21+
for (i, ch) in s.byte_iter().enumerate() {
22+
match ch as char {
23+
'<' | '>' | '&' | '\'' | '"' => {
24+
fmt.buf.write(pile_o_bits.slice(last, i).as_bytes());
25+
let s = match ch as char {
26+
'>' => "&gt;",
27+
'<' => "&lt;",
28+
'&' => "&amp;",
29+
'\'' => "&#39;",
30+
'"' => "&quot;",
31+
_ => unreachable!()
32+
};
33+
fmt.buf.write(s.as_bytes());
34+
last = i + 1;
35+
}
36+
_ => {}
37+
}
38+
}
39+
40+
if last < s.len() {
41+
fmt.buf.write(pile_o_bits.slice_from(last).as_bytes());
42+
}
43+
}
44+
}

branches/dist-snap/src/librustdoc/html/format.rs

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ impl fmt::Default for clean::Path {
9797
}
9898
}
9999

100-
fn resolved_path(w: &mut io::Writer, id: ast::NodeId,
100+
fn resolved_path(w: &mut io::Writer, did: ast::DefId,
101101
path: &clean::Path, print_all: bool) {
102102
// The generics will get written to both the title and link
103103
let mut generics = ~"";
@@ -144,9 +144,10 @@ fn resolved_path(w: &mut io::Writer, id: ast::NodeId,
144144

145145
do local_data::get(cache_key) |cache| {
146146
do cache.unwrap().read |cache| {
147-
match cache.paths.find(&id) {
147+
match cache.paths.find(&did.node) {
148148
// This is a documented path, link to it!
149-
Some(&(ref fqp, shortty)) => {
149+
// FIXME(#9539): this is_local check should not exist
150+
Some(&(ref fqp, shortty)) if ast_util::is_local(did) => {
150151
let fqn = fqp.connect("::");
151152
let same = loc.iter().zip(fqp.iter())
152153
.take_while(|&(a, b)| *a == *b).len();
@@ -180,7 +181,7 @@ fn resolved_path(w: &mut io::Writer, id: ast::NodeId,
180181
write!(w, "<a class='{}' href='{}' title='{}'>{}</a>{}",
181182
shortty, url, fqn, last.name, generics);
182183
}
183-
None => {
184+
_ => {
184185
if print_all {
185186
let amt = path.segments.len() - 1;
186187
for seg in path.segments.iter().take(amt) {
@@ -205,8 +206,8 @@ impl fmt::Default for clean::Type {
205206
}
206207
}
207208
}
208-
clean::ResolvedPath{id, typarams: ref typarams, path: ref path} => {
209-
resolved_path(f.buf, id, path, false);
209+
clean::ResolvedPath{did, typarams: ref typarams, path: ref path} => {
210+
resolved_path(f.buf, did, path, false);
210211
match *typarams {
211212
Some(ref params) => {
212213
f.buf.write("&lt;".as_bytes());
@@ -219,10 +220,6 @@ impl fmt::Default for clean::Type {
219220
None => {}
220221
}
221222
}
222-
// XXX: this should be a link
223-
clean::External(ref a, _) => {
224-
write!(f.buf, "{}", *a);
225-
}
226223
clean::Self(*) => f.buf.write("Self".as_bytes()),
227224
clean::Primitive(prim) => {
228225
let s = match prim {
@@ -421,8 +418,8 @@ impl fmt::Default for clean::ViewPath {
421418
impl fmt::Default for clean::ImportSource {
422419
fn fmt(v: &clean::ImportSource, f: &mut fmt::Formatter) {
423420
match v.did {
424-
Some(did) if ast_util::is_local(did) => {
425-
resolved_path(f.buf, did.node, &v.path, true);
421+
Some(did) => {
422+
resolved_path(f.buf, did, &v.path, true);
426423
}
427424
_ => {
428425
for (i, seg) in v.path.segments.iter().enumerate() {
@@ -437,7 +434,7 @@ impl fmt::Default for clean::ImportSource {
437434
impl fmt::Default for clean::ViewListIdent {
438435
fn fmt(v: &clean::ViewListIdent, f: &mut fmt::Formatter) {
439436
match v.source {
440-
Some(did) if ast_util::is_local(did) => {
437+
Some(did) => {
441438
let path = clean::Path {
442439
global: false,
443440
segments: ~[clean::PathSegment {
@@ -446,7 +443,7 @@ impl fmt::Default for clean::ViewListIdent {
446443
types: ~[],
447444
}]
448445
};
449-
resolved_path(f.buf, did.node, &path, false);
446+
resolved_path(f.buf, did, &path, false);
450447
}
451448
_ => write!(f.buf, "{}", v.name),
452449
}

branches/dist-snap/src/librustdoc/html/layout.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ pub fn render<T: fmt::Default, S: fmt::Default>(
6666
</form>
6767
</nav>
6868
69-
<section class=\"content {ty}\">{content}</section>
69+
<section id='main' class=\"content {ty}\">{content}</section>
70+
<section id='search' class=\"content hidden\"></section>
7071
7172
<section class=\"footer\"></section>
7273

0 commit comments

Comments
 (0)