Skip to content

Commit 0feba2b

Browse files
committed
---
yaml --- r: 105047 b: refs/heads/snap-stage3 c: aa75194 h: refs/heads/master i: 105045: 88db9cf 105043: 981a8af 105039: 2337d62 v: v3
1 parent 2d7b047 commit 0feba2b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

112 files changed

+2648
-1750
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 62f1d68439dcfd509eaca29887afa97f22938373
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 0e6f90eb89021342935de9af2f014fbee5805855
4+
refs/heads/snap-stage3: aa7519400e15ae92687cea17b8264ad32f5f5faf
55
refs/heads/try: db814977d07bd798feb24f6b74c00800ef458a13
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/doc/tutorial.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1395,7 +1395,7 @@ let mut y = ~5; // mutable
13951395
In contrast with
13961396
owned boxes, where the holder of an owned box is the owner of the pointed-to
13971397
memory, references never imply ownership - they are "borrowed".
1398-
You can borrow a reference to
1398+
A reference can be borrowed to
13991399
any object, and the compiler verifies that it cannot outlive the lifetime of
14001400
the object.
14011401

branches/snap-stage3/src/libarena/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,11 @@ struct Chunk {
5454
}
5555
impl Chunk {
5656
fn capacity(&self) -> uint {
57-
self.data.borrow().capacity()
57+
self.data.deref().borrow().get().capacity()
5858
}
5959

6060
unsafe fn as_ptr(&self) -> *u8 {
61-
self.data.borrow().as_ptr()
61+
self.data.deref().borrow().get().as_ptr()
6262
}
6363
}
6464

branches/snap-stage3/src/librustc/back/archive.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,12 @@ impl<'a> Archive<'a> {
206206

207207
let mut rustpath = filesearch::rust_path();
208208
rustpath.push(self.sess.filesearch().get_target_lib_path());
209-
let search = self.sess.opts.addl_lib_search_paths.borrow();
210-
for path in search.iter().chain(rustpath.iter()) {
209+
let addl_lib_search_paths = self.sess
210+
.opts
211+
.addl_lib_search_paths
212+
.borrow();
213+
let path = addl_lib_search_paths.get().iter();
214+
for path in path.chain(rustpath.iter()) {
211215
debug!("looking for {} inside {}", name, path.display());
212216
let test = path.join(oslibname.as_slice());
213217
if test.exists() { return test }

branches/snap-stage3/src/librustc/back/link.rs

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,9 @@ pub mod write {
209209
// Emit the bytecode if we're either saving our temporaries or
210210
// emitting an rlib. Whenever an rlib is created, the bytecode is
211211
// inserted into the archive in order to allow LTO against it.
212+
let crate_types = sess.crate_types.borrow();
212213
if sess.opts.cg.save_temps ||
213-
(sess.crate_types.borrow().contains(&session::CrateTypeRlib) &&
214+
(crate_types.get().contains(&session::CrateTypeRlib) &&
214215
sess.opts.output_types.contains(&OutputTypeExe)) {
215216
output.temp_path(OutputTypeBitcode).with_c_str(|buf| {
216217
llvm::LLVMWriteBitcodeToFile(llmod, buf);
@@ -549,14 +550,15 @@ fn symbol_hash(tcx: &ty::ctxt, symbol_hasher: &mut Sha256,
549550
}
550551

551552
fn get_symbol_hash(ccx: &CrateContext, t: ty::t) -> ~str {
552-
match ccx.type_hashcodes.borrow().find(&t) {
553+
match ccx.type_hashcodes.borrow().get().find(&t) {
553554
Some(h) => return h.to_str(),
554555
None => {}
555556
}
556557

558+
let mut type_hashcodes = ccx.type_hashcodes.borrow_mut();
557559
let mut symbol_hasher = ccx.symbol_hasher.borrow_mut();
558-
let hash = symbol_hash(ccx.tcx(), &mut *symbol_hasher, t, &ccx.link_meta);
559-
ccx.type_hashcodes.borrow_mut().insert(t, hash.clone());
560+
let hash = symbol_hash(ccx.tcx(), symbol_hasher.get(), t, &ccx.link_meta);
561+
type_hashcodes.get().insert(t, hash.clone());
560562
hash
561563
}
562564

@@ -777,7 +779,8 @@ pub fn link_binary(sess: &Session,
777779
outputs: &OutputFilenames,
778780
id: &CrateId) -> Vec<Path> {
779781
let mut out_filenames = Vec::new();
780-
for &crate_type in sess.crate_types.borrow().iter() {
782+
let crate_types = sess.crate_types.borrow();
783+
for &crate_type in crate_types.get().iter() {
781784
let out_file = link_binary_output(sess, trans, crate_type, outputs, id);
782785
out_filenames.push(out_file);
783786
}
@@ -884,7 +887,9 @@ fn link_rlib<'a>(sess: &'a Session,
884887
out_filename: &Path) -> Archive<'a> {
885888
let mut a = Archive::create(sess, out_filename, obj_filename);
886889

887-
for &(ref l, kind) in sess.cstore.get_used_libraries().borrow().iter() {
890+
let used_libraries = sess.cstore.get_used_libraries();
891+
let used_libraries = used_libraries.borrow();
892+
for &(ref l, kind) in used_libraries.get().iter() {
888893
match kind {
889894
cstore::NativeStatic => {
890895
a.add_native_library(l.as_slice()).unwrap();
@@ -1222,7 +1227,9 @@ fn link_args(sess: &Session,
12221227
// Finally add all the linker arguments provided on the command line along
12231228
// with any #[link_args] attributes found inside the crate
12241229
args.push_all(sess.opts.cg.link_args.as_slice());
1225-
for arg in sess.cstore.get_used_link_args().borrow().iter() {
1230+
let used_link_args = sess.cstore.get_used_link_args();
1231+
let used_link_args = used_link_args.borrow();
1232+
for arg in used_link_args.get().iter() {
12261233
args.push(arg.clone());
12271234
}
12281235
return args;
@@ -1240,7 +1247,8 @@ fn link_args(sess: &Session,
12401247
// in the current crate. Upstream crates with native library dependencies
12411248
// may have their native library pulled in above.
12421249
fn add_local_native_libraries(args: &mut Vec<~str>, sess: &Session) {
1243-
for path in sess.opts.addl_lib_search_paths.borrow().iter() {
1250+
let addl_lib_search_paths = sess.opts.addl_lib_search_paths.borrow();
1251+
for path in addl_lib_search_paths.get().iter() {
12441252
// FIXME (#9639): This needs to handle non-utf8 paths
12451253
args.push("-L" + path.as_str().unwrap().to_owned());
12461254
}
@@ -1251,7 +1259,9 @@ fn add_local_native_libraries(args: &mut Vec<~str>, sess: &Session) {
12511259
args.push("-L" + path.as_str().unwrap().to_owned());
12521260
}
12531261

1254-
for &(ref l, kind) in sess.cstore.get_used_libraries().borrow().iter() {
1262+
let used_libraries = sess.cstore.get_used_libraries();
1263+
let used_libraries = used_libraries.borrow();
1264+
for &(ref l, kind) in used_libraries.get().iter() {
12551265
match kind {
12561266
cstore::NativeUnknown | cstore::NativeStatic => {
12571267
args.push("-l" + *l);

branches/snap-stage3/src/librustc/back/lto.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ pub fn run(sess: &session::Session, llmod: ModuleRef,
2727
}
2828

2929
// Make sure we actually can run LTO
30-
for crate_type in sess.crate_types.borrow().iter() {
30+
let crate_types = sess.crate_types.borrow();
31+
for crate_type in crate_types.get().iter() {
3132
match *crate_type {
3233
session::CrateTypeExecutable | session::CrateTypeStaticlib => {}
3334
_ => {

branches/snap-stage3/src/librustc/driver/driver.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,8 @@ fn write_out_deps(sess: &Session,
512512
let file = outputs.path(*output_type);
513513
match *output_type {
514514
link::OutputTypeExe => {
515-
for output in sess.crate_types.borrow().iter() {
515+
let crate_types = sess.crate_types.borrow();
516+
for output in crate_types.get().iter() {
516517
let p = link::filename_for_input(sess, *output, &id, &file);
517518
out_filenames.push(p);
518519
}
@@ -541,10 +542,10 @@ fn write_out_deps(sess: &Session,
541542

542543
// Build a list of files used to compile the output and
543544
// write Makefile-compatible dependency rules
544-
let files: Vec<~str> = sess.codemap().files.borrow()
545+
let files: Vec<~str> = sess.codemap().files.borrow().get()
545546
.iter().filter_map(|fmap| {
546-
if fmap.is_real_file() {
547-
Some(fmap.name.clone())
547+
if fmap.deref().is_real_file() {
548+
Some(fmap.deref().name.clone())
548549
} else {
549550
None
550551
}
@@ -682,7 +683,7 @@ pub fn pretty_print_input(sess: Session,
682683
};
683684

684685
let src_name = source_name(input);
685-
let src = sess.codemap().get_filemap(src_name).src.as_bytes().to_owned();
686+
let src = sess.codemap().get_filemap(src_name).deref().src.as_bytes().to_owned();
686687
let mut rdr = MemReader::new(src);
687688

688689
match ppm {

branches/snap-stage3/src/librustc/driver/session.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,11 +253,11 @@ impl Session {
253253
sp: Span,
254254
msg: ~str) {
255255
let mut lints = self.lints.borrow_mut();
256-
match lints.find_mut(&id) {
256+
match lints.get().find_mut(&id) {
257257
Some(arr) => { arr.push((lint, sp, msg)); return; }
258258
None => {}
259259
}
260-
lints.insert(id, vec!((lint, sp, msg)));
260+
lints.get().insert(id, vec!((lint, sp, msg)));
261261
}
262262
pub fn next_node_id(&self) -> ast::NodeId {
263263
self.reserve_node_ids(1)

branches/snap-stage3/src/librustc/front/test.rs

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,10 @@ impl<'a> fold::Folder for TestHarnessGenerator<'a> {
8888
}
8989

9090
fn fold_item(&mut self, i: @ast::Item) -> SmallVector<@ast::Item> {
91-
self.cx.path.borrow_mut().push(i.ident);
91+
{
92+
let mut path = self.cx.path.borrow_mut();
93+
path.get().push(i.ident);
94+
}
9295
debug!("current path: {}",
9396
ast_util::path_name_i(self.cx.path.get().as_slice()));
9497

@@ -109,15 +112,21 @@ impl<'a> fold::Folder for TestHarnessGenerator<'a> {
109112
ignore: is_ignored(&self.cx, i),
110113
should_fail: should_fail(i)
111114
};
112-
self.cx.testfns.borrow_mut().push(test);
115+
{
116+
let mut testfns = self.cx.testfns.borrow_mut();
117+
testfns.get().push(test);
118+
}
113119
// debug!("have {} test/bench functions",
114120
// cx.testfns.len());
115121
}
116122
}
117123
}
118124

119125
let res = fold::noop_fold_item(i, self);
120-
self.cx.path.borrow_mut().pop();
126+
{
127+
let mut path = self.cx.path.borrow_mut();
128+
path.get().pop();
129+
}
121130
res
122131
}
123132

@@ -405,9 +414,12 @@ fn is_test_crate(krate: &ast::Crate) -> bool {
405414

406415
fn mk_test_descs(cx: &TestCtxt) -> @ast::Expr {
407416
let mut descs = Vec::new();
408-
debug!("building test vector from {} tests", cx.testfns.borrow().len());
409-
for test in cx.testfns.borrow().iter() {
410-
descs.push(mk_test_desc_and_fn_rec(cx, test));
417+
{
418+
let testfns = cx.testfns.borrow();
419+
debug!("building test vector from {} tests", testfns.get().len());
420+
for test in testfns.get().iter() {
421+
descs.push(mk_test_desc_and_fn_rec(cx, test));
422+
}
411423
}
412424

413425
let inner_expr = @ast::Expr {

branches/snap-stage3/src/librustc/lib/llvm.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1831,11 +1831,13 @@ impl TypeNames {
18311831
}
18321832

18331833
pub fn associate_type(&self, s: &str, t: &Type) {
1834-
assert!(self.named_types.borrow_mut().insert(s.to_owned(), t.to_ref()));
1834+
let mut named_types = self.named_types.borrow_mut();
1835+
assert!(named_types.get().insert(s.to_owned(), t.to_ref()));
18351836
}
18361837

18371838
pub fn find_type(&self, s: &str) -> Option<Type> {
1838-
self.named_types.borrow().find_equiv(&s).map(|x| Type::from_ref(*x))
1839+
let named_types = self.named_types.borrow();
1840+
named_types.get().find_equiv(&s).map(|x| Type::from_ref(*x))
18391841
}
18401842

18411843
pub fn type_to_str(&self, ty: Type) -> ~str {

branches/snap-stage3/src/librustc/metadata/creader.rs

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,11 @@ pub fn read_crates(sess: &Session,
5151
};
5252
visit_crate(&e, krate);
5353
visit::walk_crate(&mut e, krate, ());
54-
dump_crates(e.crate_cache.borrow().as_slice());
54+
let crate_cache = e.crate_cache.borrow();
55+
dump_crates(crate_cache.get().as_slice());
5556
warn_if_multiple_versions(&mut e,
5657
sess.diagnostic(),
57-
e.crate_cache.borrow().as_slice());
58+
crate_cache.get().as_slice());
5859
}
5960

6061
impl<'a> visit::Visitor<()> for Env<'a> {
@@ -267,7 +268,8 @@ fn visit_item(e: &Env, i: &ast::Item) {
267268

268269
fn existing_match(e: &Env, crate_id: &CrateId,
269270
hash: Option<&Svh>) -> Option<ast::CrateNum> {
270-
for c in e.crate_cache.borrow().iter() {
271+
let crate_cache = e.crate_cache.borrow();
272+
for c in crate_cache.get().iter() {
271273
if !crate_id.matches(&c.crate_id) { continue }
272274
match hash {
273275
Some(hash) if *hash != c.hash => {}
@@ -307,12 +309,15 @@ fn resolve_crate(e: &mut Env,
307309

308310
// Claim this crate number and cache it
309311
let cnum = e.next_crate_num;
310-
e.crate_cache.borrow_mut().push(cache_entry {
311-
cnum: cnum,
312-
span: span,
313-
hash: hash,
314-
crate_id: crate_id,
315-
});
312+
{
313+
let mut crate_cache = e.crate_cache.borrow_mut();
314+
crate_cache.get().push(cache_entry {
315+
cnum: cnum,
316+
span: span,
317+
hash: hash,
318+
crate_id: crate_id,
319+
});
320+
}
316321
e.next_crate_num += 1;
317322

318323
// Maintain a reference to the top most crate.

0 commit comments

Comments
 (0)