Skip to content

Remove RefCell::get and RefCell::set #13301

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

Merged
merged 3 commits into from
Apr 4, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions src/librustc/driver/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,7 @@ pub fn phase_2_configure_and_expand(sess: &Session,
let time_passes = sess.time_passes();

sess.building_library.set(session::building_library(&sess.opts, &krate));
sess.crate_types.set(session::collect_crate_types(sess,
krate.attrs
.as_slice()));
*sess.crate_types.borrow_mut() = session::collect_crate_types(sess, krate.attrs.as_slice());

time(time_passes, "gated feature checking", (), |_|
front::feature_gate::check_crate(sess, &krate));
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/front/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ impl<'a> fold::Folder for TestHarnessGenerator<'a> {
fn fold_item(&mut self, i: @ast::Item) -> SmallVector<@ast::Item> {
self.cx.path.borrow_mut().push(i.ident);
debug!("current path: {}",
ast_util::path_name_i(self.cx.path.get().as_slice()));
ast_util::path_name_i(self.cx.path.borrow().as_slice()));

if is_test_fn(&self.cx, i) || is_bench_fn(&self.cx, i) {
match i.node {
Expand All @@ -104,7 +104,7 @@ impl<'a> fold::Folder for TestHarnessGenerator<'a> {
debug!("this is a test function");
let test = Test {
span: i.span,
path: self.cx.path.get(),
path: self.cx.path.borrow().clone(),
bench: is_bench_fn(&self.cx, i),
ignore: is_ignored(&self.cx, i),
should_fail: should_fail(i)
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/metadata/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1345,7 +1345,7 @@ fn encode_info_for_items(ecx: &EncodeContext,
}

ebml_w.end_tag();
return /*bad*/(*index).get();
return /*bad*/index.borrow().clone();
}


Expand All @@ -1365,7 +1365,7 @@ fn create_index<T:Clone + Hash + 'static>(

let mut buckets_frozen = Vec::new();
for bucket in buckets.iter() {
buckets_frozen.push(@/*bad*/(**bucket).get());
buckets_frozen.push(@/*bad*/bucket.borrow().clone());
}
return buckets_frozen;
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/dead.rs
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ fn create_and_seed_worklist(tcx: &ty::ctxt,
}

// Seed entry point
match tcx.sess.entry_fn.get() {
match *tcx.sess.entry_fn.borrow() {
Some((id, _)) => worklist.push(id),
None => ()
}
Expand Down
6 changes: 3 additions & 3 deletions src/librustc/middle/entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,13 @@ fn find_item(item: &Item, ctxt: &mut EntryContext) {

fn configure_main(this: &mut EntryContext) {
if this.start_fn.is_some() {
this.session.entry_fn.set(this.start_fn);
*this.session.entry_fn.borrow_mut() = this.start_fn;
this.session.entry_type.set(Some(session::EntryStart));
} else if this.attr_main_fn.is_some() {
this.session.entry_fn.set(this.attr_main_fn);
*this.session.entry_fn.borrow_mut() = this.attr_main_fn;
this.session.entry_type.set(Some(session::EntryMain));
} else if this.main_fn.is_some() {
this.session.entry_fn.set(this.main_fn);
*this.session.entry_fn.borrow_mut() = this.main_fn;
this.session.entry_type.set(Some(session::EntryMain));
} else {
if !this.session.building_library.get() {
Expand Down
Loading