Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix options issues
  • Loading branch information
GuillaumeGomez committed Jun 13, 2018
1 parent b000cf0 commit 8c43c93
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 18 deletions.
33 changes: 33 additions & 0 deletions src/librustc_lint/builtin.rs
Expand Up @@ -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,
)
}
}
3 changes: 3 additions & 0 deletions src/librustc_lint/lib.rs
Expand Up @@ -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`).
Expand Down
13 changes: 5 additions & 8 deletions src/librustdoc/core.rs
Expand Up @@ -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<_>>();
Expand All @@ -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),
Expand Down
16 changes: 6 additions & 10 deletions 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
^^

2 changes: 2 additions & 0 deletions src/test/rustdoc-ui/intra-links-warning.stderr
Expand Up @@ -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
Expand Down

0 comments on commit 8c43c93

Please sign in to comment.