Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/cargo/core/manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ struct SerializedTarget<'a> {
edition: &'a str,
#[serde(rename = "required-features", skip_serializing_if = "Option::is_none")]
required_features: Option<Vec<&'a str>>,
doctest: bool,
}

impl ser::Serialize for Target {
Expand All @@ -307,6 +308,7 @@ impl ser::Serialize for Target {
.required_features
.as_ref()
.map(|rf| rf.iter().map(|s| &**s).collect()),
doctest: self.doctest && self.doctestable(),
}
.serialize(s)
}
Expand Down
1 change: 1 addition & 0 deletions tests/testsuite/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1620,6 +1620,7 @@ fn json_artifact_includes_executable_for_benchmark() {
"target": {
"crate_types": [ "bin" ],
"kind": [ "bench" ],
"doctest": false,
"edition": "2015",
"name": "benchmark",
"src_path": "[..]/foo/benches/benchmark.rs"
Expand Down
10 changes: 10 additions & 0 deletions tests/testsuite/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3052,6 +3052,7 @@ fn compiler_json_error_format() {
"target":{
"kind":["custom-build"],
"crate_types":["bin"],
"doctest": false,
"edition": "2015",
"name":"build-script-build",
"src_path":"[..]build.rs"
Expand All @@ -3075,6 +3076,7 @@ fn compiler_json_error_format() {
"target":{
"kind":["lib"],
"crate_types":["lib"],
"doctest": true,
"edition": "2015",
"name":"bar",
"src_path":"[..]lib.rs"
Expand All @@ -3097,6 +3099,7 @@ fn compiler_json_error_format() {
"target":{
"kind":["lib"],
"crate_types":["lib"],
"doctest": true,
"edition": "2015",
"name":"bar",
"src_path":"[..]lib.rs"
Expand All @@ -3123,6 +3126,7 @@ fn compiler_json_error_format() {
"target":{
"kind":["bin"],
"crate_types":["bin"],
"doctest": false,
"edition": "2015",
"name":"foo",
"src_path":"[..]main.rs"
Expand All @@ -3136,6 +3140,7 @@ fn compiler_json_error_format() {
"target":{
"kind":["bin"],
"crate_types":["bin"],
"doctest": false,
"edition": "2015",
"name":"foo",
"src_path":"[..]main.rs"
Expand Down Expand Up @@ -3167,6 +3172,7 @@ fn compiler_json_error_format() {
"target":{
"kind":["custom-build"],
"crate_types":["bin"],
"doctest": false,
"edition": "2015",
"name":"build-script-build",
"src_path":"[..]build.rs"
Expand Down Expand Up @@ -3199,6 +3205,7 @@ fn compiler_json_error_format() {
"target":{
"kind":["lib"],
"crate_types":["lib"],
"doctest": true,
"edition": "2015",
"name":"bar",
"src_path":"[..]lib.rs"
Expand All @@ -3225,6 +3232,7 @@ fn compiler_json_error_format() {
"target":{
"kind":["bin"],
"crate_types":["bin"],
"doctest": false,
"edition": "2015",
"name":"foo",
"src_path":"[..]main.rs"
Expand Down Expand Up @@ -3280,6 +3288,7 @@ fn message_format_json_forward_stderr() {
"target":{
"kind":["bin"],
"crate_types":["bin"],
"doctest": false,
"edition": "2015",
"name":"foo",
"src_path":"[..]"
Expand All @@ -3293,6 +3302,7 @@ fn message_format_json_forward_stderr() {
"target":{
"kind":["bin"],
"crate_types":["bin"],
"doctest": false,
"edition": "2015",
"name":"foo",
"src_path":"[..]"
Expand Down
2 changes: 2 additions & 0 deletions tests/testsuite/metabuild.rs
Original file line number Diff line number Diff line change
Expand Up @@ -695,6 +695,7 @@ fn metabuild_json_artifact() {
"crate_types": [
"bin"
],
"doctest": false,
"edition": "2018",
"kind": [
"custom-build"
Expand Down Expand Up @@ -742,6 +743,7 @@ fn metabuild_failed_build_json() {
"crate_types": [
"bin"
],
"doctest": false,
"edition": "2018",
"kind": [
"custom-build"
Expand Down
26 changes: 26 additions & 0 deletions tests/testsuite/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ fn cargo_metadata_simple() {
"crate_types": [
"bin"
],
"doctest": false,
"edition": "2015",
"name": "foo",
"src_path": "[..]/foo/src/foo.rs"
Expand Down Expand Up @@ -129,6 +130,7 @@ crate-type = ["lib", "staticlib"]
"lib",
"staticlib"
],
"doctest": true,
"edition": "2015",
"name": "foo",
"src_path": "[..]/foo/src/lib.rs"
Expand Down Expand Up @@ -207,6 +209,7 @@ optional_feat = []
"crate_types": [
"lib"
],
"doctest": true,
"edition": "2015",
"name": "foo",
"src_path": "[..]/foo/src/lib.rs"
Expand Down Expand Up @@ -302,6 +305,7 @@ fn cargo_metadata_with_deps_and_version() {
"crate_types": [
"lib"
],
"doctest": true,
"edition": "2015",
"kind": [
"lib"
Expand Down Expand Up @@ -360,6 +364,7 @@ fn cargo_metadata_with_deps_and_version() {
"crate_types": [
"bin"
],
"doctest": false,
"edition": "2015",
"kind": [
"bin"
Expand Down Expand Up @@ -393,6 +398,7 @@ fn cargo_metadata_with_deps_and_version() {
"crate_types": [
"lib"
],
"doctest": true,
"edition": "2015",
"kind": [
"lib"
Expand Down Expand Up @@ -439,6 +445,7 @@ fn cargo_metadata_with_deps_and_version() {
"crate_types": [
"lib"
],
"doctest": true,
"edition": "2015",
"kind": [
"lib"
Expand Down Expand Up @@ -552,13 +559,15 @@ name = "ex"
{
"kind": [ "lib" ],
"crate_types": [ "lib" ],
"doctest": true,
"edition": "2015",
"name": "foo",
"src_path": "[..]/foo/src/lib.rs"
},
{
"kind": [ "example" ],
"crate_types": [ "bin" ],
"doctest": false,
"edition": "2015",
"name": "ex",
"src_path": "[..]/foo/examples/ex.rs"
Expand Down Expand Up @@ -635,13 +644,15 @@ crate-type = ["rlib", "dylib"]
{
"kind": [ "lib" ],
"crate_types": [ "lib" ],
"doctest": true,
"edition": "2015",
"name": "foo",
"src_path": "[..]/foo/src/lib.rs"
},
{
"kind": [ "example" ],
"crate_types": [ "rlib", "dylib" ],
"doctest": false,
"edition": "2015",
"name": "ex",
"src_path": "[..]/foo/examples/ex.rs"
Expand Down Expand Up @@ -717,6 +728,7 @@ fn workspace_metadata() {
{
"kind": [ "lib" ],
"crate_types": [ "lib" ],
"doctest": true,
"edition": "2015",
"name": "bar",
"src_path": "[..]bar/src/lib.rs"
Expand Down Expand Up @@ -748,6 +760,7 @@ fn workspace_metadata() {
{
"kind": [ "lib" ],
"crate_types": [ "lib" ],
"doctest": true,
"edition": "2015",
"name": "baz",
"src_path": "[..]baz/src/lib.rs"
Expand Down Expand Up @@ -827,6 +840,7 @@ fn workspace_metadata_no_deps() {
{
"kind": [ "lib" ],
"crate_types": [ "lib" ],
"doctest": true,
"edition": "2015",
"name": "bar",
"src_path": "[..]bar/src/lib.rs"
Expand Down Expand Up @@ -858,6 +872,7 @@ fn workspace_metadata_no_deps() {
{
"kind": [ "lib" ],
"crate_types": ["lib"],
"doctest": true,
"edition": "2015",
"name": "baz",
"src_path": "[..]baz/src/lib.rs"
Expand Down Expand Up @@ -915,6 +930,7 @@ const MANIFEST_OUTPUT: &str = r#"
"targets":[{
"kind":["bin"],
"crate_types":["bin"],
"doctest": false,
"edition": "2015",
"name":"foo",
"src_path":"[..]/foo/src/foo.rs"
Expand Down Expand Up @@ -1093,6 +1109,7 @@ fn package_metadata() {
{
"kind": [ "lib" ],
"crate_types": [ "lib" ],
"doctest": true,
"edition": "2015",
"name": "foo",
"src_path": "[..]foo/src/lib.rs"
Expand Down Expand Up @@ -1167,6 +1184,7 @@ fn cargo_metadata_path_to_cargo_toml_project() {
"crate_types": [
"lib"
],
"doctest": true,
"edition": "2015",
"kind": [
"lib"
Expand Down Expand Up @@ -1246,6 +1264,7 @@ fn package_edition_2018() {
"crate_types": [
"lib"
],
"doctest": true,
"edition": "2018",
"kind": [
"lib"
Expand Down Expand Up @@ -1329,6 +1348,7 @@ fn target_edition_2018() {
"crate_types": [
"lib"
],
"doctest": true,
"edition": "2018",
"kind": [
"lib"
Expand All @@ -1340,6 +1360,7 @@ fn target_edition_2018() {
"crate_types": [
"bin"
],
"doctest": false,
"edition": "2015",
"kind": [
"bin"
Expand Down Expand Up @@ -1449,6 +1470,7 @@ fn rename_dependency() {
"crate_types": [
"lib"
],
"doctest": true,
"edition": "2015",
"kind": [
"lib"
Expand Down Expand Up @@ -1482,6 +1504,7 @@ fn rename_dependency() {
"crate_types": [
"lib"
],
"doctest": true,
"edition": "2015",
"kind": [
"lib"
Expand Down Expand Up @@ -1515,6 +1538,7 @@ fn rename_dependency() {
"crate_types": [
"lib"
],
"doctest": true,
"edition": "2015",
"kind": [
"lib"
Expand Down Expand Up @@ -1616,6 +1640,7 @@ fn metadata_links() {
"crate_types": [
"lib"
],
"doctest": true,
"edition": "2015",
"kind": [
"lib"
Expand All @@ -1627,6 +1652,7 @@ fn metadata_links() {
"crate_types": [
"bin"
],
"doctest": false,
"edition": "2015",
"kind": [
"custom-build"
Expand Down
1 change: 1 addition & 0 deletions tests/testsuite/read_manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ static MANIFEST_OUTPUT: &'static str = r#"
"targets":[{
"kind":["bin"],
"crate_types":["bin"],
"doctest": false,
"edition": "2015",
"name":"foo",
"src_path":"[..]/foo/src/foo.rs"
Expand Down
3 changes: 3 additions & 0 deletions tests/testsuite/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3362,6 +3362,7 @@ fn json_artifact_includes_test_flag() {
"target":{
"kind":["lib"],
"crate_types":["lib"],
"doctest": true,
"edition": "2015",
"name":"foo",
"src_path":"[..]lib.rs"
Expand Down Expand Up @@ -3395,6 +3396,7 @@ fn json_artifact_includes_executable_for_library_tests() {
"target": {
"crate_types": [ "lib" ],
"kind": [ "lib" ],
"doctest": true,
"edition": "2015",
"name": "foo",
"src_path": "[..]/foo/src/lib.rs"
Expand Down Expand Up @@ -3428,6 +3430,7 @@ fn json_artifact_includes_executable_for_integration_tests() {
"target": {
"crate_types": [ "bin" ],
"kind": [ "test" ],
"doctest": false,
"edition": "2015",
"name": "integration_test",
"src_path": "[..]/foo/tests/integration_test.rs"
Expand Down
2 changes: 2 additions & 0 deletions tests/testsuite/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,7 @@ fn update_precise_first_run() {
"crate_types": [
"lib"
],
"doctest": true,
"edition": "2015",
"kind": [
"lib"
Expand Down Expand Up @@ -502,6 +503,7 @@ fn update_precise_first_run() {
"crate_types": [
"lib"
],
"doctest": true,
"edition": "2015",
"kind": [
"lib"
Expand Down