From d64e551248d73ca9657952e983d3d178d85d3608 Mon Sep 17 00:00:00 2001 From: Kevin Butler Date: Tue, 3 Nov 2015 16:34:11 +0000 Subject: [PATCH] libsyntax: deny warnings in doctests --- mk/tests.mk | 2 +- src/libsyntax/ast.rs | 14 ++++++++------ src/libsyntax/ext/deriving/generic/mod.rs | 9 +++++---- src/libsyntax/ext/format.rs | 7 ++++--- src/libsyntax/lib.rs | 3 ++- src/libsyntax/parse/parser.rs | 2 +- src/libsyntax/print/pp.rs | 6 ++++-- 7 files changed, 25 insertions(+), 18 deletions(-) diff --git a/mk/tests.mk b/mk/tests.mk index ed6e2b00344..36199cef23a 100644 --- a/mk/tests.mk +++ b/mk/tests.mk @@ -26,7 +26,7 @@ TEST_TARGET_CRATES = $(filter-out core rustc_unicode alloc_system libc \ alloc_jemalloc,$(TARGET_CRATES)) \ collectionstest coretest TEST_DOC_CRATES = $(DOC_CRATES) arena flate fmt_macros getopts graphviz \ - log rand rbml serialize + log rand rbml serialize syntax TEST_HOST_CRATES = $(filter-out rustc_typeck rustc_borrowck rustc_resolve \ rustc_trans rustc_lint,\ $(HOST_CRATES)) diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 8c9c8835087..1f34af617d5 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -908,13 +908,15 @@ pub enum Expr_ { /// separately. `position` represents the index of the associated /// item qualified with this Self type. /// -/// as a::b::Trait>::AssociatedItem -/// ^~~~~ ~~~~~~~~~~~~~~^ -/// ty position = 3 +/// ```ignore +/// as a::b::Trait>::AssociatedItem +/// ^~~~~ ~~~~~~~~~~~~~~^ +/// ty position = 3 /// -/// >::AssociatedItem -/// ^~~~~ ^ -/// ty position = 0 +/// >::AssociatedItem +/// ^~~~~ ^ +/// ty position = 0 +/// ``` #[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub struct QSelf { pub ty: P, diff --git a/src/libsyntax/ext/deriving/generic/mod.rs b/src/libsyntax/ext/deriving/generic/mod.rs index 5c6e2fce8ad..5a0fc4fda0c 100644 --- a/src/libsyntax/ext/deriving/generic/mod.rs +++ b/src/libsyntax/ext/deriving/generic/mod.rs @@ -54,6 +54,7 @@ //! following snippet //! //! ```rust +//! # #![allow(dead_code)] //! struct A { x : i32 } //! //! struct B(i32); @@ -88,7 +89,7 @@ //! //! ```rust //! trait PartialEq { -//! fn eq(&self, other: &Self); +//! fn eq(&self, other: &Self) -> bool; //! } //! impl PartialEq for i32 { //! fn eq(&self, other: &i32) -> bool { @@ -905,7 +906,7 @@ fn create_method(&self, }) } - /// ``` + /// ```ignore /// #[derive(PartialEq)] /// struct A { x: i32, y: i32 } /// @@ -1010,7 +1011,7 @@ fn expand_static_struct_method_body(&self, &StaticStruct(struct_def, summary)) } - /// ``` + /// ```ignore /// #[derive(PartialEq)] /// enum A { /// A1, @@ -1596,7 +1597,7 @@ pub fn cs_fold(use_foldl: bool, /// Call the method that is being derived on all the fields, and then /// process the collected results. i.e. /// -/// ``` +/// ```ignore /// f(cx, span, vec![self_1.method(__arg_1_1, __arg_2_1), /// self_2.method(__arg_1_2, __arg_2_2)]) /// ``` diff --git a/src/libsyntax/ext/format.rs b/src/libsyntax/ext/format.rs index c56342371c8..af0e7ce5c8d 100644 --- a/src/libsyntax/ext/format.rs +++ b/src/libsyntax/ext/format.rs @@ -77,9 +77,10 @@ struct Context<'a, 'b:'a> { /// expressions. /// /// If parsing succeeds, the return value is: -/// -/// Some((fmtstr, unnamed arguments, ordering of named arguments, -/// named arguments)) +/// ```ignore +/// Some((fmtstr, unnamed arguments, ordering of named arguments, +/// named arguments)) +/// ``` fn parse_args(ecx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree]) -> Option<(P, Vec>, Vec, HashMap>)> { diff --git a/src/libsyntax/lib.rs b/src/libsyntax/lib.rs index 8b001f2419c..295c3e05bc0 100644 --- a/src/libsyntax/lib.rs +++ b/src/libsyntax/lib.rs @@ -23,7 +23,8 @@ #![crate_type = "rlib"] #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", html_favicon_url = "https://doc.rust-lang.org/favicon.ico", - html_root_url = "https://doc.rust-lang.org/nightly/")] + html_root_url = "https://doc.rust-lang.org/nightly/", + test(attr(deny(warnings))))] #![feature(associated_consts)] #![feature(drain)] diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index fde1058a785..1e38eebec5d 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -3965,7 +3965,7 @@ fn forbid_lifetime(&mut self) -> PResult<()> { /// Parses an optional `where` clause and places it in `generics`. /// - /// ``` + /// ```ignore /// where T : Trait + 'b, 'a : 'b /// ``` pub fn parse_where_clause(&mut self) -> PResult { diff --git a/src/libsyntax/print/pp.rs b/src/libsyntax/print/pp.rs index 7c5a46465f5..cbbd5289a5a 100644 --- a/src/libsyntax/print/pp.rs +++ b/src/libsyntax/print/pp.rs @@ -11,8 +11,10 @@ //! This pretty-printer is a direct reimplementation of Philip Karlton's //! Mesa pretty-printer, as described in appendix A of //! -//! STAN-CS-79-770: "Pretty Printing", by Derek C. Oppen. -//! Stanford Department of Computer Science, 1979. +//! ````ignore +//! STAN-CS-79-770: "Pretty Printing", by Derek C. Oppen. +//! Stanford Department of Computer Science, 1979. +//! ```` //! //! The algorithm's aim is to break a stream into as few lines as possible //! while respecting the indentation-consistency requirements of the enclosing -- 2.44.0