mirror of
https://github.com/rust-lang/cargo.git
synced 2025-09-28 11:20:36 +00:00
Auto merge of #12501 - epage:rustdoc, r=weihanglo
fix(lints): Doctest extraction should respect `[lints]` Note the first commit shows the bug and the second commit fixes it Fixes #12497
This commit is contained in:
commit
7c3904d6c3
@ -260,6 +260,8 @@ fn run_doc_tests(
|
||||
p.arg("--test-args").arg("--quiet");
|
||||
}
|
||||
|
||||
p.args(unit.pkg.manifest().lint_rustflags());
|
||||
|
||||
p.args(args);
|
||||
|
||||
if *unstable_opts {
|
||||
|
@ -637,3 +637,58 @@ error: unresolved link to `bar`
|
||||
)
|
||||
.run();
|
||||
}
|
||||
|
||||
#[cargo_test]
|
||||
fn doctest_respects_lints() {
|
||||
let foo = project()
|
||||
.file(
|
||||
"Cargo.toml",
|
||||
r#"
|
||||
[package]
|
||||
name = "foo"
|
||||
version = "0.0.1"
|
||||
authors = []
|
||||
|
||||
[lints.rust]
|
||||
confusable-idents = 'allow'
|
||||
"#,
|
||||
)
|
||||
.file(
|
||||
"src/lib.rs",
|
||||
r#"
|
||||
/// Test
|
||||
///
|
||||
/// [`Foo`]
|
||||
///
|
||||
/// ```
|
||||
/// let s = "rust";
|
||||
/// let s_s = "rust2";
|
||||
/// ```
|
||||
pub fn f() {}
|
||||
pub const Ě: i32 = 1;
|
||||
pub const Ĕ: i32 = 2;
|
||||
"#,
|
||||
)
|
||||
.build();
|
||||
|
||||
foo.cargo("check -Zlints")
|
||||
.masquerade_as_nightly_cargo(&["lints"])
|
||||
.with_stderr(
|
||||
"\
|
||||
[CHECKING] foo v0.0.1 ([CWD])
|
||||
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s
|
||||
",
|
||||
)
|
||||
.run();
|
||||
|
||||
foo.cargo("test --doc -Zlints")
|
||||
.masquerade_as_nightly_cargo(&["lints"])
|
||||
.with_stderr(
|
||||
"\
|
||||
[COMPILING] foo v0.0.1 ([CWD])
|
||||
[FINISHED] test [unoptimized + debuginfo] target(s) in [..]s
|
||||
[DOCTEST] foo
|
||||
",
|
||||
)
|
||||
.run();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user