Skip to content

Instantly share code, notes, and snippets.

@why-jay
Created December 10, 2014 11:34
Show Gist options
  • Save why-jay/29e2819783efb2af6180 to your computer and use it in GitHub Desktop.
Save why-jay/29e2819783efb2af6180 to your computer and use it in GitHub Desktop.
// We need nested scopes here, because the intermediate results can keep
// large chunks of memory alive and we want to free them as soon as
// possible to keep the peak memory usage low
let (outputs, trans, sess) = {
let (outputs, expanded_crate, id) = {
let krate = phase_1_parse_input(&sess, cfg, input);
if stop_after_phase_1(&sess) { return; }
let outputs = build_output_filenames(input,
outdir,
output,
krate.attrs.as_slice(),
&sess);
let id = link::find_crate_name(Some(&sess), krate.attrs.as_slice(),
input);
let expanded_crate
= match phase_2_configure_and_expand(&sess, krate, id.as_slice(),
addl_plugins) {
None => return,
Some(k) => k
};
(outputs, expanded_crate, id)
};
// blah...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment