-
-
Notifications
You must be signed in to change notification settings - Fork 3k
feat(manifest): support feature-documentation in manifests
#17447
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2681,3 +2681,65 @@ c = [ | |
| [("Cargo.toml", normalized_manifest)], | ||
| ); | ||
| } | ||
|
|
||
| #[cargo_test] | ||
| fn feature_documentation_is_unstable() { | ||
| let p = project() | ||
| .file( | ||
| "Cargo.toml", | ||
| r#" | ||
| [package] | ||
| name = "foo" | ||
| edition = "2015" | ||
|
|
||
| [features] | ||
| foo = { enables = [], doc = "Enables foo." } | ||
| "#, | ||
| ) | ||
| .file("src/main.rs", "fn main() {}") | ||
| .build(); | ||
|
|
||
| p.cargo("check") | ||
| .with_status(101) | ||
| .with_stderr_data(str![[r#" | ||
| [ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml` | ||
|
|
||
| Caused by: | ||
| feature `feature-metadata` is required | ||
|
|
||
| The package requires the Cargo feature called `feature-metadata`, but that feature is not stabilized in this version of Cargo ([..]). | ||
| Consider trying a newer version of Cargo (this may require the nightly release). | ||
| See https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#feature_metadata for more information about the status of this feature. | ||
|
|
||
| "#]]) | ||
| .run(); | ||
| } | ||
|
|
||
| #[cargo_test] | ||
| fn feature_has_documentation() { | ||
| let p = project() | ||
| .file( | ||
| "Cargo.toml", | ||
| r#" | ||
| cargo-features = ["feature-metadata"] | ||
|
|
||
| [package] | ||
| name = "foo" | ||
| edition = "2015" | ||
|
|
||
| [features] | ||
| foo = { enables = [], doc = "Enables foo." } | ||
|
weihanglo marked this conversation as resolved.
|
||
| "#, | ||
| ) | ||
| .file("src/main.rs", "fn main() {}") | ||
| .build(); | ||
|
|
||
| p.cargo("check") | ||
| .masquerade_as_nightly_cargo(&["feature-metadata"]) | ||
| .with_stderr_data(str![[r#" | ||
| [CHECKING] foo v0.0.0 ([ROOT]/foo) | ||
| [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s | ||
|
|
||
| "#]]) | ||
| .run(); | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should there be a check of the new key being parsed?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess this can similarily be split into two (test, fix) commits, so that we don't need a verification but the test diff showing that it was an unused manifest key.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we had a Or we can also add cargo-info integration for feature metadata in a follow-up as part of the verification. @0xPoe any opinion on this? I am not sure whether it should be behind a unstable flag though, given cargo-info is purely for human not programmable.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I've split the PR: the
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Sounds interesting. I believe docs may also be helpful for human use. However, the biggest challenge would be the UI design. In the current cargo-info output, it is difficult to display the documents directly within the existing layout. |
||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.