Skip to content

Commit f62faa8

Browse files
committed
librustc: De-@mut outputs in the session
1 parent e4815b6 commit f62faa8

File tree

4 files changed

+9
-6
lines changed

4 files changed

+9
-6
lines changed

src/librustc/back/link.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,9 @@ pub mod write {
208208
// Emit the bytecode if we're either saving our temporaries or
209209
// emitting an rlib. Whenever an rlib is create, the bytecode is
210210
// inserted into the archive in order to allow LTO against it.
211+
let outputs = sess.outputs.borrow();
211212
if sess.opts.save_temps ||
212-
sess.outputs.iter().any(|&o| o == session::OutputRlib) {
213+
outputs.get().iter().any(|&o| o == session::OutputRlib) {
213214
output.with_extension("bc").with_c_str(|buf| {
214215
llvm::LLVMWriteBitcodeToFile(llmod, buf);
215216
})
@@ -745,7 +746,8 @@ pub fn link_binary(sess: Session,
745746
out_filename: &Path,
746747
lm: &LinkMeta) -> ~[Path] {
747748
let mut out_filenames = ~[];
748-
for &output in sess.outputs.iter() {
749+
let outputs = sess.outputs.borrow();
750+
for &output in outputs.get().iter() {
749751
let out_file = link_binary_output(sess, trans, output, obj_filename,
750752
out_filename, lm);
751753
out_filenames.push(out_file);

src/librustc/back/lto.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ use std::libc;
2020
pub fn run(sess: session::Session, llmod: ModuleRef,
2121
tm: TargetMachineRef, reachable: &[~str]) {
2222
// Make sure we actually can run LTO
23-
for output in sess.outputs.iter() {
23+
let outputs = sess.outputs.borrow();
24+
for output in outputs.get().iter() {
2425
match *output {
2526
session::OutputExecutable | session::OutputStaticlib => {}
2627
_ => {

src/librustc/driver/driver.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ pub fn phase_2_configure_and_expand(sess: Session,
167167
let time_passes = sess.time_passes();
168168

169169
sess.building_library.set(session::building_library(sess.opts, &crate));
170-
*sess.outputs = session::collect_outputs(sess.opts, crate.attrs);
170+
sess.outputs.set(session::collect_outputs(sess.opts, crate.attrs));
171171

172172
time(time_passes, "gated feature checking", (), |_|
173173
front::feature_gate::check_crate(sess, &crate));
@@ -882,7 +882,7 @@ pub fn build_session_(sopts: @session::options,
882882
working_dir: os::getcwd(),
883883
lints: RefCell::new(HashMap::new()),
884884
node_id: Cell::new(1),
885-
outputs: @mut ~[],
885+
outputs: @RefCell::new(~[]),
886886
}
887887
}
888888

src/librustc/driver/session.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ pub struct Session_ {
215215
lints: RefCell<HashMap<ast::NodeId,
216216
~[(lint::lint, codemap::Span, ~str)]>>,
217217
node_id: Cell<ast::NodeId>,
218-
outputs: @mut ~[OutputStyle],
218+
outputs: @RefCell<~[OutputStyle]>,
219219
}
220220

221221
pub type Session = @Session_;

0 commit comments

Comments
 (0)