-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
cargo fix
support for exported-private-dependencies
#13095
Comments
What we need is
Looking at the compiler message {
"reason": "compiler-message",
"package_id": "cargo-pub-priv 0.1.0 (path+file:///home/epage/src/personal/dump/cargo-pub-priv)",
"manifest_path": "/home/epage/src/personal/dump/cargo-pub-priv/Cargo.toml",
"target": {
"kind": [
"lib"
],
"crate_types": [
"lib"
],
"name": "cargo-pub-priv",
"src_path": "/home/epage/src/personal/dump/cargo-pub-priv/src/lib.rs",
"edition": "2021",
"doc": true,
"doctest": true,
"test": true
},
"message": {
"rendered": "warning: trait `FooTrait` from private dependency 'foo' in public interface\n --> src/lib.rs:11:1\n |\n11 | pub trait UseFoo: foo::FooTrait {}\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n",
"children": [],
"code": {
"code": "exported_private_dependencies",
"explanation": null
},
"level": "warning",
"message": "trait `FooTrait` from private dependency 'foo' in public interface",
"spans": [
{
"byte_end": 189,
"byte_start": 158,
"column_end": 32,
"column_start": 1,
"expansion": null,
"file_name": "src/lib.rs",
"is_primary": true,
"label": null,
"line_end": 11,
"line_start": 11,
"suggested_replacement": null,
"suggestion_applicability": null,
"text": [
{
"highlight_end": 32,
"highlight_start": 1,
"text": "pub trait UseFoo: foo::FooTrait {}"
}
]
}
]
}
} We have the code but not the dependency name. It'd be ugly and brittle but we could parse the dependency name out of Expectation
|
Depending on the details, we might need #13096 |
Is it currently not supported to obtain the specific line number of a certain configuration item? It looks like this issue need this ability to fixed. And some discussiton can be found in zulip is it possible to include position data for |
Note that I was referring to a PR they'll be working on after that PR. That PR doesn't have the functionality you would need. |
Problem
rust-lang/rfcs#3516 calls for making
exported-private-dependencies
into an error in new editions. This means it needs to be machine-applicable socargo fix
can migrate it.The problem is the most useful thing for a machine-applicable fix is to update
Cargo.toml
but rustc has no knowledge of that.Proposed Solution
Intercept the message from rustc, before
cargo fix
(or the "machine applicable lints counter) sees this and add the machine-applicable content.Notes
No response
The text was updated successfully, but these errors were encountered: