-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Add [hints]
table in Cargo.toml
, and a hints.mostly-unused
hint
#15673
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
8fd9309
a206766
f415c11
1921d09
0c5ea24
fe86023
28b9762
9949fa8
78b4afb
e44bde5
94c27df
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,6 +56,7 @@ pub struct TomlManifest { | |
pub build_dependencies2: Option<BTreeMap<PackageName, InheritableDependency>>, | ||
pub target: Option<BTreeMap<String, TomlPlatform>>, | ||
pub lints: Option<InheritableLints>, | ||
pub hints: Option<Hints>, | ||
|
||
pub workspace: Option<TomlWorkspace>, | ||
pub profile: Option<TomlProfiles>, | ||
|
@@ -85,6 +86,7 @@ impl TomlManifest { | |
.map(|_| "build-dependencies"), | ||
self.target.as_ref().map(|_| "target"), | ||
self.lints.as_ref().map(|_| "lints"), | ||
self.hints.as_ref().map(|_| "hints"), | ||
] | ||
.into_iter() | ||
.flatten() | ||
|
@@ -1644,6 +1646,17 @@ pub enum TomlLintLevel { | |
Allow, | ||
} | ||
|
||
#[derive(Serialize, Deserialize, Debug, Default, Clone)] | ||
#[serde(rename_all = "kebab-case")] | ||
#[cfg_attr(feature = "unstable-schema", derive(schemars::JsonSchema))] | ||
pub struct Hints { | ||
#[cfg_attr( | ||
feature = "unstable-schema", | ||
schemars(with = "Option<TomlValueWrapper>") | ||
)] | ||
pub mostly_unused: Option<toml::Value>, | ||
Comment on lines
+1653
to
+1657
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. nit: you could do 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 I do that, the schema then says it takes a boolean or null, and I think that's incorrect; anyone relying on that schema would become fragile and potentially break if we introduce new possible values for this field. I think the schema should say that it takes a TomlValue or null. The schema shouldn't encourage people to be brittle, when cargo is going out of its way to be permissive and allow for future evolution without it being a breaking change. 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 think its dependent on how the schema is being used, whether its prescriptively match our compatibility guarantees or to describe the behavior at this time. For example, some editors support reading these schemas and applying completions off of it. I lean towards the latter but not going to push it. We can always adjust later. 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. @epage I really don't know how the schemas are intended to be used. I don't object to this change, I just don't know how we expect people to handle compatibility with anything that gets generated based on this. |
||
} | ||
|
||
#[derive(Copy, Clone, Debug)] | ||
pub struct InvalidCargoFeatures {} | ||
|
||
|
Uh oh!
There was an error while loading. Please reload this page.