-
Notifications
You must be signed in to change notification settings - Fork 11
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
Rustc: Librarify marker_rustc_driver
#271
Rustc: Librarify marker_rustc_driver
#271
Conversation
I think this may be the happiest I can get CI? |
The CI has some tests, that will fail until v0.3.0 has been released. I'll review this during the weekend :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these changes are very reasonable. And I'm okay with merging it, once my comments have been addressed :)
Note, that I've just updated the used nightly version and the CI should be fully functional now. It would be good if you could rebase. And thank you for waiting on my review :D
@@ -0,0 +1,68 @@ | |||
#![doc = include_str!("../../README.md")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Today I learned that you can have multiple binaries simply by adding a bin
folder under source o.O
Cargo's documentation states:
- The default executable file is
src/main.rs
.
- Other executables can be placed in
src/bin/
.
Could you move this file to src/main.rs
? For me, that's the default location where I would look first, and it's also the default executable, which should be located in src/main.rs
according to the docs.
I assume, this was just a stylistic choice, as moving it to src/main.rs
seems to work the same way. If there is another reason, please share it :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume, this was just a stylistic choice
To be honest, I didn't know a package could have both a src/lib.rs
and a src/main.rs
. So, TIL too. :)
0aa349b
to
8ab9240
Compare
@xFrednet I think I've addressed all of your comments. Please let me know if you see anything else. |
Sorry, I noticed a typo. I think the PR should be good now. |
This version looks good to me. I have one question, and then we should be able to merge this. The changes make |
Right now, the PoC uses just these exports: use marker_adapter::{Adapter, LintCrateInfo};
use marker_rustc_driver::lint_pass; I split-out the library at But from my perspective, the split does not have to occur at (No worries if you would like additional changes.) |
My question about |
} | ||
} | ||
|
||
fn register_tracked_files(sess: &mut rustc_session::parse::ParseSess, lint_crates: &[LintCrateInfo]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rustc uses caching where possible. This function, and the function above, register relevant files and environment values which should be checked, when rustc decides if a cache can be reused or not.
This one mainly registers the Cargo.toml
file, as that's where Marker's lints are configured and the lint crate files. It basically just ensures that we don't use caches if any lint crate was updated. Do you maybe want to make this one public as well? I'm not sure how dylint handles this kind of thing.
This is just a suggestion, if you handle this differently or don't need it, I'm happy to merge this as is :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you maybe want to make this one public as well?
It's kind of you to ask, but I don't think it's necessary.
If "marker_rustc_driver
as a library" feels "incomplete" to you without this function, I can sympathize with that feeling. But I would recommend to keep the interface as small as possible until me or someone else complains. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just wanted to mention it, since i[#294]t was a thing we ran into after some testing :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm curious now (because caching has been the source of several bugs in Dylint). Is there a direct connection between caching and #294?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reference to #294 seems to be an accidental copy-pasta 🍝. Sorry, about that.
There is a direct connection between the function I marked here and caching. This is the PR that prevented unwanted caching for Marker: #211
Do you have some examples for caching related bugs in Dylint and how you solved them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you have some examples for caching related bugs in Dylint and how you solved them?
Two that come to mind are:
marker_rustc_driver
marker_rustc_driver
Fixes #257
How do you feel about this?
I would summarize the changes as follows:
main
function.try_main
was updated to accept animpl Iterator<Item = String>
.main
passesstd::env::args()
as this argument.1pub
:try_main
lint_pass
MainError
process_crate
Footnotes
This change was not strictly necessary. But since
try_main
is now a public function, the idea of it reading fromstd::env::args()
directly seemed weird to me. ↩