-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Refactor compilation to make it easier to use for tools #21876
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
Conversation
// It is somewhat unfortunate that this is hardwired in - this is forced by | ||
// the fact that pretty_print_input requires the session by value. | ||
let pretty = callbacks.parse_pretty(&sess, &matches); | ||
match pretty.into_iter().next() { |
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.
Indentation is strange.
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.
Also, this can just be match pretty {
can't 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.
Probably, didn't try.
If I'm calling into the compiler externally to use the analysis passes, will I have to duplicate the |
I envisioned that you would embed a |
a3010d6
to
fc83535
Compare
@huon points addressed, ready for re-review |
a19a9ca
to
909ae05
Compare
Rebased again. @huonw ping for re-review |
fn build_controller<'a>(sess: &Session) -> CompileController<'a> { | ||
let mut control = CompileController::basic(); | ||
impl Compilation { | ||
pub fn and_then<F: Fn() -> Compilation>(self, next: F) -> Compilation { |
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.
This could be FnOnce
.
r=me with a rebase and the |
@bors r=huonw 8cc78b74fe0053cd42e840b4b39db3ffef5bd764 |
⌛ Testing commit 8cc78b7 with merge 310dfd1... |
💔 Test failed - auto-linux-64-x-android-t |
⌛ Testing commit f0e1e09 with merge 5cbf822... |
💔 Test failed - auto-win-64-nopt-t |
@bors: retry |
This allows people to write tools which are drop-in replacements for rustc by implementing `CompilerCalls` and three lines of code, rather than having to copy+paste a bunch of args parsing code. r? @alexcrichton
This allows people to write tools which are drop-in replacements for rustc by implementing
CompilerCalls
and three lines of code, rather than having to copy+paste a bunch of args parsing code.r? @alexcrichton