Fix options issues

This commit is contained in:
Guillaume Gomez 2018-06-09 17:20:58 +02:00
parent b000cf0726
commit 8c43c93e6d
5 changed files with 49 additions and 18 deletions

View File

@ -1665,3 +1665,36 @@ fn check_item(
}
}
}
/// 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,
)
}
}

View File

@ -60,6 +60,9 @@
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`).

View File

@ -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),

View File

@ -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
^^

View File

@ -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