libsyntax: deny warnings in doctests

This commit is contained in:
Kevin Butler 2015-11-03 16:34:11 +00:00
parent a17f81b4b7
commit d64e551248
7 changed files with 25 additions and 18 deletions

View File

@ -26,7 +26,7 @@ TEST_TARGET_CRATES = $(filter-out core rustc_unicode alloc_system libc \
alloc_jemalloc,$(TARGET_CRATES)) \ alloc_jemalloc,$(TARGET_CRATES)) \
collectionstest coretest collectionstest coretest
TEST_DOC_CRATES = $(DOC_CRATES) arena flate fmt_macros getopts graphviz \ 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 \ TEST_HOST_CRATES = $(filter-out rustc_typeck rustc_borrowck rustc_resolve \
rustc_trans rustc_lint,\ rustc_trans rustc_lint,\
$(HOST_CRATES)) $(HOST_CRATES))

View File

@ -908,13 +908,15 @@ pub enum Expr_ {
/// separately. `position` represents the index of the associated /// separately. `position` represents the index of the associated
/// item qualified with this Self type. /// item qualified with this Self type.
/// ///
/// <Vec<T> as a::b::Trait>::AssociatedItem /// ```ignore
/// ^~~~~ ~~~~~~~~~~~~~~^ /// <Vec<T> as a::b::Trait>::AssociatedItem
/// ty position = 3 /// ^~~~~ ~~~~~~~~~~~~~~^
/// ty position = 3
/// ///
/// <Vec<T>>::AssociatedItem /// <Vec<T>>::AssociatedItem
/// ^~~~~ ^ /// ^~~~~ ^
/// ty position = 0 /// ty position = 0
/// ```
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] #[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
pub struct QSelf { pub struct QSelf {
pub ty: P<Ty>, pub ty: P<Ty>,

View File

@ -54,6 +54,7 @@
//! following snippet //! following snippet
//! //!
//! ```rust //! ```rust
//! # #![allow(dead_code)]
//! struct A { x : i32 } //! struct A { x : i32 }
//! //!
//! struct B(i32); //! struct B(i32);
@ -88,7 +89,7 @@
//! //!
//! ```rust //! ```rust
//! trait PartialEq { //! trait PartialEq {
//! fn eq(&self, other: &Self); //! fn eq(&self, other: &Self) -> bool;
//! } //! }
//! impl PartialEq for i32 { //! impl PartialEq for i32 {
//! fn eq(&self, other: &i32) -> bool { //! fn eq(&self, other: &i32) -> bool {
@ -905,7 +906,7 @@ impl<'a> MethodDef<'a> {
}) })
} }
/// ``` /// ```ignore
/// #[derive(PartialEq)] /// #[derive(PartialEq)]
/// struct A { x: i32, y: i32 } /// struct A { x: i32, y: i32 }
/// ///
@ -1010,7 +1011,7 @@ impl<'a> MethodDef<'a> {
&StaticStruct(struct_def, summary)) &StaticStruct(struct_def, summary))
} }
/// ``` /// ```ignore
/// #[derive(PartialEq)] /// #[derive(PartialEq)]
/// enum A { /// enum A {
/// A1, /// A1,
@ -1596,7 +1597,7 @@ pub fn cs_fold<F>(use_foldl: bool,
/// Call the method that is being derived on all the fields, and then /// Call the method that is being derived on all the fields, and then
/// process the collected results. i.e. /// process the collected results. i.e.
/// ///
/// ``` /// ```ignore
/// f(cx, span, vec![self_1.method(__arg_1_1, __arg_2_1), /// f(cx, span, vec![self_1.method(__arg_1_1, __arg_2_1),
/// self_2.method(__arg_1_2, __arg_2_2)]) /// self_2.method(__arg_1_2, __arg_2_2)])
/// ``` /// ```

View File

@ -77,9 +77,10 @@ struct Context<'a, 'b:'a> {
/// expressions. /// expressions.
/// ///
/// If parsing succeeds, the return value is: /// If parsing succeeds, the return value is:
/// /// ```ignore
/// Some((fmtstr, unnamed arguments, ordering of named arguments, /// Some((fmtstr, unnamed arguments, ordering of named arguments,
/// named arguments)) /// named arguments))
/// ```
fn parse_args(ecx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree]) fn parse_args(ecx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
-> Option<(P<ast::Expr>, Vec<P<ast::Expr>>, Vec<String>, -> Option<(P<ast::Expr>, Vec<P<ast::Expr>>, Vec<String>,
HashMap<String, P<ast::Expr>>)> { HashMap<String, P<ast::Expr>>)> {

View File

@ -23,7 +23,8 @@
#![crate_type = "rlib"] #![crate_type = "rlib"]
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", #![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_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(associated_consts)]
#![feature(drain)] #![feature(drain)]

View File

@ -3965,7 +3965,7 @@ impl<'a> Parser<'a> {
/// Parses an optional `where` clause and places it in `generics`. /// Parses an optional `where` clause and places it in `generics`.
/// ///
/// ``` /// ```ignore
/// where T : Trait<U, V> + 'b, 'a : 'b /// where T : Trait<U, V> + 'b, 'a : 'b
/// ``` /// ```
pub fn parse_where_clause(&mut self) -> PResult<ast::WhereClause> { pub fn parse_where_clause(&mut self) -> PResult<ast::WhereClause> {

View File

@ -11,8 +11,10 @@
//! This pretty-printer is a direct reimplementation of Philip Karlton's //! This pretty-printer is a direct reimplementation of Philip Karlton's
//! Mesa pretty-printer, as described in appendix A of //! Mesa pretty-printer, as described in appendix A of
//! //!
//! STAN-CS-79-770: "Pretty Printing", by Derek C. Oppen. //! ````ignore
//! Stanford Department of Computer Science, 1979. //! 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 //! The algorithm's aim is to break a stream into as few lines as possible
//! while respecting the indentation-consistency requirements of the enclosing //! while respecting the indentation-consistency requirements of the enclosing