Skip to content

Commit de11d2a

Browse files
committed
Auto merge of #29529 - Ryman:rustdoc-cap-lints, r=alexcrichton
This sets the `cap-lints` setting to 'allow' for all doc compilations. There's precedent for this as rustdoc [already whitelists unstable code](https://github.com/rust-lang/rust/blob/master/src/librustdoc/core.rs#L112) when compiling documentation, with the expectation being that a regular compile will complain about any problems. I think the same justification applies here. Problem case in the wild: Manishearth/compiletest-rs#28 r? @Manishearth
2 parents 4aa1f59 + b1ef530 commit de11d2a

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

src/librustdoc/core.rs

+1
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ pub fn run_core(search_paths: SearchPaths, cfgs: Vec<String>, externs: Externs,
105105
search_paths: search_paths,
106106
crate_types: vec!(config::CrateTypeRlib),
107107
lint_opts: vec!((warning_lint, lint::Allow)),
108+
lint_cap: Some(lint::Allow),
108109
externs: externs,
109110
target_triple: triple.unwrap_or(config::host_triple().to_string()),
110111
cfg: config::parse_cfgspecs(cfgs),

src/test/rustdoc/cap-lints.rs

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// This should fail a normal compile due to non_camel_case_types,
12+
// It should pass a doc-compile as it only needs to type-check and
13+
// therefore should not concern itself with the lints.
14+
#[deny(warnings)]
15+
16+
// @has cap_lints/struct.foo.html //pre '#[must_use]'
17+
#[must_use]
18+
pub struct foo {
19+
field: i32,
20+
}

0 commit comments

Comments
 (0)