about summary refs log tree commit diff
diff options
context:
space:
mode:
authorKevin Butler <haqkrs@gmail.com>2015-11-02 23:44:53 +0000
committerKevin Butler <haqkrs@gmail.com>2015-11-02 23:44:53 +0000
commitb1ef5302d5456add7b3314cd871d23a2dc45afb5 (patch)
treefe2f4068ed74f31cc26490f2fa3277d94515093d
parent2249b07ae988534a541be390d90396ed99b32955 (diff)
downloadrust-b1ef5302d5456add7b3314cd871d23a2dc45afb5.tar.gz
rust-b1ef5302d5456add7b3314cd871d23a2dc45afb5.zip
librustdoc: ignore lint warnings when compiling documentation
-rw-r--r--src/librustdoc/core.rs1
-rw-r--r--src/test/rustdoc/cap-lints.rs20
2 files changed, 21 insertions, 0 deletions
diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs
index 4955951d36e..ae01d6e5426 100644
--- a/src/librustdoc/core.rs
+++ b/src/librustdoc/core.rs
@@ -105,6 +105,7 @@ pub fn run_core(search_paths: SearchPaths, cfgs: Vec<String>, 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 00000000000..e7f308a6f0b
--- /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 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, 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,
+}