Skip to content

Commit 8c43c93

Browse files
Fix options issues
1 parent b000cf0 commit 8c43c93

File tree

5 files changed

+49
-18
lines changed

5 files changed

+49
-18
lines changed

src/librustc_lint/builtin.rs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1665,3 +1665,36 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TrivialConstraints {
16651665
}
16661666
}
16671667
}
1668+
1669+
/// Does nothing as a lint pass, but registers some `Lint`s
1670+
/// which are used by other parts of the compiler.
1671+
#[derive(Copy, Clone)]
1672+
pub struct SoftLints;
1673+
1674+
impl LintPass for SoftLints {
1675+
fn get_lints(&self) -> LintArray {
1676+
lint_array!(
1677+
WHILE_TRUE,
1678+
BOX_POINTERS,
1679+
NON_SHORTHAND_FIELD_PATTERNS,
1680+
UNSAFE_CODE,
1681+
MISSING_DOCS,
1682+
MISSING_COPY_IMPLEMENTATIONS,
1683+
MISSING_DEBUG_IMPLEMENTATIONS,
1684+
ANONYMOUS_PARAMETERS,
1685+
UNUSED_DOC_COMMENTS,
1686+
UNCONDITIONAL_RECURSION,
1687+
PLUGIN_AS_LIBRARY,
1688+
PRIVATE_NO_MANGLE_FNS,
1689+
PRIVATE_NO_MANGLE_STATICS,
1690+
NO_MANGLE_CONST_ITEMS,
1691+
NO_MANGLE_GENERIC_ITEMS,
1692+
MUTABLE_TRANSMUTES,
1693+
UNSTABLE_FEATURES,
1694+
UNIONS_WITH_DROP_FIELDS,
1695+
UNREACHABLE_PUB,
1696+
TYPE_ALIAS_BOUNDS,
1697+
TRIVIAL_BOUNDS,
1698+
)
1699+
}
1700+
}

src/librustc_lint/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ use builtin::*;
6060
use types::*;
6161
use unused::*;
6262

63+
/// Useful for other parts of the compiler.
64+
pub use builtin::SoftLints;
65+
6366
/// Tell the `LintStore` about all the built-in lints (the ones
6467
/// defined in this crate and the ones defined in
6568
/// `rustc::lint::builtin`).

src/librustdoc/core.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -191,16 +191,13 @@ pub fn run_core(search_paths: SearchPaths,
191191
let warnings_lint_name = lint::builtin::WARNINGS.name;
192192
let lints = lint::builtin::HardwiredLints.get_lints()
193193
.iter()
194+
.chain(rustc_lint::SoftLints.get_lints())
194195
.filter_map(|lint| {
195-
if lint.name == warnings_lint_name {
196+
if lint.name == warnings_lint_name ||
197+
lint.name == intra_link_resolution_failure_name {
196198
None
197199
} else {
198-
let level = if lint.name == intra_link_resolution_failure_name {
199-
lint::Warn
200-
} else {
201-
lint::Allow
202-
};
203-
Some((lint.name_lower(), level))
200+
Some((lint.name_lower(), lint::Allow))
204201
}
205202
})
206203
.collect::<Vec<_>>();
@@ -216,7 +213,7 @@ pub fn run_core(search_paths: SearchPaths,
216213
} else {
217214
vec![]
218215
},
219-
lint_cap: Some(lint::Warn),
216+
lint_cap: Some(lint::Forbid),
220217
cg,
221218
externs,
222219
target_triple: triple.unwrap_or(host_triple),
Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
1-
warning: [v2] cannot be resolved, ignoring it...
2-
--> src/test/rustdoc-ui/deny-intra-link-resolution-failure.rs:13:1
1+
error: `[v2]` cannot be resolved, ignoring it...
2+
--> $DIR/deny-intra-link-resolution-failure.rs:13:6
33
|
4-
LL | /// [v2] //~ ERROR
5-
| ^^^^^^^^^^^^^^^^^^
4+
13 | /// [v2] //~ ERROR
5+
| ^^ cannot be resolved, ignoring
66
|
77
note: lint level defined here
8-
--> src/test/rustdoc-ui/deny-intra-link-resolution-failure.rs:11:9
8+
--> $DIR/deny-intra-link-resolution-failure.rs:11:9
99
|
10-
LL | #![deny(intra_link_resolution_failure)]
10+
11 | #![deny(intra_link_resolution_failure)]
1111
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
12-
= note: the link appears in this line:
13-
14-
[v2] //~ ERROR
15-
^^
1612

src/test/rustdoc-ui/intra-links-warning.stderr

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ warning: `[Foo::baz]` cannot be resolved, ignoring it...
33
|
44
13 | //! Test with [Foo::baz], [Bar::foo], ...
55
| ^^^^^^^^ cannot be resolved, ignoring
6+
|
7+
= note: #[warn(intra_link_resolution_failure)] on by default
68

79
warning: `[Bar::foo]` cannot be resolved, ignoring it...
810
--> $DIR/intra-links-warning.rs:13:35

0 commit comments

Comments
 (0)