Skip to content

Commit b0650de

Browse files
committed
---
yaml --- r: 187836 b: refs/heads/tmp c: dd077d5 h: refs/heads/master v: v3
1 parent 8121e1a commit b0650de

File tree

6 files changed

+60
-1
lines changed

6 files changed

+60
-1
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,5 @@ refs/heads/building: 126db549b038c84269a1e4fe46f051b2c15d6970
3434
refs/heads/beta: 522d09dfecbeca1595f25ac58c6d0178bbd21d7d
3535
refs/heads/windistfix: 7608dbad651f02e837ed05eef3d74a6662a6e928
3636
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
37-
refs/heads/tmp: c2400bb2690fe0ee1184d5d7a66b6d2d1198b480
37+
refs/heads/tmp: dd077d5decbc3e462a9fe2feb1a0af0486897acb
3838
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f

branches/tmp/src/etc/htmldocck.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,9 @@
9696
highlights for example. If you want to simply check the presence of
9797
given node or attribute, use an empty string (`""`) as a `PATTERN`.
9898
99+
* `@count PATH XPATH COUNT' checks for the occurrence of given XPath
100+
in the given file. The number of occurrences must match the given count.
101+
99102
All conditions can be negated with `!`. `@!has foo/type.NoSuch.html`
100103
checks if the given file does not exist, for example.
101104
@@ -333,6 +336,11 @@ def check_tree_text(tree, path, pat, regexp):
333336
return ret
334337

335338

339+
def check_tree_count(tree, path, count):
340+
path = normalize_xpath(path)
341+
return len(tree.findall(path)) == count
342+
343+
336344
def check(target, commands):
337345
cache = CachedFiles(target)
338346
for c in commands:
@@ -360,6 +368,13 @@ def check(target, commands):
360368
raise RuntimeError('Invalid number of @{} arguments \
361369
at line {}'.format(c.cmd, c.lineno))
362370

371+
elif c.cmd == 'count': # count test
372+
if len(c.args) == 3: # @count <path> <pat> <count> = count test
373+
ret = check_tree_count(cache.get_tree(c.args[0]), c.args[1], int(c.args[2]))
374+
else:
375+
raise RuntimeError('Invalid number of @{} arguments \
376+
at line {}'.format(c.cmd, c.lineno))
377+
363378
elif c.cmd == 'valid-html':
364379
raise RuntimeError('Unimplemented @valid-html at line {}'.format(c.lineno))
365380

branches/tmp/src/librustdoc/clean/inline.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,9 @@ fn build_impl(cx: &DocContext, tcx: &ty::ctxt,
308308
if method.vis != ast::Public && associated_trait.is_none() {
309309
return None
310310
}
311+
if method.provided_source.is_some() {
312+
return None
313+
}
311314
let mut item = method.clean(cx);
312315
item.inner = match item.inner.clone() {
313316
clean::TyMethodItem(clean::TyMethod {
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
-include ../tools.mk
2+
3+
all: lib.rs ext.rs
4+
$(HOST_RPATH_ENV) $(RUSTC) ext.rs
5+
$(HOST_RPATH_ENV) $(RUSTDOC) -L $(TMPDIR) -w html -o $(TMPDIR)/doc lib.rs
6+
$(HTMLDOCCK) $(TMPDIR)/doc lib.rs
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Copyright 2015 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+
#![crate_type="lib"]
12+
13+
pub trait Trait {
14+
fn provided(&self) {}
15+
}
16+
17+
pub struct Struct;
18+
19+
impl Trait for Struct {
20+
fn provided(&self) {}
21+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Copyright 2015 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+
extern crate ext;
12+
13+
// @count lib/struct.Struct.html '//*[@id="method.provided"]' 1
14+
pub use ext::Struct;

0 commit comments

Comments
 (0)