Skip to content

Commit d4a95d5

Browse files
committed
---
yaml --- r: 83546 b: refs/heads/try c: 92e7bb6 h: refs/heads/master v: v3
1 parent 1ad2b26 commit d4a95d5

File tree

16 files changed

+321
-170
lines changed

16 files changed

+321
-170
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: 0e4d1fc8cae42e15e00f71d9f439b01bb25a86ae
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 6c08cc2db4f98e9f07ae7d50338396c4123c2f0a
5-
refs/heads/try: 5d24a1ae45189b8222ce84084eaae3ff8b7d67d0
5+
refs/heads/try: 92e7bb67a8038ff73ad9dc88d8be3d3df4777282
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/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/try/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/try/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/try/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/try/src/etc/emacs/rust-mode-tests.el

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -196,35 +196,6 @@ This is some more text. Fee fie fo fum. Humpty dumpty sat on a wall.
196196
*very very very long string
197197
*/"))
198198

199-
(ert-deftest fill-paragraph-single-line-style-with-code-before ()
200-
(test-fill-paragraph
201-
"fn foo() { }
202-
/// This is my comment. This is more of my comment. This is even more."
203-
"fn foo() { }
204-
/// This is my comment. This is
205-
/// more of my comment. This is
206-
/// even more." 14))
207-
208-
(ert-deftest fill-paragraph-single-line-style-with-code-after ()
209-
(test-fill-paragraph
210-
"/// This is my comment. This is more of my comment. This is even more.
211-
fn foo() { }"
212-
"/// This is my comment. This is
213-
/// more of my comment. This is
214-
/// even more.
215-
fn foo() { }" 1 73))
216-
217-
(ert-deftest fill-paragraph-single-line-style-code-before-and-after ()
218-
(test-fill-paragraph
219-
"fn foo() { }
220-
/// This is my comment. This is more of my comment. This is even more.
221-
fn bar() { }"
222-
"fn foo() { }
223-
/// This is my comment. This is
224-
/// more of my comment. This is
225-
/// even more.
226-
fn bar() { }" 14 67))
227-
228199
(defun test-auto-fill (initial position inserted expected)
229200
(rust-test-manip-code
230201
initial

branches/try/src/etc/emacs/rust-mode.el

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,8 +300,7 @@
300300
(let
301301
((fill-paragraph-function
302302
(if (not (eq fill-paragraph-function 'rust-fill-paragraph))
303-
fill-paragraph-function))
304-
(fill-paragraph-handle-comment t))
303+
fill-paragraph-function)))
305304
(apply 'fill-paragraph args)
306305
t))))))
307306

branches/try/src/librustdoc/clean.rs

Lines changed: 30 additions & 42 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],
@@ -539,9 +539,11 @@ impl Clean<TraitMethod> for ast::trait_method {
539539
#[deriving(Clone, Encodable, Decodable)]
540540
pub enum Type {
541541
/// structs/enums/traits (anything that'd be an ast::ty_path)
542-
ResolvedPath { path: Path, typarams: Option<~[TyParamBound]>, id: ast::NodeId },
543-
/// Reference to an item in an external crate (fully qualified path)
544-
External(~str, ~str),
542+
ResolvedPath {
543+
path: Path,
544+
typarams: Option<~[TyParamBound]>,
545+
did: ast::DefId
546+
},
545547
// I have no idea how to usefully use this.
546548
TyParamBinder(ast::NodeId),
547549
/// For parameterized types, so the consumer of the JSON don't go looking
@@ -736,10 +738,28 @@ impl Clean<VariantKind> for ast::variant_kind {
736738
}
737739
}
738740

739-
impl Clean<~str> for syntax::codemap::Span {
740-
fn clean(&self) -> ~str {
741-
let cm = local_data::get(super::ctxtkey, |x| x.unwrap().clone()).sess.codemap;
742-
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+
}
743763
}
744764
}
745765

@@ -1033,7 +1053,7 @@ trait ToSource {
10331053

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

11671155
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/try/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/try/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)