Skip to content
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

Allow compiler plugins to be loaded from the command line #15446

Closed
huonw opened this issue Jul 5, 2014 · 9 comments · Fixed by #20032
Closed

Allow compiler plugins to be loaded from the command line #15446

huonw opened this issue Jul 5, 2014 · 9 comments · Fixed by #20032
Labels
A-plugins Area: compiler plugins, doc.rust-lang.org/nightly/unstable-book/language-features/plugin.html C-enhancement Category: An issue proposing an enhancement or a PR with one. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

Comments

@huonw
Copy link
Member

huonw commented Jul 5, 2014

Currently the only way to load plugins is by having #[phase(plugin)] extern crate foo; in the source, but one can easily have plugins (lints etc.) that make sense to only load occasionally or that make sense to load into external crates in an automated fashion, where editing the source is hard (E.g. my spellck lint).

This could be something like -Z plugin=spellck -Z plugin=grammarck etc. (-Z since presumably this will be unstable.)

@huonw
Copy link
Member Author

huonw commented Jul 5, 2014

cc @kmcallister

@kmcallister
Copy link
Contributor

Seems reasonable. For hardening options I was considering a generic way to specify crate-level attributes at the command line. I wonder if the same mechanism could accommodate both.

@kmcallister kmcallister added E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. A-syntaxext Area: Syntax extensions A-plugins Area: compiler plugins, doc.rust-lang.org/nightly/unstable-book/language-features/plugin.html and removed A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. A-syntaxext Area: Syntax extensions labels Oct 5, 2014
@Manishearth
Copy link
Member

@huonw Any pointers on where I should look?

Also, -Z is a bunch of flags right now (and can't take options), should I change the implementation to something else?

@kmcallister
Copy link
Contributor

@Manishearth: Re-use the implementation of -C, which has more sophisticated parsing.

@Manishearth
Copy link
Member

Alright, thanks!

@tomjakubowski
Copy link
Contributor

@Manishearth did you make progress on this?

@Manishearth
Copy link
Member

I did, on the flight back. I'll finish it off today, once I get through these Servo reviews.

@tomjakubowski
Copy link
Contributor

Sweet! :D

@Manishearth
Copy link
Member

I have a WIP here, not yet tested/cleaned up. @huonw thoughts on the design?

bors added a commit that referenced this issue Jan 8, 2015
`rustc something.rs -L folder_with_plugin_dylib/ -Z extra-plugins=foo` works via this

My way of testing this is by cloning https://github.com/Manishearth/rust-clippy, `cargo build`ing it, and then running `rustc examples/box_vec.rs -L target/ -Z extra-plugins=rust_clippy` after editing out the `exern crate rust_clippy` from `box_vec.rs`

r? @huonw

fixes #15446
bors added a commit to rust-lang-ci/rust that referenced this issue Aug 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-plugins Area: compiler plugins, doc.rust-lang.org/nightly/unstable-book/language-features/plugin.html C-enhancement Category: An issue proposing an enhancement or a PR with one. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants