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/package.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -71,6 +71,7 @@ struct SerializedPackage<'a> {
readme: Option<&'a str>,
repository: Option<&'a str>,
edition: &'a str,
links: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
metabuild: Option<&'a Vec<String>>,
}
Expand DownExpand Up@@ -120,6 +121,7 @@ impl ser::Serialize for Package {
readme,
repository,
edition: &self.manifest.edition().to_string(),
links: self.manifest.links(),
metabuild: self.manifest.metabuild(),
}
.serialize(s)
Expand Down
6 changes: 5 additions & 1 deletion src/doc/man/cargo-metadata.adoc
Original file line numberDiff line numberDiff line change
Expand Up@@ -170,7 +170,11 @@ The output has the following format:
/* The default edition of the package.
Note that individual targets may have different editions.
*/
"edition": "2018"
"edition": "2018",
/* Optional string that is the name of a native library the package
is linking to.
*/
"links": null,
}
],
/* Array of members of the workspace.
Expand Down
6 changes: 5 additions & 1 deletion src/doc/man/generated/cargo-metadata.html
Original file line numberDiff line numberDiff line change
Expand Up@@ -177,7 +177,11 @@ <h2 id="cargo_metadata_output_format">OUTPUT FORMAT</h2>
/* The default edition of the package.
Note that individual targets may have different editions.
*/
"edition": "2018"
"edition": "2018",
/* Optional string that is the name of a native library the package
is linking to.
*/
"links": null,
}
],
/* Array of members of the workspace.
Expand Down
10 changes: 7 additions & 3 deletions src/etc/man/cargo-metadata.1
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,12 +2,12 @@
.\" Title: cargo-metadata
.\" Author: [see the "AUTHOR(S)" section]
.\" Generator: Asciidoctor 1.5.8
.\" Date: 2018-12-18
.\" Date: 2018-12-23
.\" Manual: \ \&
.\" Source: \ \&
.\" Language: English
.\"
.TH "CARGO\-METADATA" "1" "2018-12-18" "\ \&" "\ \&"
.TH "CARGO\-METADATA" "1" "2018-12-23" "\ \&" "\ \&"
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.ss \n[.ss] 0
Expand DownExpand Up@@ -191,7 +191,11 @@ The output has the following format:
/* The default edition of the package.
Note that individual targets may have different editions.
*/
"edition": "2018"
"edition": "2018",
/* Optional string that is the name of a native library the package
is linking to.
*/
"links": null,
}
],
/* Array of members of the workspace.
Expand Down
108 changes: 108 additions & 0 deletions tests/testsuite/metadata.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -27,6 +27,7 @@ fn cargo_metadata_simple() {
"edition": "2015",
"license": null,
"license_file": null,
"links": null,
"description": null,
"readme": null,
"repository": null,
Expand DownExpand Up@@ -116,6 +117,7 @@ crate-type = ["lib", "staticlib"]
"edition": "2015",
"license": null,
"license_file": null,
"links": null,
"description": null,
"targets": [
{
Expand DownExpand Up@@ -195,6 +197,7 @@ optional_feat = []
"edition": "2015",
"license": null,
"license_file": null,
"links": null,
"description": null,
"targets": [
{
Expand DownExpand Up@@ -287,6 +290,7 @@ fn cargo_metadata_with_deps_and_version() {
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"manifest_path": "[..]Cargo.toml",
"metadata": null,
"name": "baz",
Expand DownExpand Up@@ -342,6 +346,7 @@ fn cargo_metadata_with_deps_and_version() {
"keywords": [],
"license": "MIT",
"license_file": null,
"links": null,
"manifest_path": "[..]Cargo.toml",
"metadata": null,
"name": "foo",
Expand DownExpand Up@@ -374,6 +379,7 @@ fn cargo_metadata_with_deps_and_version() {
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"manifest_path": "[..]Cargo.toml",
"metadata": null,
"name": "foobar",
Expand DownExpand Up@@ -418,6 +424,7 @@ fn cargo_metadata_with_deps_and_version() {
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"manifest_path": "[..]Cargo.toml",
"metadata": null,
"name": "bar",
Expand DownExpand Up@@ -533,6 +540,7 @@ name = "ex"
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"description": null,
"edition": "2015",
"source": null,
Expand DownExpand Up@@ -615,6 +623,7 @@ crate-type = ["rlib", "dylib"]
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"description": null,
"edition": "2015",
"source": null,
Expand DownExpand Up@@ -698,6 +707,7 @@ fn workspace_metadata() {
"dependencies": [],
"license": null,
"license_file": null,
"links": null,
"description": null,
"edition": "2015",
"targets": [
Expand DownExpand Up@@ -728,6 +738,7 @@ fn workspace_metadata() {
"dependencies": [],
"license": null,
"license_file": null,
"links": null,
"description": null,
"edition": "2015",
"targets": [
Expand DownExpand Up@@ -806,6 +817,7 @@ fn workspace_metadata_no_deps() {
"dependencies": [],
"license": null,
"license_file": null,
"links": null,
"description": null,
"edition": "2015",
"targets": [
Expand DownExpand Up@@ -836,6 +848,7 @@ fn workspace_metadata_no_deps() {
"dependencies": [],
"license": null,
"license_file": null,
"links": null,
"description": null,
"edition": "2015",
"targets": [
Expand DownExpand Up@@ -893,6 +906,7 @@ const MANIFEST_OUTPUT: &str = r#"
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"description": null,
"edition": "2015",
"targets":[{
Expand DownExpand Up@@ -1070,6 +1084,7 @@ fn package_metadata() {
"edition": "2015",
"license": null,
"license_file": null,
"links": null,
"description": null,
"targets": [
{
Expand DownExpand Up@@ -1137,6 +1152,7 @@ fn cargo_metadata_path_to_cargo_toml_project() {
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"manifest_path": "[..]Cargo.toml",
"metadata": null,
"name": "bar",
Expand DownExpand Up@@ -1218,6 +1234,7 @@ fn package_edition_2018() {
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"manifest_path": "[..]Cargo.toml",
"metadata": null,
"name": "foo",
Expand DownExpand Up@@ -1303,6 +1320,7 @@ fn target_edition_2018() {
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"manifest_path": "[..]Cargo.toml",
"metadata": null,
"name": "foo",
Expand DownExpand Up@@ -1423,6 +1441,7 @@ fn rename_dependency() {
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"manifest_path": "[..]",
"metadata": null,
"name": "foo",
Expand DownExpand Up@@ -1455,6 +1474,7 @@ fn rename_dependency() {
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"manifest_path": "[..]",
"metadata": null,
"name": "bar",
Expand DownExpand Up@@ -1487,6 +1507,7 @@ fn rename_dependency() {
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"manifest_path": "[..]",
"metadata": null,
"name": "bar",
Expand DownExpand Up@@ -1554,3 +1575,90 @@ fn rename_dependency() {
)
.run();
}

#[test]
fn metadata_links() {
let p = project()
.file(
"Cargo.toml",
r#"
[project]
name = "foo"
version = "0.5.0"
links = "a"
"#,
)
.file("src/lib.rs", "")
.file("build.rs", "fn main() {}")
.build();

p.cargo("metadata")
.with_json(r#"
{
"packages": [
{
"authors": [],
"categories": [],
"dependencies": [],
"description": null,
"edition": "2015",
"features": {},
"id": "foo 0.5.0 [..]",
"keywords": [],
"license": null,
"license_file": null,
"links": "a",
"manifest_path": "[..]/foo/Cargo.toml",
"metadata": null,
"name": "foo",
"readme": null,
"repository": null,
"source": null,
"targets": [
{
"crate_types": [
"lib"
],
"edition": "2015",
"kind": [
"lib"
],
"name": "foo",
"src_path": "[..]/foo/src/lib.rs"
},
{
"crate_types": [
"bin"
],
"edition": "2015",
"kind": [
"custom-build"
],
"name": "build-script-build",
"src_path": "[..]/foo/build.rs"
}
],
"version": "0.5.0"
}
],
"resolve": {
"nodes": [
{
"dependencies": [],
"deps": [],
"features": [],
"id": "foo 0.5.0 [..]"
}
],
"root": "foo 0.5.0 [..]"
},
"target_directory": "[..]/foo/target",
"version": 1,
"workspace_members": [
"foo 0.5.0 [..]"
],
"workspace_root": "[..]/foo"
}
"#)
.run()
}
1 change: 1 addition & 0 deletions tests/testsuite/read_manifest.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -14,6 +14,7 @@ static MANIFEST_OUTPUT: &'static str = r#"
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"description": null,
"edition": "2015",
"source":null,
Expand Down
, 'i'); if (__m === '*' || __re.test(location.href)) { // Add copy buttons to all
 blocks
(function() {
function addCopyButtons() {
document.querySelectorAll('pre code').forEach(function(codeBlock) {
if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;
codeBlock.parentElement.setAttribute('data-copy-added', 'true');
var btn = document.createElement('button');
btn.textContent = 'Copy';
btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';
btn.onmouseover = function() { this.style.opacity = '1'; };
btn.onmouseout = function() { this.style.opacity = '0.7'; };
btn.onclick = function() {
navigator.clipboard.writeText(codeBlock.textContent).then(function() {
btn.textContent = 'Copied!';
setTimeout(function() { btn.textContent = 'Copy'; }, 1500);
});
};
codeBlock.parentElement.style.position = 'relative';
codeBlock.parentElement.appendChild(btn);
});
}
addCopyButtons();
// Re-run on dynamic content
var observer = new MutationObserver(addCopyButtons);
observer.observe(document.body, { childList: true, subtree: true });
})();
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
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/package.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -71,6 +71,7 @@ struct SerializedPackage<'a> {
readme: Option<&'a str>,
repository: Option<&'a str>,
edition: &'a str,
links: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
metabuild: Option<&'a Vec<String>>,
}
Expand DownExpand Up@@ -120,6 +121,7 @@ impl ser::Serialize for Package {
readme,
repository,
edition: &self.manifest.edition().to_string(),
links: self.manifest.links(),
metabuild: self.manifest.metabuild(),
}
.serialize(s)
Expand Down
6 changes: 5 additions & 1 deletion src/doc/man/cargo-metadata.adoc
Original file line numberDiff line numberDiff line change
Expand Up@@ -170,7 +170,11 @@ The output has the following format:
/* The default edition of the package.
Note that individual targets may have different editions.
*/
"edition": "2018"
"edition": "2018",
/* Optional string that is the name of a native library the package
is linking to.
*/
"links": null,
}
],
/* Array of members of the workspace.
Expand Down
6 changes: 5 additions & 1 deletion src/doc/man/generated/cargo-metadata.html
Original file line numberDiff line numberDiff line change
Expand Up@@ -177,7 +177,11 @@ <h2 id="cargo_metadata_output_format">OUTPUT FORMAT</h2>
/* The default edition of the package.
Note that individual targets may have different editions.
*/
"edition": "2018"
"edition": "2018",
/* Optional string that is the name of a native library the package
is linking to.
*/
"links": null,
}
],
/* Array of members of the workspace.
Expand Down
10 changes: 7 additions & 3 deletions src/etc/man/cargo-metadata.1
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,12 +2,12 @@
.\" Title: cargo-metadata
.\" Author: [see the "AUTHOR(S)" section]
.\" Generator: Asciidoctor 1.5.8
.\" Date: 2018-12-18
.\" Date: 2018-12-23
.\" Manual: \ \&
.\" Source: \ \&
.\" Language: English
.\"
.TH "CARGO\-METADATA" "1" "2018-12-18" "\ \&" "\ \&"
.TH "CARGO\-METADATA" "1" "2018-12-23" "\ \&" "\ \&"
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.ss \n[.ss] 0
Expand DownExpand Up@@ -191,7 +191,11 @@ The output has the following format:
/* The default edition of the package.
Note that individual targets may have different editions.
*/
"edition": "2018"
"edition": "2018",
/* Optional string that is the name of a native library the package
is linking to.
*/
"links": null,
}
],
/* Array of members of the workspace.
Expand Down
108 changes: 108 additions & 0 deletions tests/testsuite/metadata.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -27,6 +27,7 @@ fn cargo_metadata_simple() {
"edition": "2015",
"license": null,
"license_file": null,
"links": null,
"description": null,
"readme": null,
"repository": null,
Expand DownExpand Up@@ -116,6 +117,7 @@ crate-type = ["lib", "staticlib"]
"edition": "2015",
"license": null,
"license_file": null,
"links": null,
"description": null,
"targets": [
{
Expand DownExpand Up@@ -195,6 +197,7 @@ optional_feat = []
"edition": "2015",
"license": null,
"license_file": null,
"links": null,
"description": null,
"targets": [
{
Expand DownExpand Up@@ -287,6 +290,7 @@ fn cargo_metadata_with_deps_and_version() {
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"manifest_path": "[..]Cargo.toml",
"metadata": null,
"name": "baz",
Expand DownExpand Up@@ -342,6 +346,7 @@ fn cargo_metadata_with_deps_and_version() {
"keywords": [],
"license": "MIT",
"license_file": null,
"links": null,
"manifest_path": "[..]Cargo.toml",
"metadata": null,
"name": "foo",
Expand DownExpand Up@@ -374,6 +379,7 @@ fn cargo_metadata_with_deps_and_version() {
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"manifest_path": "[..]Cargo.toml",
"metadata": null,
"name": "foobar",
Expand DownExpand Up@@ -418,6 +424,7 @@ fn cargo_metadata_with_deps_and_version() {
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"manifest_path": "[..]Cargo.toml",
"metadata": null,
"name": "bar",
Expand DownExpand Up@@ -533,6 +540,7 @@ name = "ex"
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"description": null,
"edition": "2015",
"source": null,
Expand DownExpand Up@@ -615,6 +623,7 @@ crate-type = ["rlib", "dylib"]
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"description": null,
"edition": "2015",
"source": null,
Expand DownExpand Up@@ -698,6 +707,7 @@ fn workspace_metadata() {
"dependencies": [],
"license": null,
"license_file": null,
"links": null,
"description": null,
"edition": "2015",
"targets": [
Expand DownExpand Up@@ -728,6 +738,7 @@ fn workspace_metadata() {
"dependencies": [],
"license": null,
"license_file": null,
"links": null,
"description": null,
"edition": "2015",
"targets": [
Expand DownExpand Up@@ -806,6 +817,7 @@ fn workspace_metadata_no_deps() {
"dependencies": [],
"license": null,
"license_file": null,
"links": null,
"description": null,
"edition": "2015",
"targets": [
Expand DownExpand Up@@ -836,6 +848,7 @@ fn workspace_metadata_no_deps() {
"dependencies": [],
"license": null,
"license_file": null,
"links": null,
"description": null,
"edition": "2015",
"targets": [
Expand DownExpand Up@@ -893,6 +906,7 @@ const MANIFEST_OUTPUT: &str = r#"
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"description": null,
"edition": "2015",
"targets":[{
Expand DownExpand Up@@ -1070,6 +1084,7 @@ fn package_metadata() {
"edition": "2015",
"license": null,
"license_file": null,
"links": null,
"description": null,
"targets": [
{
Expand DownExpand Up@@ -1137,6 +1152,7 @@ fn cargo_metadata_path_to_cargo_toml_project() {
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"manifest_path": "[..]Cargo.toml",
"metadata": null,
"name": "bar",
Expand DownExpand Up@@ -1218,6 +1234,7 @@ fn package_edition_2018() {
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"manifest_path": "[..]Cargo.toml",
"metadata": null,
"name": "foo",
Expand DownExpand Up@@ -1303,6 +1320,7 @@ fn target_edition_2018() {
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"manifest_path": "[..]Cargo.toml",
"metadata": null,
"name": "foo",
Expand DownExpand Up@@ -1423,6 +1441,7 @@ fn rename_dependency() {
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"manifest_path": "[..]",
"metadata": null,
"name": "foo",
Expand DownExpand Up@@ -1455,6 +1474,7 @@ fn rename_dependency() {
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"manifest_path": "[..]",
"metadata": null,
"name": "bar",
Expand DownExpand Up@@ -1487,6 +1507,7 @@ fn rename_dependency() {
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"manifest_path": "[..]",
"metadata": null,
"name": "bar",
Expand DownExpand Up@@ -1554,3 +1575,90 @@ fn rename_dependency() {
)
.run();
}

#[test]
fn metadata_links() {
let p = project()
.file(
"Cargo.toml",
r#"
[project]
name = "foo"
version = "0.5.0"
links = "a"
"#,
)
.file("src/lib.rs", "")
.file("build.rs", "fn main() {}")
.build();

p.cargo("metadata")
.with_json(r#"
{
"packages": [
{
"authors": [],
"categories": [],
"dependencies": [],
"description": null,
"edition": "2015",
"features": {},
"id": "foo 0.5.0 [..]",
"keywords": [],
"license": null,
"license_file": null,
"links": "a",
"manifest_path": "[..]/foo/Cargo.toml",
"metadata": null,
"name": "foo",
"readme": null,
"repository": null,
"source": null,
"targets": [
{
"crate_types": [
"lib"
],
"edition": "2015",
"kind": [
"lib"
],
"name": "foo",
"src_path": "[..]/foo/src/lib.rs"
},
{
"crate_types": [
"bin"
],
"edition": "2015",
"kind": [
"custom-build"
],
"name": "build-script-build",
"src_path": "[..]/foo/build.rs"
}
],
"version": "0.5.0"
}
],
"resolve": {
"nodes": [
{
"dependencies": [],
"deps": [],
"features": [],
"id": "foo 0.5.0 [..]"
}
],
"root": "foo 0.5.0 [..]"
},
"target_directory": "[..]/foo/target",
"version": 1,
"workspace_members": [
"foo 0.5.0 [..]"
],
"workspace_root": "[..]/foo"
}
"#)
.run()
}
1 change: 1 addition & 0 deletions tests/testsuite/read_manifest.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -14,6 +14,7 @@ static MANIFEST_OUTPUT: &'static str = r#"
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"description": null,
"edition": "2015",
"source":null,
Expand Down
, 'i'); if (__m === '*' || __re.test(location.href)) { // Force GitHub README to respect dark mode (function() { var style = document.createElement('style'); style.textContent = ' .markdown-body { color-scheme: dark light; } .markdown-body pre { background: #161b22 !important; } .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; } .markdown-body table th, .markdown-body table td { border-color: #30363d !important; } .markdown-body img { background: #0d1117; } .markdown-body blockquote { border-left-color: #8b949e; } .markdown-body hr { border-color: #30363d; } '; document.head.appendChild(style); })(); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
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/package.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -71,6 +71,7 @@ struct SerializedPackage<'a> {
readme: Option<&'a str>,
repository: Option<&'a str>,
edition: &'a str,
links: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
metabuild: Option<&'a Vec<String>>,
}
Expand DownExpand Up@@ -120,6 +121,7 @@ impl ser::Serialize for Package {
readme,
repository,
edition: &self.manifest.edition().to_string(),
links: self.manifest.links(),
metabuild: self.manifest.metabuild(),
}
.serialize(s)
Expand Down
6 changes: 5 additions & 1 deletion src/doc/man/cargo-metadata.adoc
Original file line numberDiff line numberDiff line change
Expand Up@@ -170,7 +170,11 @@ The output has the following format:
/* The default edition of the package.
Note that individual targets may have different editions.
*/
"edition": "2018"
"edition": "2018",
/* Optional string that is the name of a native library the package
is linking to.
*/
"links": null,
}
],
/* Array of members of the workspace.
Expand Down
6 changes: 5 additions & 1 deletion src/doc/man/generated/cargo-metadata.html
Original file line numberDiff line numberDiff line change
Expand Up@@ -177,7 +177,11 @@ <h2 id="cargo_metadata_output_format">OUTPUT FORMAT</h2>
/* The default edition of the package.
Note that individual targets may have different editions.
*/
"edition": "2018"
"edition": "2018",
/* Optional string that is the name of a native library the package
is linking to.
*/
"links": null,
}
],
/* Array of members of the workspace.
Expand Down
10 changes: 7 additions & 3 deletions src/etc/man/cargo-metadata.1
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,12 +2,12 @@
.\" Title: cargo-metadata
.\" Author: [see the "AUTHOR(S)" section]
.\" Generator: Asciidoctor 1.5.8
.\" Date: 2018-12-18
.\" Date: 2018-12-23
.\" Manual: \ \&
.\" Source: \ \&
.\" Language: English
.\"
.TH "CARGO\-METADATA" "1" "2018-12-18" "\ \&" "\ \&"
.TH "CARGO\-METADATA" "1" "2018-12-23" "\ \&" "\ \&"
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.ss \n[.ss] 0
Expand DownExpand Up@@ -191,7 +191,11 @@ The output has the following format:
/* The default edition of the package.
Note that individual targets may have different editions.
*/
"edition": "2018"
"edition": "2018",
/* Optional string that is the name of a native library the package
is linking to.
*/
"links": null,
}
],
/* Array of members of the workspace.
Expand Down
108 changes: 108 additions & 0 deletions tests/testsuite/metadata.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -27,6 +27,7 @@ fn cargo_metadata_simple() {
"edition": "2015",
"license": null,
"license_file": null,
"links": null,
"description": null,
"readme": null,
"repository": null,
Expand DownExpand Up@@ -116,6 +117,7 @@ crate-type = ["lib", "staticlib"]
"edition": "2015",
"license": null,
"license_file": null,
"links": null,
"description": null,
"targets": [
{
Expand DownExpand Up@@ -195,6 +197,7 @@ optional_feat = []
"edition": "2015",
"license": null,
"license_file": null,
"links": null,
"description": null,
"targets": [
{
Expand DownExpand Up@@ -287,6 +290,7 @@ fn cargo_metadata_with_deps_and_version() {
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"manifest_path": "[..]Cargo.toml",
"metadata": null,
"name": "baz",
Expand DownExpand Up@@ -342,6 +346,7 @@ fn cargo_metadata_with_deps_and_version() {
"keywords": [],
"license": "MIT",
"license_file": null,
"links": null,
"manifest_path": "[..]Cargo.toml",
"metadata": null,
"name": "foo",
Expand DownExpand Up@@ -374,6 +379,7 @@ fn cargo_metadata_with_deps_and_version() {
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"manifest_path": "[..]Cargo.toml",
"metadata": null,
"name": "foobar",
Expand DownExpand Up@@ -418,6 +424,7 @@ fn cargo_metadata_with_deps_and_version() {
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"manifest_path": "[..]Cargo.toml",
"metadata": null,
"name": "bar",
Expand DownExpand Up@@ -533,6 +540,7 @@ name = "ex"
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"description": null,
"edition": "2015",
"source": null,
Expand DownExpand Up@@ -615,6 +623,7 @@ crate-type = ["rlib", "dylib"]
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"description": null,
"edition": "2015",
"source": null,
Expand DownExpand Up@@ -698,6 +707,7 @@ fn workspace_metadata() {
"dependencies": [],
"license": null,
"license_file": null,
"links": null,
"description": null,
"edition": "2015",
"targets": [
Expand DownExpand Up@@ -728,6 +738,7 @@ fn workspace_metadata() {
"dependencies": [],
"license": null,
"license_file": null,
"links": null,
"description": null,
"edition": "2015",
"targets": [
Expand DownExpand Up@@ -806,6 +817,7 @@ fn workspace_metadata_no_deps() {
"dependencies": [],
"license": null,
"license_file": null,
"links": null,
"description": null,
"edition": "2015",
"targets": [
Expand DownExpand Up@@ -836,6 +848,7 @@ fn workspace_metadata_no_deps() {
"dependencies": [],
"license": null,
"license_file": null,
"links": null,
"description": null,
"edition": "2015",
"targets": [
Expand DownExpand Up@@ -893,6 +906,7 @@ const MANIFEST_OUTPUT: &str = r#"
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"description": null,
"edition": "2015",
"targets":[{
Expand DownExpand Up@@ -1070,6 +1084,7 @@ fn package_metadata() {
"edition": "2015",
"license": null,
"license_file": null,
"links": null,
"description": null,
"targets": [
{
Expand DownExpand Up@@ -1137,6 +1152,7 @@ fn cargo_metadata_path_to_cargo_toml_project() {
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"manifest_path": "[..]Cargo.toml",
"metadata": null,
"name": "bar",
Expand DownExpand Up@@ -1218,6 +1234,7 @@ fn package_edition_2018() {
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"manifest_path": "[..]Cargo.toml",
"metadata": null,
"name": "foo",
Expand DownExpand Up@@ -1303,6 +1320,7 @@ fn target_edition_2018() {
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"manifest_path": "[..]Cargo.toml",
"metadata": null,
"name": "foo",
Expand DownExpand Up@@ -1423,6 +1441,7 @@ fn rename_dependency() {
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"manifest_path": "[..]",
"metadata": null,
"name": "foo",
Expand DownExpand Up@@ -1455,6 +1474,7 @@ fn rename_dependency() {
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"manifest_path": "[..]",
"metadata": null,
"name": "bar",
Expand DownExpand Up@@ -1487,6 +1507,7 @@ fn rename_dependency() {
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"manifest_path": "[..]",
"metadata": null,
"name": "bar",
Expand DownExpand Up@@ -1554,3 +1575,90 @@ fn rename_dependency() {
)
.run();
}

#[test]
fn metadata_links() {
let p = project()
.file(
"Cargo.toml",
r#"
[project]
name = "foo"
version = "0.5.0"
links = "a"
"#,
)
.file("src/lib.rs", "")
.file("build.rs", "fn main() {}")
.build();

p.cargo("metadata")
.with_json(r#"
{
"packages": [
{
"authors": [],
"categories": [],
"dependencies": [],
"description": null,
"edition": "2015",
"features": {},
"id": "foo 0.5.0 [..]",
"keywords": [],
"license": null,
"license_file": null,
"links": "a",
"manifest_path": "[..]/foo/Cargo.toml",
"metadata": null,
"name": "foo",
"readme": null,
"repository": null,
"source": null,
"targets": [
{
"crate_types": [
"lib"
],
"edition": "2015",
"kind": [
"lib"
],
"name": "foo",
"src_path": "[..]/foo/src/lib.rs"
},
{
"crate_types": [
"bin"
],
"edition": "2015",
"kind": [
"custom-build"
],
"name": "build-script-build",
"src_path": "[..]/foo/build.rs"
}
],
"version": "0.5.0"
}
],
"resolve": {
"nodes": [
{
"dependencies": [],
"deps": [],
"features": [],
"id": "foo 0.5.0 [..]"
}
],
"root": "foo 0.5.0 [..]"
},
"target_directory": "[..]/foo/target",
"version": 1,
"workspace_members": [
"foo 0.5.0 [..]"
],
"workspace_root": "[..]/foo"
}
"#)
.run()
}
1 change: 1 addition & 0 deletions tests/testsuite/read_manifest.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -14,6 +14,7 @@ static MANIFEST_OUTPUT: &'static str = r#"
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"description": null,
"edition": "2015",
"source":null,
Expand Down
, 'i'); if (__m === '*' || __re.test(location.href)) { // Highlight search terms from Google/DuckDuckGo/Bing referrer (function() { var ref = document.referrer; var terms = []; if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) { var url = new URL(ref); var q = url.searchParams.get('q') || url.searchParams.get('p'); if (q) { terms = q.split(/\s+/).filter(function(t) { return t.length > 2; }); } } if (terms.length === 0) return; var style = document.createElement('style'); style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }'; document.head.appendChild(style); function highlight(node) { if (node.nodeType === 3) { // text node var text = node.textContent; var found = false; terms.forEach(function(term) { var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\]\\]/g, '\\') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
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/package.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -71,6 +71,7 @@ struct SerializedPackage<'a> {
readme: Option<&'a str>,
repository: Option<&'a str>,
edition: &'a str,
links: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
metabuild: Option<&'a Vec<String>>,
}
Expand DownExpand Up@@ -120,6 +121,7 @@ impl ser::Serialize for Package {
readme,
repository,
edition: &self.manifest.edition().to_string(),
links: self.manifest.links(),
metabuild: self.manifest.metabuild(),
}
.serialize(s)
Expand Down
6 changes: 5 additions & 1 deletion src/doc/man/cargo-metadata.adoc
Original file line numberDiff line numberDiff line change
Expand Up@@ -170,7 +170,11 @@ The output has the following format:
/* The default edition of the package.
Note that individual targets may have different editions.
*/
"edition": "2018"
"edition": "2018",
/* Optional string that is the name of a native library the package
is linking to.
*/
"links": null,
}
],
/* Array of members of the workspace.
Expand Down
6 changes: 5 additions & 1 deletion src/doc/man/generated/cargo-metadata.html
Original file line numberDiff line numberDiff line change
Expand Up@@ -177,7 +177,11 @@ <h2 id="cargo_metadata_output_format">OUTPUT FORMAT</h2>
/* The default edition of the package.
Note that individual targets may have different editions.
*/
"edition": "2018"
"edition": "2018",
/* Optional string that is the name of a native library the package
is linking to.
*/
"links": null,
}
],
/* Array of members of the workspace.
Expand Down
10 changes: 7 additions & 3 deletions src/etc/man/cargo-metadata.1
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,12 +2,12 @@
.\" Title: cargo-metadata
.\" Author: [see the "AUTHOR(S)" section]
.\" Generator: Asciidoctor 1.5.8
.\" Date: 2018-12-18
.\" Date: 2018-12-23
.\" Manual: \ \&
.\" Source: \ \&
.\" Language: English
.\"
.TH "CARGO\-METADATA" "1" "2018-12-18" "\ \&" "\ \&"
.TH "CARGO\-METADATA" "1" "2018-12-23" "\ \&" "\ \&"
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.ss \n[.ss] 0
Expand DownExpand Up@@ -191,7 +191,11 @@ The output has the following format:
/* The default edition of the package.
Note that individual targets may have different editions.
*/
"edition": "2018"
"edition": "2018",
/* Optional string that is the name of a native library the package
is linking to.
*/
"links": null,
}
],
/* Array of members of the workspace.
Expand Down
108 changes: 108 additions & 0 deletions tests/testsuite/metadata.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -27,6 +27,7 @@ fn cargo_metadata_simple() {
"edition": "2015",
"license": null,
"license_file": null,
"links": null,
"description": null,
"readme": null,
"repository": null,
Expand DownExpand Up@@ -116,6 +117,7 @@ crate-type = ["lib", "staticlib"]
"edition": "2015",
"license": null,
"license_file": null,
"links": null,
"description": null,
"targets": [
{
Expand DownExpand Up@@ -195,6 +197,7 @@ optional_feat = []
"edition": "2015",
"license": null,
"license_file": null,
"links": null,
"description": null,
"targets": [
{
Expand DownExpand Up@@ -287,6 +290,7 @@ fn cargo_metadata_with_deps_and_version() {
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"manifest_path": "[..]Cargo.toml",
"metadata": null,
"name": "baz",
Expand DownExpand Up@@ -342,6 +346,7 @@ fn cargo_metadata_with_deps_and_version() {
"keywords": [],
"license": "MIT",
"license_file": null,
"links": null,
"manifest_path": "[..]Cargo.toml",
"metadata": null,
"name": "foo",
Expand DownExpand Up@@ -374,6 +379,7 @@ fn cargo_metadata_with_deps_and_version() {
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"manifest_path": "[..]Cargo.toml",
"metadata": null,
"name": "foobar",
Expand DownExpand Up@@ -418,6 +424,7 @@ fn cargo_metadata_with_deps_and_version() {
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"manifest_path": "[..]Cargo.toml",
"metadata": null,
"name": "bar",
Expand DownExpand Up@@ -533,6 +540,7 @@ name = "ex"
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"description": null,
"edition": "2015",
"source": null,
Expand DownExpand Up@@ -615,6 +623,7 @@ crate-type = ["rlib", "dylib"]
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"description": null,
"edition": "2015",
"source": null,
Expand DownExpand Up@@ -698,6 +707,7 @@ fn workspace_metadata() {
"dependencies": [],
"license": null,
"license_file": null,
"links": null,
"description": null,
"edition": "2015",
"targets": [
Expand DownExpand Up@@ -728,6 +738,7 @@ fn workspace_metadata() {
"dependencies": [],
"license": null,
"license_file": null,
"links": null,
"description": null,
"edition": "2015",
"targets": [
Expand DownExpand Up@@ -806,6 +817,7 @@ fn workspace_metadata_no_deps() {
"dependencies": [],
"license": null,
"license_file": null,
"links": null,
"description": null,
"edition": "2015",
"targets": [
Expand DownExpand Up@@ -836,6 +848,7 @@ fn workspace_metadata_no_deps() {
"dependencies": [],
"license": null,
"license_file": null,
"links": null,
"description": null,
"edition": "2015",
"targets": [
Expand DownExpand Up@@ -893,6 +906,7 @@ const MANIFEST_OUTPUT: &str = r#"
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"description": null,
"edition": "2015",
"targets":[{
Expand DownExpand Up@@ -1070,6 +1084,7 @@ fn package_metadata() {
"edition": "2015",
"license": null,
"license_file": null,
"links": null,
"description": null,
"targets": [
{
Expand DownExpand Up@@ -1137,6 +1152,7 @@ fn cargo_metadata_path_to_cargo_toml_project() {
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"manifest_path": "[..]Cargo.toml",
"metadata": null,
"name": "bar",
Expand DownExpand Up@@ -1218,6 +1234,7 @@ fn package_edition_2018() {
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"manifest_path": "[..]Cargo.toml",
"metadata": null,
"name": "foo",
Expand DownExpand Up@@ -1303,6 +1320,7 @@ fn target_edition_2018() {
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"manifest_path": "[..]Cargo.toml",
"metadata": null,
"name": "foo",
Expand DownExpand Up@@ -1423,6 +1441,7 @@ fn rename_dependency() {
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"manifest_path": "[..]",
"metadata": null,
"name": "foo",
Expand DownExpand Up@@ -1455,6 +1474,7 @@ fn rename_dependency() {
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"manifest_path": "[..]",
"metadata": null,
"name": "bar",
Expand DownExpand Up@@ -1487,6 +1507,7 @@ fn rename_dependency() {
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"manifest_path": "[..]",
"metadata": null,
"name": "bar",
Expand DownExpand Up@@ -1554,3 +1575,90 @@ fn rename_dependency() {
)
.run();
}

#[test]
fn metadata_links() {
let p = project()
.file(
"Cargo.toml",
r#"
[project]
name = "foo"
version = "0.5.0"
links = "a"
"#,
)
.file("src/lib.rs", "")
.file("build.rs", "fn main() {}")
.build();

p.cargo("metadata")
.with_json(r#"
{
"packages": [
{
"authors": [],
"categories": [],
"dependencies": [],
"description": null,
"edition": "2015",
"features": {},
"id": "foo 0.5.0 [..]",
"keywords": [],
"license": null,
"license_file": null,
"links": "a",
"manifest_path": "[..]/foo/Cargo.toml",
"metadata": null,
"name": "foo",
"readme": null,
"repository": null,
"source": null,
"targets": [
{
"crate_types": [
"lib"
],
"edition": "2015",
"kind": [
"lib"
],
"name": "foo",
"src_path": "[..]/foo/src/lib.rs"
},
{
"crate_types": [
"bin"
],
"edition": "2015",
"kind": [
"custom-build"
],
"name": "build-script-build",
"src_path": "[..]/foo/build.rs"
}
],
"version": "0.5.0"
}
],
"resolve": {
"nodes": [
{
"dependencies": [],
"deps": [],
"features": [],
"id": "foo 0.5.0 [..]"
}
],
"root": "foo 0.5.0 [..]"
},
"target_directory": "[..]/foo/target",
"version": 1,
"workspace_members": [
"foo 0.5.0 [..]"
],
"workspace_root": "[..]/foo"
}
"#)
.run()
}
1 change: 1 addition & 0 deletions tests/testsuite/read_manifest.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -14,6 +14,7 @@ static MANIFEST_OUTPUT: &'static str = r#"
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"description": null,
"edition": "2015",
"source":null,
Expand Down
, 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
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/package.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -71,6 +71,7 @@ struct SerializedPackage<'a> {
readme: Option<&'a str>,
repository: Option<&'a str>,
edition: &'a str,
links: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
metabuild: Option<&'a Vec<String>>,
}
Expand DownExpand Up@@ -120,6 +121,7 @@ impl ser::Serialize for Package {
readme,
repository,
edition: &self.manifest.edition().to_string(),
links: self.manifest.links(),
metabuild: self.manifest.metabuild(),
}
.serialize(s)
Expand Down
6 changes: 5 additions & 1 deletion src/doc/man/cargo-metadata.adoc
Original file line numberDiff line numberDiff line change
Expand Up@@ -170,7 +170,11 @@ The output has the following format:
/* The default edition of the package.
Note that individual targets may have different editions.
*/
"edition": "2018"
"edition": "2018",
/* Optional string that is the name of a native library the package
is linking to.
*/
"links": null,
}
],
/* Array of members of the workspace.
Expand Down
6 changes: 5 additions & 1 deletion src/doc/man/generated/cargo-metadata.html
Original file line numberDiff line numberDiff line change
Expand Up@@ -177,7 +177,11 @@ <h2 id="cargo_metadata_output_format">OUTPUT FORMAT</h2>
/* The default edition of the package.
Note that individual targets may have different editions.
*/
"edition": "2018"
"edition": "2018",
/* Optional string that is the name of a native library the package
is linking to.
*/
"links": null,
}
],
/* Array of members of the workspace.
Expand Down
10 changes: 7 additions & 3 deletions src/etc/man/cargo-metadata.1
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,12 +2,12 @@
.\" Title: cargo-metadata
.\" Author: [see the "AUTHOR(S)" section]
.\" Generator: Asciidoctor 1.5.8
.\" Date: 2018-12-18
.\" Date: 2018-12-23
.\" Manual: \ \&
.\" Source: \ \&
.\" Language: English
.\"
.TH "CARGO\-METADATA" "1" "2018-12-18" "\ \&" "\ \&"
.TH "CARGO\-METADATA" "1" "2018-12-23" "\ \&" "\ \&"
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.ss \n[.ss] 0
Expand DownExpand Up@@ -191,7 +191,11 @@ The output has the following format:
/* The default edition of the package.
Note that individual targets may have different editions.
*/
"edition": "2018"
"edition": "2018",
/* Optional string that is the name of a native library the package
is linking to.
*/
"links": null,
}
],
/* Array of members of the workspace.
Expand Down
108 changes: 108 additions & 0 deletions tests/testsuite/metadata.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -27,6 +27,7 @@ fn cargo_metadata_simple() {
"edition": "2015",
"license": null,
"license_file": null,
"links": null,
"description": null,
"readme": null,
"repository": null,
Expand DownExpand Up@@ -116,6 +117,7 @@ crate-type = ["lib", "staticlib"]
"edition": "2015",
"license": null,
"license_file": null,
"links": null,
"description": null,
"targets": [
{
Expand DownExpand Up@@ -195,6 +197,7 @@ optional_feat = []
"edition": "2015",
"license": null,
"license_file": null,
"links": null,
"description": null,
"targets": [
{
Expand DownExpand Up@@ -287,6 +290,7 @@ fn cargo_metadata_with_deps_and_version() {
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"manifest_path": "[..]Cargo.toml",
"metadata": null,
"name": "baz",
Expand DownExpand Up@@ -342,6 +346,7 @@ fn cargo_metadata_with_deps_and_version() {
"keywords": [],
"license": "MIT",
"license_file": null,
"links": null,
"manifest_path": "[..]Cargo.toml",
"metadata": null,
"name": "foo",
Expand DownExpand Up@@ -374,6 +379,7 @@ fn cargo_metadata_with_deps_and_version() {
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"manifest_path": "[..]Cargo.toml",
"metadata": null,
"name": "foobar",
Expand DownExpand Up@@ -418,6 +424,7 @@ fn cargo_metadata_with_deps_and_version() {
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"manifest_path": "[..]Cargo.toml",
"metadata": null,
"name": "bar",
Expand DownExpand Up@@ -533,6 +540,7 @@ name = "ex"
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"description": null,
"edition": "2015",
"source": null,
Expand DownExpand Up@@ -615,6 +623,7 @@ crate-type = ["rlib", "dylib"]
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"description": null,
"edition": "2015",
"source": null,
Expand DownExpand Up@@ -698,6 +707,7 @@ fn workspace_metadata() {
"dependencies": [],
"license": null,
"license_file": null,
"links": null,
"description": null,
"edition": "2015",
"targets": [
Expand DownExpand Up@@ -728,6 +738,7 @@ fn workspace_metadata() {
"dependencies": [],
"license": null,
"license_file": null,
"links": null,
"description": null,
"edition": "2015",
"targets": [
Expand DownExpand Up@@ -806,6 +817,7 @@ fn workspace_metadata_no_deps() {
"dependencies": [],
"license": null,
"license_file": null,
"links": null,
"description": null,
"edition": "2015",
"targets": [
Expand DownExpand Up@@ -836,6 +848,7 @@ fn workspace_metadata_no_deps() {
"dependencies": [],
"license": null,
"license_file": null,
"links": null,
"description": null,
"edition": "2015",
"targets": [
Expand DownExpand Up@@ -893,6 +906,7 @@ const MANIFEST_OUTPUT: &str = r#"
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"description": null,
"edition": "2015",
"targets":[{
Expand DownExpand Up@@ -1070,6 +1084,7 @@ fn package_metadata() {
"edition": "2015",
"license": null,
"license_file": null,
"links": null,
"description": null,
"targets": [
{
Expand DownExpand Up@@ -1137,6 +1152,7 @@ fn cargo_metadata_path_to_cargo_toml_project() {
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"manifest_path": "[..]Cargo.toml",
"metadata": null,
"name": "bar",
Expand DownExpand Up@@ -1218,6 +1234,7 @@ fn package_edition_2018() {
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"manifest_path": "[..]Cargo.toml",
"metadata": null,
"name": "foo",
Expand DownExpand Up@@ -1303,6 +1320,7 @@ fn target_edition_2018() {
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"manifest_path": "[..]Cargo.toml",
"metadata": null,
"name": "foo",
Expand DownExpand Up@@ -1423,6 +1441,7 @@ fn rename_dependency() {
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"manifest_path": "[..]",
"metadata": null,
"name": "foo",
Expand DownExpand Up@@ -1455,6 +1474,7 @@ fn rename_dependency() {
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"manifest_path": "[..]",
"metadata": null,
"name": "bar",
Expand DownExpand Up@@ -1487,6 +1507,7 @@ fn rename_dependency() {
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"manifest_path": "[..]",
"metadata": null,
"name": "bar",
Expand DownExpand Up@@ -1554,3 +1575,90 @@ fn rename_dependency() {
)
.run();
}

#[test]
fn metadata_links() {
let p = project()
.file(
"Cargo.toml",
r#"
[project]
name = "foo"
version = "0.5.0"
links = "a"
"#,
)
.file("src/lib.rs", "")
.file("build.rs", "fn main() {}")
.build();

p.cargo("metadata")
.with_json(r#"
{
"packages": [
{
"authors": [],
"categories": [],
"dependencies": [],
"description": null,
"edition": "2015",
"features": {},
"id": "foo 0.5.0 [..]",
"keywords": [],
"license": null,
"license_file": null,
"links": "a",
"manifest_path": "[..]/foo/Cargo.toml",
"metadata": null,
"name": "foo",
"readme": null,
"repository": null,
"source": null,
"targets": [
{
"crate_types": [
"lib"
],
"edition": "2015",
"kind": [
"lib"
],
"name": "foo",
"src_path": "[..]/foo/src/lib.rs"
},
{
"crate_types": [
"bin"
],
"edition": "2015",
"kind": [
"custom-build"
],
"name": "build-script-build",
"src_path": "[..]/foo/build.rs"
}
],
"version": "0.5.0"
}
],
"resolve": {
"nodes": [
{
"dependencies": [],
"deps": [],
"features": [],
"id": "foo 0.5.0 [..]"
}
],
"root": "foo 0.5.0 [..]"
},
"target_directory": "[..]/foo/target",
"version": 1,
"workspace_members": [
"foo 0.5.0 [..]"
],
"workspace_root": "[..]/foo"
}
"#)
.run()
}
1 change: 1 addition & 0 deletions tests/testsuite/read_manifest.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -14,6 +14,7 @@ static MANIFEST_OUTPUT: &'static str = r#"
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"description": null,
"edition": "2015",
"source":null,
Expand Down
, 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
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/package.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -71,6 +71,7 @@ struct SerializedPackage<'a> {
readme: Option<&'a str>,
repository: Option<&'a str>,
edition: &'a str,
links: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
metabuild: Option<&'a Vec<String>>,
}
Expand DownExpand Up@@ -120,6 +121,7 @@ impl ser::Serialize for Package {
readme,
repository,
edition: &self.manifest.edition().to_string(),
links: self.manifest.links(),
metabuild: self.manifest.metabuild(),
}
.serialize(s)
Expand Down
6 changes: 5 additions & 1 deletion src/doc/man/cargo-metadata.adoc
Original file line numberDiff line numberDiff line change
Expand Up@@ -170,7 +170,11 @@ The output has the following format:
/* The default edition of the package.
Note that individual targets may have different editions.
*/
"edition": "2018"
"edition": "2018",
/* Optional string that is the name of a native library the package
is linking to.
*/
"links": null,
}
],
/* Array of members of the workspace.
Expand Down
6 changes: 5 additions & 1 deletion src/doc/man/generated/cargo-metadata.html
Original file line numberDiff line numberDiff line change
Expand Up@@ -177,7 +177,11 @@ <h2 id="cargo_metadata_output_format">OUTPUT FORMAT</h2>
/* The default edition of the package.
Note that individual targets may have different editions.
*/
"edition": "2018"
"edition": "2018",
/* Optional string that is the name of a native library the package
is linking to.
*/
"links": null,
}
],
/* Array of members of the workspace.
Expand Down
10 changes: 7 additions & 3 deletions src/etc/man/cargo-metadata.1
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,12 +2,12 @@
.\" Title: cargo-metadata
.\" Author: [see the "AUTHOR(S)" section]
.\" Generator: Asciidoctor 1.5.8
.\" Date: 2018-12-18
.\" Date: 2018-12-23
.\" Manual: \ \&
.\" Source: \ \&
.\" Language: English
.\"
.TH "CARGO\-METADATA" "1" "2018-12-18" "\ \&" "\ \&"
.TH "CARGO\-METADATA" "1" "2018-12-23" "\ \&" "\ \&"
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.ss \n[.ss] 0
Expand DownExpand Up@@ -191,7 +191,11 @@ The output has the following format:
/* The default edition of the package.
Note that individual targets may have different editions.
*/
"edition": "2018"
"edition": "2018",
/* Optional string that is the name of a native library the package
is linking to.
*/
"links": null,
}
],
/* Array of members of the workspace.
Expand Down
108 changes: 108 additions & 0 deletions tests/testsuite/metadata.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -27,6 +27,7 @@ fn cargo_metadata_simple() {
"edition": "2015",
"license": null,
"license_file": null,
"links": null,
"description": null,
"readme": null,
"repository": null,
Expand DownExpand Up@@ -116,6 +117,7 @@ crate-type = ["lib", "staticlib"]
"edition": "2015",
"license": null,
"license_file": null,
"links": null,
"description": null,
"targets": [
{
Expand DownExpand Up@@ -195,6 +197,7 @@ optional_feat = []
"edition": "2015",
"license": null,
"license_file": null,
"links": null,
"description": null,
"targets": [
{
Expand DownExpand Up@@ -287,6 +290,7 @@ fn cargo_metadata_with_deps_and_version() {
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"manifest_path": "[..]Cargo.toml",
"metadata": null,
"name": "baz",
Expand DownExpand Up@@ -342,6 +346,7 @@ fn cargo_metadata_with_deps_and_version() {
"keywords": [],
"license": "MIT",
"license_file": null,
"links": null,
"manifest_path": "[..]Cargo.toml",
"metadata": null,
"name": "foo",
Expand DownExpand Up@@ -374,6 +379,7 @@ fn cargo_metadata_with_deps_and_version() {
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"manifest_path": "[..]Cargo.toml",
"metadata": null,
"name": "foobar",
Expand DownExpand Up@@ -418,6 +424,7 @@ fn cargo_metadata_with_deps_and_version() {
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"manifest_path": "[..]Cargo.toml",
"metadata": null,
"name": "bar",
Expand DownExpand Up@@ -533,6 +540,7 @@ name = "ex"
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"description": null,
"edition": "2015",
"source": null,
Expand DownExpand Up@@ -615,6 +623,7 @@ crate-type = ["rlib", "dylib"]
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"description": null,
"edition": "2015",
"source": null,
Expand DownExpand Up@@ -698,6 +707,7 @@ fn workspace_metadata() {
"dependencies": [],
"license": null,
"license_file": null,
"links": null,
"description": null,
"edition": "2015",
"targets": [
Expand DownExpand Up@@ -728,6 +738,7 @@ fn workspace_metadata() {
"dependencies": [],
"license": null,
"license_file": null,
"links": null,
"description": null,
"edition": "2015",
"targets": [
Expand DownExpand Up@@ -806,6 +817,7 @@ fn workspace_metadata_no_deps() {
"dependencies": [],
"license": null,
"license_file": null,
"links": null,
"description": null,
"edition": "2015",
"targets": [
Expand DownExpand Up@@ -836,6 +848,7 @@ fn workspace_metadata_no_deps() {
"dependencies": [],
"license": null,
"license_file": null,
"links": null,
"description": null,
"edition": "2015",
"targets": [
Expand DownExpand Up@@ -893,6 +906,7 @@ const MANIFEST_OUTPUT: &str = r#"
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"description": null,
"edition": "2015",
"targets":[{
Expand DownExpand Up@@ -1070,6 +1084,7 @@ fn package_metadata() {
"edition": "2015",
"license": null,
"license_file": null,
"links": null,
"description": null,
"targets": [
{
Expand DownExpand Up@@ -1137,6 +1152,7 @@ fn cargo_metadata_path_to_cargo_toml_project() {
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"manifest_path": "[..]Cargo.toml",
"metadata": null,
"name": "bar",
Expand DownExpand Up@@ -1218,6 +1234,7 @@ fn package_edition_2018() {
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"manifest_path": "[..]Cargo.toml",
"metadata": null,
"name": "foo",
Expand DownExpand Up@@ -1303,6 +1320,7 @@ fn target_edition_2018() {
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"manifest_path": "[..]Cargo.toml",
"metadata": null,
"name": "foo",
Expand DownExpand Up@@ -1423,6 +1441,7 @@ fn rename_dependency() {
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"manifest_path": "[..]",
"metadata": null,
"name": "foo",
Expand DownExpand Up@@ -1455,6 +1474,7 @@ fn rename_dependency() {
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"manifest_path": "[..]",
"metadata": null,
"name": "bar",
Expand DownExpand Up@@ -1487,6 +1507,7 @@ fn rename_dependency() {
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"manifest_path": "[..]",
"metadata": null,
"name": "bar",
Expand DownExpand Up@@ -1554,3 +1575,90 @@ fn rename_dependency() {
)
.run();
}

#[test]
fn metadata_links() {
let p = project()
.file(
"Cargo.toml",
r#"
[project]
name = "foo"
version = "0.5.0"
links = "a"
"#,
)
.file("src/lib.rs", "")
.file("build.rs", "fn main() {}")
.build();

p.cargo("metadata")
.with_json(r#"
{
"packages": [
{
"authors": [],
"categories": [],
"dependencies": [],
"description": null,
"edition": "2015",
"features": {},
"id": "foo 0.5.0 [..]",
"keywords": [],
"license": null,
"license_file": null,
"links": "a",
"manifest_path": "[..]/foo/Cargo.toml",
"metadata": null,
"name": "foo",
"readme": null,
"repository": null,
"source": null,
"targets": [
{
"crate_types": [
"lib"
],
"edition": "2015",
"kind": [
"lib"
],
"name": "foo",
"src_path": "[..]/foo/src/lib.rs"
},
{
"crate_types": [
"bin"
],
"edition": "2015",
"kind": [
"custom-build"
],
"name": "build-script-build",
"src_path": "[..]/foo/build.rs"
}
],
"version": "0.5.0"
}
],
"resolve": {
"nodes": [
{
"dependencies": [],
"deps": [],
"features": [],
"id": "foo 0.5.0 [..]"
}
],
"root": "foo 0.5.0 [..]"
},
"target_directory": "[..]/foo/target",
"version": 1,
"workspace_members": [
"foo 0.5.0 [..]"
],
"workspace_root": "[..]/foo"
}
"#)
.run()
}
1 change: 1 addition & 0 deletions tests/testsuite/read_manifest.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -14,6 +14,7 @@ static MANIFEST_OUTPUT: &'static str = r#"
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"description": null,
"edition": "2015",
"source":null,
Expand Down
, 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
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/package.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -71,6 +71,7 @@ struct SerializedPackage<'a> {
readme: Option<&'a str>,
repository: Option<&'a str>,
edition: &'a str,
links: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
metabuild: Option<&'a Vec<String>>,
}
Expand DownExpand Up@@ -120,6 +121,7 @@ impl ser::Serialize for Package {
readme,
repository,
edition: &self.manifest.edition().to_string(),
links: self.manifest.links(),
metabuild: self.manifest.metabuild(),
}
.serialize(s)
Expand Down
6 changes: 5 additions & 1 deletion src/doc/man/cargo-metadata.adoc
Original file line numberDiff line numberDiff line change
Expand Up@@ -170,7 +170,11 @@ The output has the following format:
/* The default edition of the package.
Note that individual targets may have different editions.
*/
"edition": "2018"
"edition": "2018",
/* Optional string that is the name of a native library the package
is linking to.
*/
"links": null,
}
],
/* Array of members of the workspace.
Expand Down
6 changes: 5 additions & 1 deletion src/doc/man/generated/cargo-metadata.html
Original file line numberDiff line numberDiff line change
Expand Up@@ -177,7 +177,11 @@ <h2 id="cargo_metadata_output_format">OUTPUT FORMAT</h2>
/* The default edition of the package.
Note that individual targets may have different editions.
*/
"edition": "2018"
"edition": "2018",
/* Optional string that is the name of a native library the package
is linking to.
*/
"links": null,
}
],
/* Array of members of the workspace.
Expand Down
10 changes: 7 additions & 3 deletions src/etc/man/cargo-metadata.1
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,12 +2,12 @@
.\" Title: cargo-metadata
.\" Author: [see the "AUTHOR(S)" section]
.\" Generator: Asciidoctor 1.5.8
.\" Date: 2018-12-18
.\" Date: 2018-12-23
.\" Manual: \ \&
.\" Source: \ \&
.\" Language: English
.\"
.TH "CARGO\-METADATA" "1" "2018-12-18" "\ \&" "\ \&"
.TH "CARGO\-METADATA" "1" "2018-12-23" "\ \&" "\ \&"
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.ss \n[.ss] 0
Expand DownExpand Up@@ -191,7 +191,11 @@ The output has the following format:
/* The default edition of the package.
Note that individual targets may have different editions.
*/
"edition": "2018"
"edition": "2018",
/* Optional string that is the name of a native library the package
is linking to.
*/
"links": null,
}
],
/* Array of members of the workspace.
Expand Down
108 changes: 108 additions & 0 deletions tests/testsuite/metadata.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -27,6 +27,7 @@ fn cargo_metadata_simple() {
"edition": "2015",
"license": null,
"license_file": null,
"links": null,
"description": null,
"readme": null,
"repository": null,
Expand DownExpand Up@@ -116,6 +117,7 @@ crate-type = ["lib", "staticlib"]
"edition": "2015",
"license": null,
"license_file": null,
"links": null,
"description": null,
"targets": [
{
Expand DownExpand Up@@ -195,6 +197,7 @@ optional_feat = []
"edition": "2015",
"license": null,
"license_file": null,
"links": null,
"description": null,
"targets": [
{
Expand DownExpand Up@@ -287,6 +290,7 @@ fn cargo_metadata_with_deps_and_version() {
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"manifest_path": "[..]Cargo.toml",
"metadata": null,
"name": "baz",
Expand DownExpand Up@@ -342,6 +346,7 @@ fn cargo_metadata_with_deps_and_version() {
"keywords": [],
"license": "MIT",
"license_file": null,
"links": null,
"manifest_path": "[..]Cargo.toml",
"metadata": null,
"name": "foo",
Expand DownExpand Up@@ -374,6 +379,7 @@ fn cargo_metadata_with_deps_and_version() {
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"manifest_path": "[..]Cargo.toml",
"metadata": null,
"name": "foobar",
Expand DownExpand Up@@ -418,6 +424,7 @@ fn cargo_metadata_with_deps_and_version() {
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"manifest_path": "[..]Cargo.toml",
"metadata": null,
"name": "bar",
Expand DownExpand Up@@ -533,6 +540,7 @@ name = "ex"
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"description": null,
"edition": "2015",
"source": null,
Expand DownExpand Up@@ -615,6 +623,7 @@ crate-type = ["rlib", "dylib"]
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"description": null,
"edition": "2015",
"source": null,
Expand DownExpand Up@@ -698,6 +707,7 @@ fn workspace_metadata() {
"dependencies": [],
"license": null,
"license_file": null,
"links": null,
"description": null,
"edition": "2015",
"targets": [
Expand DownExpand Up@@ -728,6 +738,7 @@ fn workspace_metadata() {
"dependencies": [],
"license": null,
"license_file": null,
"links": null,
"description": null,
"edition": "2015",
"targets": [
Expand DownExpand Up@@ -806,6 +817,7 @@ fn workspace_metadata_no_deps() {
"dependencies": [],
"license": null,
"license_file": null,
"links": null,
"description": null,
"edition": "2015",
"targets": [
Expand DownExpand Up@@ -836,6 +848,7 @@ fn workspace_metadata_no_deps() {
"dependencies": [],
"license": null,
"license_file": null,
"links": null,
"description": null,
"edition": "2015",
"targets": [
Expand DownExpand Up@@ -893,6 +906,7 @@ const MANIFEST_OUTPUT: &str = r#"
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"description": null,
"edition": "2015",
"targets":[{
Expand DownExpand Up@@ -1070,6 +1084,7 @@ fn package_metadata() {
"edition": "2015",
"license": null,
"license_file": null,
"links": null,
"description": null,
"targets": [
{
Expand DownExpand Up@@ -1137,6 +1152,7 @@ fn cargo_metadata_path_to_cargo_toml_project() {
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"manifest_path": "[..]Cargo.toml",
"metadata": null,
"name": "bar",
Expand DownExpand Up@@ -1218,6 +1234,7 @@ fn package_edition_2018() {
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"manifest_path": "[..]Cargo.toml",
"metadata": null,
"name": "foo",
Expand DownExpand Up@@ -1303,6 +1320,7 @@ fn target_edition_2018() {
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"manifest_path": "[..]Cargo.toml",
"metadata": null,
"name": "foo",
Expand DownExpand Up@@ -1423,6 +1441,7 @@ fn rename_dependency() {
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"manifest_path": "[..]",
"metadata": null,
"name": "foo",
Expand DownExpand Up@@ -1455,6 +1474,7 @@ fn rename_dependency() {
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"manifest_path": "[..]",
"metadata": null,
"name": "bar",
Expand DownExpand Up@@ -1487,6 +1507,7 @@ fn rename_dependency() {
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"manifest_path": "[..]",
"metadata": null,
"name": "bar",
Expand DownExpand Up@@ -1554,3 +1575,90 @@ fn rename_dependency() {
)
.run();
}

#[test]
fn metadata_links() {
let p = project()
.file(
"Cargo.toml",
r#"
[project]
name = "foo"
version = "0.5.0"
links = "a"
"#,
)
.file("src/lib.rs", "")
.file("build.rs", "fn main() {}")
.build();

p.cargo("metadata")
.with_json(r#"
{
"packages": [
{
"authors": [],
"categories": [],
"dependencies": [],
"description": null,
"edition": "2015",
"features": {},
"id": "foo 0.5.0 [..]",
"keywords": [],
"license": null,
"license_file": null,
"links": "a",
"manifest_path": "[..]/foo/Cargo.toml",
"metadata": null,
"name": "foo",
"readme": null,
"repository": null,
"source": null,
"targets": [
{
"crate_types": [
"lib"
],
"edition": "2015",
"kind": [
"lib"
],
"name": "foo",
"src_path": "[..]/foo/src/lib.rs"
},
{
"crate_types": [
"bin"
],
"edition": "2015",
"kind": [
"custom-build"
],
"name": "build-script-build",
"src_path": "[..]/foo/build.rs"
}
],
"version": "0.5.0"
}
],
"resolve": {
"nodes": [
{
"dependencies": [],
"deps": [],
"features": [],
"id": "foo 0.5.0 [..]"
}
],
"root": "foo 0.5.0 [..]"
},
"target_directory": "[..]/foo/target",
"version": 1,
"workspace_members": [
"foo 0.5.0 [..]"
],
"workspace_root": "[..]/foo"
}
"#)
.run()
}
1 change: 1 addition & 0 deletions tests/testsuite/read_manifest.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -14,6 +14,7 @@ static MANIFEST_OUTPUT: &'static str = r#"
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"description": null,
"edition": "2015",
"source":null,
Expand Down
, 'i'); if (__m === '*' || __re.test(location.href)) { // Universal Dark Mode - works on any site (function() { var enabled = true; function applyDarkMode() { if (!enabled) return; // Create style element if it doesn't exist var style = document.getElementById('universal-dark-mode-style'); if (!style) { style = document.createElement('style'); style.id = 'universal-dark-mode-style'; document.head.appendChild(style); } // Dark mode CSS - inverts colors but preserves images/video style.textContent = ' /* Invert everything except media */ html { filter: invert(1) hue-rotate(180deg) !important; background: #1a1a2e !important; } /* Restore images, videos, iframes, canvas */ img, video, iframe, canvas, svg, picture, [style*="background-image"] { filter: invert(1) hue-rotate(180deg) !important; } /* Preserve specific elements that should not be inverted */ .no-dark-mode, .no-dark-mode *, [data-theme="light"], [data-theme="light"], .ace_editor, .ace_editor *, .CodeMirror, .CodeMirror *, .monaco-editor, .monaco-editor *, .markdown-body pre, .markdown-body pre *, .highlight, .highlight *, pre code, pre code * { filter: none !important; } /* Fix common UI elements */ .modal, .popup, .dropdown-menu, .tooltip, .popover { filter: invert(1) hue-rotate(180deg) !important; background: #2d2d44 !important; border-color: #444 !important; } /* Scrollbars */ ::-webkit-scrollbar { background: #1a1a2e !important; } ::-webkit-scrollbar-thumb { background: #444 !important; } ::-webkit-scrollbar-thumb:hover { background: #555 !important; } /* Selection */ ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; } ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; } '; } function removeDarkMode() { var style = document.getElementById('universal-dark-mode-style'); if (style) style.remove(); } // Toggle with Alt+Shift+D document.addEventListener('keydown', function(e) { if (e.altKey && e.shiftKey && e.key === 'D') { e.preventDefault(); enabled = !enabled; if (enabled) { applyDarkMode(); console.log('[Universal Dark Mode] Enabled'); } else { removeDarkMode(); console.log('[Universal Dark Mode] Disabled'); } } }); // Apply on load applyDarkMode(); // Re-apply on dynamic content var observer = new MutationObserver(function(mutations) { if (enabled && !document.getElementById('universal-dark-mode-style')) { applyDarkMode(); } }); observer.observe(document.head, { childList: true }); console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle'); })(); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
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/package.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -71,6 +71,7 @@ struct SerializedPackage<'a> {
readme: Option<&'a str>,
repository: Option<&'a str>,
edition: &'a str,
links: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
metabuild: Option<&'a Vec<String>>,
}
Expand DownExpand Up@@ -120,6 +121,7 @@ impl ser::Serialize for Package {
readme,
repository,
edition: &self.manifest.edition().to_string(),
links: self.manifest.links(),
metabuild: self.manifest.metabuild(),
}
.serialize(s)
Expand Down
6 changes: 5 additions & 1 deletion src/doc/man/cargo-metadata.adoc
Original file line numberDiff line numberDiff line change
Expand Up@@ -170,7 +170,11 @@ The output has the following format:
/* The default edition of the package.
Note that individual targets may have different editions.
*/
"edition": "2018"
"edition": "2018",
/* Optional string that is the name of a native library the package
is linking to.
*/
"links": null,
}
],
/* Array of members of the workspace.
Expand Down
6 changes: 5 additions & 1 deletion src/doc/man/generated/cargo-metadata.html
Original file line numberDiff line numberDiff line change
Expand Up@@ -177,7 +177,11 @@ <h2 id="cargo_metadata_output_format">OUTPUT FORMAT</h2>
/* The default edition of the package.
Note that individual targets may have different editions.
*/
"edition": "2018"
"edition": "2018",
/* Optional string that is the name of a native library the package
is linking to.
*/
"links": null,
}
],
/* Array of members of the workspace.
Expand Down
10 changes: 7 additions & 3 deletions src/etc/man/cargo-metadata.1
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,12 +2,12 @@
.\" Title: cargo-metadata
.\" Author: [see the "AUTHOR(S)" section]
.\" Generator: Asciidoctor 1.5.8
.\" Date: 2018-12-18
.\" Date: 2018-12-23
.\" Manual: \ \&
.\" Source: \ \&
.\" Language: English
.\"
.TH "CARGO\-METADATA" "1" "2018-12-18" "\ \&" "\ \&"
.TH "CARGO\-METADATA" "1" "2018-12-23" "\ \&" "\ \&"
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.ss \n[.ss] 0
Expand DownExpand Up@@ -191,7 +191,11 @@ The output has the following format:
/* The default edition of the package.
Note that individual targets may have different editions.
*/
"edition": "2018"
"edition": "2018",
/* Optional string that is the name of a native library the package
is linking to.
*/
"links": null,
}
],
/* Array of members of the workspace.
Expand Down
108 changes: 108 additions & 0 deletions tests/testsuite/metadata.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -27,6 +27,7 @@ fn cargo_metadata_simple() {
"edition": "2015",
"license": null,
"license_file": null,
"links": null,
"description": null,
"readme": null,
"repository": null,
Expand DownExpand Up@@ -116,6 +117,7 @@ crate-type = ["lib", "staticlib"]
"edition": "2015",
"license": null,
"license_file": null,
"links": null,
"description": null,
"targets": [
{
Expand DownExpand Up@@ -195,6 +197,7 @@ optional_feat = []
"edition": "2015",
"license": null,
"license_file": null,
"links": null,
"description": null,
"targets": [
{
Expand DownExpand Up@@ -287,6 +290,7 @@ fn cargo_metadata_with_deps_and_version() {
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"manifest_path": "[..]Cargo.toml",
"metadata": null,
"name": "baz",
Expand DownExpand Up@@ -342,6 +346,7 @@ fn cargo_metadata_with_deps_and_version() {
"keywords": [],
"license": "MIT",
"license_file": null,
"links": null,
"manifest_path": "[..]Cargo.toml",
"metadata": null,
"name": "foo",
Expand DownExpand Up@@ -374,6 +379,7 @@ fn cargo_metadata_with_deps_and_version() {
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"manifest_path": "[..]Cargo.toml",
"metadata": null,
"name": "foobar",
Expand DownExpand Up@@ -418,6 +424,7 @@ fn cargo_metadata_with_deps_and_version() {
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"manifest_path": "[..]Cargo.toml",
"metadata": null,
"name": "bar",
Expand DownExpand Up@@ -533,6 +540,7 @@ name = "ex"
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"description": null,
"edition": "2015",
"source": null,
Expand DownExpand Up@@ -615,6 +623,7 @@ crate-type = ["rlib", "dylib"]
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"description": null,
"edition": "2015",
"source": null,
Expand DownExpand Up@@ -698,6 +707,7 @@ fn workspace_metadata() {
"dependencies": [],
"license": null,
"license_file": null,
"links": null,
"description": null,
"edition": "2015",
"targets": [
Expand DownExpand Up@@ -728,6 +738,7 @@ fn workspace_metadata() {
"dependencies": [],
"license": null,
"license_file": null,
"links": null,
"description": null,
"edition": "2015",
"targets": [
Expand DownExpand Up@@ -806,6 +817,7 @@ fn workspace_metadata_no_deps() {
"dependencies": [],
"license": null,
"license_file": null,
"links": null,
"description": null,
"edition": "2015",
"targets": [
Expand DownExpand Up@@ -836,6 +848,7 @@ fn workspace_metadata_no_deps() {
"dependencies": [],
"license": null,
"license_file": null,
"links": null,
"description": null,
"edition": "2015",
"targets": [
Expand DownExpand Up@@ -893,6 +906,7 @@ const MANIFEST_OUTPUT: &str = r#"
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"description": null,
"edition": "2015",
"targets":[{
Expand DownExpand Up@@ -1070,6 +1084,7 @@ fn package_metadata() {
"edition": "2015",
"license": null,
"license_file": null,
"links": null,
"description": null,
"targets": [
{
Expand DownExpand Up@@ -1137,6 +1152,7 @@ fn cargo_metadata_path_to_cargo_toml_project() {
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"manifest_path": "[..]Cargo.toml",
"metadata": null,
"name": "bar",
Expand DownExpand Up@@ -1218,6 +1234,7 @@ fn package_edition_2018() {
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"manifest_path": "[..]Cargo.toml",
"metadata": null,
"name": "foo",
Expand DownExpand Up@@ -1303,6 +1320,7 @@ fn target_edition_2018() {
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"manifest_path": "[..]Cargo.toml",
"metadata": null,
"name": "foo",
Expand DownExpand Up@@ -1423,6 +1441,7 @@ fn rename_dependency() {
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"manifest_path": "[..]",
"metadata": null,
"name": "foo",
Expand DownExpand Up@@ -1455,6 +1474,7 @@ fn rename_dependency() {
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"manifest_path": "[..]",
"metadata": null,
"name": "bar",
Expand DownExpand Up@@ -1487,6 +1507,7 @@ fn rename_dependency() {
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"manifest_path": "[..]",
"metadata": null,
"name": "bar",
Expand DownExpand Up@@ -1554,3 +1575,90 @@ fn rename_dependency() {
)
.run();
}

#[test]
fn metadata_links() {
let p = project()
.file(
"Cargo.toml",
r#"
[project]
name = "foo"
version = "0.5.0"
links = "a"
"#,
)
.file("src/lib.rs", "")
.file("build.rs", "fn main() {}")
.build();

p.cargo("metadata")
.with_json(r#"
{
"packages": [
{
"authors": [],
"categories": [],
"dependencies": [],
"description": null,
"edition": "2015",
"features": {},
"id": "foo 0.5.0 [..]",
"keywords": [],
"license": null,
"license_file": null,
"links": "a",
"manifest_path": "[..]/foo/Cargo.toml",
"metadata": null,
"name": "foo",
"readme": null,
"repository": null,
"source": null,
"targets": [
{
"crate_types": [
"lib"
],
"edition": "2015",
"kind": [
"lib"
],
"name": "foo",
"src_path": "[..]/foo/src/lib.rs"
},
{
"crate_types": [
"bin"
],
"edition": "2015",
"kind": [
"custom-build"
],
"name": "build-script-build",
"src_path": "[..]/foo/build.rs"
}
],
"version": "0.5.0"
}
],
"resolve": {
"nodes": [
{
"dependencies": [],
"deps": [],
"features": [],
"id": "foo 0.5.0 [..]"
}
],
"root": "foo 0.5.0 [..]"
},
"target_directory": "[..]/foo/target",
"version": 1,
"workspace_members": [
"foo 0.5.0 [..]"
],
"workspace_root": "[..]/foo"
}
"#)
.run()
}
1 change: 1 addition & 0 deletions tests/testsuite/read_manifest.rs
Original file line numberDiff line numberDiff line change
Expand Up@@ -14,6 +14,7 @@ static MANIFEST_OUTPUT: &'static str = r#"
"keywords": [],
"license": null,
"license_file": null,
"links": null,
"description": null,
"edition": "2015",
"source":null,
Expand Down