From b1ef5302d5456add7b3314cd871d23a2dc45afb5 Mon Sep 17 00:00:00 2001 From: Kevin Butler Date: Mon, 2 Nov 2015 23:44:53 +0000 Subject: [PATCH] librustdoc: ignore lint warnings when compiling documentation --- src/librustdoc/core.rs | 1 + src/test/rustdoc/cap-lints.rs | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 src/test/rustdoc/cap-lints.rs diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs index 4955951d36e84..ae01d6e542611 100644 --- a/src/librustdoc/core.rs +++ b/src/librustdoc/core.rs @@ -105,6 +105,7 @@ pub fn run_core(search_paths: SearchPaths, cfgs: Vec, externs: Externs, search_paths: search_paths, crate_types: vec!(config::CrateTypeRlib), lint_opts: vec!((warning_lint, lint::Allow)), + lint_cap: Some(lint::Allow), externs: externs, target_triple: triple.unwrap_or(config::host_triple().to_string()), cfg: config::parse_cfgspecs(cfgs), diff --git a/src/test/rustdoc/cap-lints.rs b/src/test/rustdoc/cap-lints.rs new file mode 100644 index 0000000000000..e7f308a6f0b69 --- /dev/null +++ b/src/test/rustdoc/cap-lints.rs @@ -0,0 +1,20 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// This should fail a normal compile due to non_camel_case_types, +// It should pass a doc-compile as it only needs to type-check and +// therefore should not concern itself with the lints. +#[deny(warnings)] + +// @has cap_lints/struct.foo.html //pre '#[must_use]' +#[must_use] +pub struct foo { + field: i32, +}