about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2018-06-09 17:20:58 +0200
committerGuillaume Gomez <guillaume1.gomez@gmail.com>2018-06-13 21:18:55 +0200
commit8c43c93e6d8526ef6a3beb656003dd723aa0e952 (patch)
tree2a698d88c0a47154fafaca2584f752ea1eebe698
parentb000cf07261af68c7aa47e10140c692bc03c85da (diff)
downloadrust-8c43c93e6d8526ef6a3beb656003dd723aa0e952.tar.gz
rust-8c43c93e6d8526ef6a3beb656003dd723aa0e952.zip
Fix options issues
-rw-r--r--src/librustc_lint/builtin.rs33
-rw-r--r--src/librustc_lint/lib.rs3
-rw-r--r--src/librustdoc/core.rs13
-rw-r--r--src/test/rustdoc-ui/deny-intra-link-resolution-failure.stderr16
-rw-r--r--src/test/rustdoc-ui/intra-links-warning.stderr2
5 files changed, 49 insertions, 18 deletions
diff --git a/src/librustc_lint/builtin.rs b/src/librustc_lint/builtin.rs
index 0a647365598..79796d78871 100644
--- a/src/librustc_lint/builtin.rs
+++ b/src/librustc_lint/builtin.rs
@@ -1665,3 +1665,36 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TrivialConstraints {
         }
     }
 }
+
+/// Does nothing as a lint pass, but registers some `Lint`s
+/// which are used by other parts of the compiler.
+#[derive(Copy, Clone)]
+pub struct SoftLints;
+
+impl LintPass for SoftLints {
+    fn get_lints(&self) -> LintArray {
+        lint_array!(
+            WHILE_TRUE,
+            BOX_POINTERS,
+            NON_SHORTHAND_FIELD_PATTERNS,
+            UNSAFE_CODE,
+            MISSING_DOCS,
+            MISSING_COPY_IMPLEMENTATIONS,
+            MISSING_DEBUG_IMPLEMENTATIONS,
+            ANONYMOUS_PARAMETERS,
+            UNUSED_DOC_COMMENTS,
+            UNCONDITIONAL_RECURSION,
+            PLUGIN_AS_LIBRARY,
+            PRIVATE_NO_MANGLE_FNS,
+            PRIVATE_NO_MANGLE_STATICS,
+            NO_MANGLE_CONST_ITEMS,
+            NO_MANGLE_GENERIC_ITEMS,
+            MUTABLE_TRANSMUTES,
+            UNSTABLE_FEATURES,
+            UNIONS_WITH_DROP_FIELDS,
+            UNREACHABLE_PUB,
+            TYPE_ALIAS_BOUNDS,
+            TRIVIAL_BOUNDS,
+        )
+    }
+}
diff --git a/src/librustc_lint/lib.rs b/src/librustc_lint/lib.rs
index 47f17285f5f..9ac22f8dceb 100644
--- a/src/librustc_lint/lib.rs
+++ b/src/librustc_lint/lib.rs
@@ -60,6 +60,9 @@ use builtin::*;
 use types::*;
 use unused::*;
 
+/// Useful for other parts of the compiler.
+pub use builtin::SoftLints;
+
 /// Tell the `LintStore` about all the built-in lints (the ones
 /// defined in this crate and the ones defined in
 /// `rustc::lint::builtin`).
diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs
index 9a733ab4249..f46d3d834ae 100644
--- a/src/librustdoc/core.rs
+++ b/src/librustdoc/core.rs
@@ -191,16 +191,13 @@ pub fn run_core(search_paths: SearchPaths,
     let warnings_lint_name = lint::builtin::WARNINGS.name;
     let lints = lint::builtin::HardwiredLints.get_lints()
                     .iter()
+                    .chain(rustc_lint::SoftLints.get_lints())
                     .filter_map(|lint| {
-                        if lint.name == warnings_lint_name {
+                        if lint.name == warnings_lint_name ||
+                           lint.name == intra_link_resolution_failure_name {
                             None
                         } else {
-                            let level = if lint.name == intra_link_resolution_failure_name {
-                                lint::Warn
-                            } else {
-                                lint::Allow
-                            };
-                            Some((lint.name_lower(), level))
+                            Some((lint.name_lower(), lint::Allow))
                         }
                     })
                     .collect::<Vec<_>>();
@@ -216,7 +213,7 @@ pub fn run_core(search_paths: SearchPaths,
         } else {
             vec![]
         },
-        lint_cap: Some(lint::Warn),
+        lint_cap: Some(lint::Forbid),
         cg,
         externs,
         target_triple: triple.unwrap_or(host_triple),
diff --git a/src/test/rustdoc-ui/deny-intra-link-resolution-failure.stderr b/src/test/rustdoc-ui/deny-intra-link-resolution-failure.stderr
index 39fb33ce933..3aa45405fd4 100644
--- a/src/test/rustdoc-ui/deny-intra-link-resolution-failure.stderr
+++ b/src/test/rustdoc-ui/deny-intra-link-resolution-failure.stderr
@@ -1,16 +1,12 @@
-warning: [v2] cannot be resolved, ignoring it...
-  --> src/test/rustdoc-ui/deny-intra-link-resolution-failure.rs:13:1
+error: `[v2]` cannot be resolved, ignoring it...
+  --> $DIR/deny-intra-link-resolution-failure.rs:13:6
    |
-LL | /// [v2] //~ ERROR
-   | ^^^^^^^^^^^^^^^^^^
+13 | /// [v2] //~ ERROR
+   |      ^^ cannot be resolved, ignoring
    |
 note: lint level defined here
-  --> src/test/rustdoc-ui/deny-intra-link-resolution-failure.rs:11:9
+  --> $DIR/deny-intra-link-resolution-failure.rs:11:9
    |
-LL | #![deny(intra_link_resolution_failure)]
+11 | #![deny(intra_link_resolution_failure)]
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   = note: the link appears in this line:
-
-            [v2] //~ ERROR
-             ^^
 
diff --git a/src/test/rustdoc-ui/intra-links-warning.stderr b/src/test/rustdoc-ui/intra-links-warning.stderr
index 52adba5679f..4949c450343 100644
--- a/src/test/rustdoc-ui/intra-links-warning.stderr
+++ b/src/test/rustdoc-ui/intra-links-warning.stderr
@@ -3,6 +3,8 @@ warning: `[Foo::baz]` cannot be resolved, ignoring it...
    |
 13 |        //! Test with [Foo::baz], [Bar::foo], ...
    |                       ^^^^^^^^ cannot be resolved, ignoring
+   |
+   = note: #[warn(intra_link_resolution_failure)] on by default
 
 warning: `[Bar::foo]` cannot be resolved, ignoring it...
   --> $DIR/intra-links-warning.rs:13:35