Skip to content

Commit ba24a03

Browse files
committed
libsyntax: deny warnings in doctests
1 parent 569f29c commit ba24a03

File tree

7 files changed

+25
-18
lines changed

7 files changed

+25
-18
lines changed

mk/tests.mk

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ TEST_TARGET_CRATES = $(filter-out core rustc_unicode alloc_system \
2626
alloc_jemalloc,$(TARGET_CRATES)) \
2727
collectionstest coretest
2828
TEST_DOC_CRATES = $(DOC_CRATES) arena flate fmt_macros getopts graphviz \
29-
log rand rbml serialize
29+
log rand rbml serialize syntax
3030
TEST_HOST_CRATES = $(filter-out rustc_typeck rustc_borrowck rustc_resolve \
3131
rustc_trans rustc_lint,\
3232
$(HOST_CRATES))

src/libsyntax/ast.rs

+8-6
Original file line numberDiff line numberDiff line change
@@ -909,13 +909,15 @@ pub enum Expr_ {
909909
/// separately. `position` represents the index of the associated
910910
/// item qualified with this Self type.
911911
///
912-
/// <Vec<T> as a::b::Trait>::AssociatedItem
913-
/// ^~~~~ ~~~~~~~~~~~~~~^
914-
/// ty position = 3
912+
/// ```ignore
913+
/// <Vec<T> as a::b::Trait>::AssociatedItem
914+
/// ^~~~~ ~~~~~~~~~~~~~~^
915+
/// ty position = 3
915916
///
916-
/// <Vec<T>>::AssociatedItem
917-
/// ^~~~~ ^
918-
/// ty position = 0
917+
/// <Vec<T>>::AssociatedItem
918+
/// ^~~~~ ^
919+
/// ty position = 0
920+
/// ```
919921
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
920922
pub struct QSelf {
921923
pub ty: P<Ty>,

src/libsyntax/ext/deriving/generic/mod.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
//! following snippet
5555
//!
5656
//! ```rust
57+
//! # #![allow(dead_code)]
5758
//! struct A { x : i32 }
5859
//!
5960
//! struct B(i32);
@@ -88,7 +89,7 @@
8889
//!
8990
//! ```rust
9091
//! trait PartialEq {
91-
//! fn eq(&self, other: &Self);
92+
//! fn eq(&self, other: &Self) -> bool;
9293
//! }
9394
//! impl PartialEq for i32 {
9495
//! fn eq(&self, other: &i32) -> bool {
@@ -905,7 +906,7 @@ impl<'a> MethodDef<'a> {
905906
})
906907
}
907908

908-
/// ```
909+
/// ```ignore
909910
/// #[derive(PartialEq)]
910911
/// struct A { x: i32, y: i32 }
911912
///
@@ -1010,7 +1011,7 @@ impl<'a> MethodDef<'a> {
10101011
&StaticStruct(struct_def, summary))
10111012
}
10121013

1013-
/// ```
1014+
/// ```ignore
10141015
/// #[derive(PartialEq)]
10151016
/// enum A {
10161017
/// A1,
@@ -1596,7 +1597,7 @@ pub fn cs_fold<F>(use_foldl: bool,
15961597
/// Call the method that is being derived on all the fields, and then
15971598
/// process the collected results. i.e.
15981599
///
1599-
/// ```
1600+
/// ```ignore
16001601
/// f(cx, span, vec![self_1.method(__arg_1_1, __arg_2_1),
16011602
/// self_2.method(__arg_1_2, __arg_2_2)])
16021603
/// ```

src/libsyntax/ext/format.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,10 @@ struct Context<'a, 'b:'a> {
7777
/// expressions.
7878
///
7979
/// If parsing succeeds, the return value is:
80-
///
81-
/// Some((fmtstr, unnamed arguments, ordering of named arguments,
82-
/// named arguments))
80+
/// ```ignore
81+
/// Some((fmtstr, unnamed arguments, ordering of named arguments,
82+
/// named arguments))
83+
/// ```
8384
fn parse_args(ecx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
8485
-> Option<(P<ast::Expr>, Vec<P<ast::Expr>>, Vec<String>,
8586
HashMap<String, P<ast::Expr>>)> {

src/libsyntax/lib.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
#![crate_type = "rlib"]
2424
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
2525
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
26-
html_root_url = "https://doc.rust-lang.org/nightly/")]
26+
html_root_url = "https://doc.rust-lang.org/nightly/",
27+
test(attr(deny(warnings))))]
2728

2829
#![feature(associated_consts)]
2930
#![feature(drain)]

src/libsyntax/parse/parser.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3959,7 +3959,7 @@ impl<'a> Parser<'a> {
39593959

39603960
/// Parses an optional `where` clause and places it in `generics`.
39613961
///
3962-
/// ```
3962+
/// ```ignore
39633963
/// where T : Trait<U, V> + 'b, 'a : 'b
39643964
/// ```
39653965
pub fn parse_where_clause(&mut self) -> PResult<ast::WhereClause> {

src/libsyntax/print/pp.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@
1111
//! This pretty-printer is a direct reimplementation of Philip Karlton's
1212
//! Mesa pretty-printer, as described in appendix A of
1313
//!
14-
//! STAN-CS-79-770: "Pretty Printing", by Derek C. Oppen.
15-
//! Stanford Department of Computer Science, 1979.
14+
//! ````ignore
15+
//! STAN-CS-79-770: "Pretty Printing", by Derek C. Oppen.
16+
//! Stanford Department of Computer Science, 1979.
17+
//! ````
1618
//!
1719
//! The algorithm's aim is to break a stream into as few lines as possible
1820
//! while respecting the indentation-consistency requirements of the enclosing

0 commit comments

Comments
 (0)