GuillaumeGomez / rustc-tools

Some internal rustc tools made accessible
https://guillaumegomez.github.io/rustc-tools/
MIT License
41 stars 5 forks source link

Various questions about this work #11

Closed kinnison closed 1 year ago

kinnison commented 1 year ago

Firstly, thank you for preparing this as an example of how to work with rustc. I am interested in potentially writing a linting tool which I'd eventually want to build against a stable compiler release -- you mention "particular nightly" in your README though - does that mean it's not possible to write such tools against a stable release?

Secondly, I was playing with the CLI and found that cargo run --example lint -- --allow lint::warn_generics asset/example_file.rs does not work. Specifically I get:

Running lint example with arguments `["target/debug/examples/lint", "--allow", "lint::warn_generics", "asset/example_file.rs"]`
error[E0602]: unknown lint tool: `lint`
  |
  = note: requested on the command line with `-A lint::warn_generics`

Is this a failing in rustc or in your rustc_tools wrapper?

Finally, what is your intention regarding this work; is it meant to be a curiosity / example; or do you intend to keep developing it to make writing things like lints and other static analysis tools easier for third parties?

Thanks again, D.

GuillaumeGomez commented 1 year ago

So the tool is linked to a rustc version, but then it can be run on any codebase (normally, older ones than the nightly version picked but it should be fine if the changes in the language aren't too big, hence why clippy is following the updates of rustc).

Secondly, I was playing with the CLI...

It's maybe a bug, not sure. I tried to run clippy and couldn't find out how to do it either. Apparently from this issue, it doesn't seem to work at the moment.

Finally, what is your intention regarding this work; is it meant to be a curiosity / example; or do you intend to keep developing it to make writing things like lints and other static analysis tools easier for third parties?

I'm actually using it to develop tools used in gtk-rs so I intend to maintain it.

kinnison commented 1 year ago

So the tool is linked to a rustc version, but then it can be run on any codebase (normally, older ones than the nightly version picked but it should be fine if the changes in the language aren't too big, hence why clippy is following the updates of rustc).

Will there come a point at which it can build against a current stable, or does it rely on nightly-only stuff unless compiled in with the toolchain?

Secondly, I was playing with the CLI...

It's maybe a bug, not sure. I tried to run clippy and couldn't find out how to do it either. Apparently from this issue, it doesn't seem to work at the moment.

I'll trust that you'll work it out :D

Finally, what is your intention regarding this work; is it meant to be a curiosity / example; or do you intend to keep developing it to make writing things like lints and other static analysis tools easier for third parties?

I'm actually using it to develop tools used in gtk-rs so I intend to maintain it.

OK, that's excellent news, thank you for those responses.

If and when I get to use this in anger, I expect I'll file other issues / maybe even PRs if I get excited.

Thanks again for this,

D.

GuillaumeGomez commented 1 year ago

Will there come a point at which it can build against a current stable, or does it rely on nightly-only stuff unless compiled in with the toolchain?

It relies on internal rustc stuff, and nightly options too. I can tight it down to a specific rustc version, but I think (really need to check that) that it'll still require a nightly version to build with it.

I'll trust that you'll work it out :D

Hopefully someone else will before I need to. :wink:

OK, that's excellent news, thank you for those responses.

If and when I get to use this in anger, I expect I'll file other issues / maybe even PRs if I get excited.

Thanks again for this,

Getting feedback from other users than myself will definitely improve the situation for everyone. Good luck in any case!