Skip to content

Commit 7c8e4b6

Browse files
committed
---
yaml --- r: 97843 b: refs/heads/snap-stage3 c: 0e6455e h: refs/heads/master i: 97841: 50c88f2 97839: aa942a8 v: v3
1 parent 4cd6640 commit 7c8e4b6

Some content is hidden

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

59 files changed

+614
-413
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: 0da105a8b7b6b1e0568e8ff20f6ff4b13cc7ecc2
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: aeb541674cb97fdd68eacfda7309a06b39db7a83
4+
refs/heads/snap-stage3: 0e6455e2b8ee707c0683c67ba224b7682aff4e85
55
refs/heads/try: c274a6888410ce3e357e014568b43310ed787d36
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/libextra/c_vec.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -160,21 +160,19 @@ impl <T> Container for CVec<T> {
160160

161161
#[cfg(test)]
162162
mod tests {
163-
164163
use super::*;
165164

166165
use std::libc::*;
167166
use std::libc;
168167
use std::ptr;
168+
use std::rt::global_heap::malloc_raw;
169169

170170
fn malloc(n: uint) -> CVec<u8> {
171171
unsafe {
172-
let mem = libc::malloc(n as size_t);
173-
174-
assert!(mem as int != 0);
172+
let mem = malloc_raw(n);
175173

176174
CVec::new_with_dtor(mem as *mut u8, n,
177-
proc() { libc::free(mem); })
175+
proc() { libc::free(mem as *c_void); })
178176
}
179177
}
180178

branches/snap-stage3/src/libnative/io/file.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
use std::c_str::CString;
1414
use std::io::IoError;
1515
use std::io;
16-
use std::libc::c_int;
16+
use std::libc::{c_int, c_void};
1717
use std::libc;
1818
use std::os;
1919
use std::rt::rtio;
@@ -548,7 +548,7 @@ pub fn readdir(p: &CString) -> IoResult<~[Path]> {
548548
let p = Path::new(p);
549549
let star = p.join("*");
550550
as_utf16_p(star.as_str().unwrap(), |path_ptr| {
551-
let wfd_ptr = malloc_raw(rust_list_dir_wfd_size() as uint);
551+
let wfd_ptr = malloc_raw(rust_list_dir_wfd_size() as uint) as *c_void;
552552
let find_handle = FindFirstFileW(path_ptr, wfd_ptr as HANDLE);
553553
if find_handle as libc::c_int != INVALID_HANDLE_VALUE {
554554
let mut paths = ~[];

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -133,12 +133,12 @@ impl Archive {
133133
run_ar(self.sess, "d", None, [&self.dst, &Path::new(file)]);
134134
}
135135

136-
/// Update all symbols in the archive (runs 'ar s' over it)
136+
/// Updates all symbols in the archive (runs 'ar s' over it)
137137
pub fn update_symbols(&mut self) {
138138
run_ar(self.sess, "s", None, [&self.dst]);
139139
}
140140

141-
/// List all files in an archive
141+
/// Lists all files in an archive
142142
pub fn files(&self) -> ~[~str] {
143143
let output = run_ar(self.sess, "t", None, [&self.dst]);
144144
str::from_utf8(output.output).lines().map(|s| s.to_owned()).collect()
@@ -182,7 +182,7 @@ impl Archive {
182182
let (osprefix, osext) = match self.sess.targ_cfg.os {
183183
abi::OsWin32 => ("", "lib"), _ => ("lib", "a"),
184184
};
185-
// On windows, static libraries sometimes show up as libfoo.a and other
185+
// On Windows, static libraries sometimes show up as libfoo.a and other
186186
// times show up as foo.lib
187187
let oslibname = format!("{}{}.{}", osprefix, name, osext);
188188
let unixlibname = format!("lib{}.a", name);
@@ -228,7 +228,7 @@ impl ArchiveRO {
228228
}
229229
}
230230

231-
/// Read a file in the archive
231+
/// Reads a file in the archive
232232
pub fn read<'a>(&'a self, file: &str) -> Option<&'a [u8]> {
233233
unsafe {
234234
let mut size = 0 as libc::size_t;

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

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -183,7 +183,7 @@ pub mod write {
183183
llvm::LLVMDisposePassManager(mpm);
184184

185185
// Emit the bytecode if we're either saving our temporaries or
186-
// emitting an rlib. Whenever an rlib is create, the bytecode is
186+
// emitting an rlib. Whenever an rlib is created, the bytecode is
187187
// inserted into the archive in order to allow LTO against it.
188188
let outputs = sess.outputs.borrow();
189189
if sess.opts.save_temps ||
@@ -314,7 +314,7 @@ pub mod write {
314314
use std::unstable::mutex::{Once, ONCE_INIT};
315315
static mut INIT: Once = ONCE_INIT;
316316

317-
// Copy what clan does by turning on loop vectorization at O2 and
317+
// Copy what clang does by turning on loop vectorization at O2 and
318318
// slp vectorization at O3
319319
let vectorize_loop = !sess.no_vectorize_loops() &&
320320
(sess.opts.optimize == session::Default ||
@@ -347,7 +347,7 @@ pub mod write {
347347
// Only initialize the platforms supported by Rust here, because
348348
// using --llvm-root will have multiple platforms that rustllvm
349349
// doesn't actually link to and it's pointless to put target info
350-
// into the registry that Rust can not generate machine code for.
350+
// into the registry that Rust cannot generate machine code for.
351351
llvm::LLVMInitializeX86TargetInfo();
352352
llvm::LLVMInitializeX86Target();
353353
llvm::LLVMInitializeX86TargetMC();
@@ -381,7 +381,7 @@ pub mod write {
381381
let builder = llvm::LLVMPassManagerBuilderCreate();
382382
match opt {
383383
lib::llvm::CodeGenLevelNone => {
384-
// Don't add lifetime intrinsics add O0
384+
// Don't add lifetime intrinsics at O0
385385
llvm::LLVMRustAddAlwaysInlinePass(builder, false);
386386
}
387387
lib::llvm::CodeGenLevelLess => {
@@ -591,7 +591,7 @@ pub fn mangle(sess: Session, ss: ast_map::Path,
591591
//
592592
// It turns out that on OSX you can actually have arbitrary symbols in
593593
// function names (at least when given to LLVM), but this is not possible
594-
// when using unix's linker. Perhaps one day when we just a linker from LLVM
594+
// when using unix's linker. Perhaps one day when we just use a linker from LLVM
595595
// we won't need to do this name mangling. The problem with name mangling is
596596
// that it seriously limits the available characters. For example we can't
597597
// have things like @T or ~[T] in symbol names when one would theoretically
@@ -894,7 +894,7 @@ fn link_rlib(sess: Session,
894894
// determine the architecture of the archive in order to see whether its
895895
// linkable.
896896
//
897-
// The algorithm for this detections is: iterate over the files in the
897+
// The algorithm for this detection is: iterate over the files in the
898898
// archive. Skip magical SYMDEF names. Interpret the first file as an
899899
// object file. Read architecture from the object file.
900900
//
@@ -941,7 +941,7 @@ fn link_rlib(sess: Session,
941941
// Create a static archive
942942
//
943943
// This is essentially the same thing as an rlib, but it also involves adding
944-
// all of the upstream crates' objects into the the archive. This will slurp in
944+
// all of the upstream crates' objects into the archive. This will slurp in
945945
// all of the native libraries of upstream dependencies as well.
946946
//
947947
// Additionally, there's no way for us to link dynamic libraries, so we warn
@@ -1058,7 +1058,7 @@ fn link_args(sess: Session,
10581058
if sess.targ_cfg.os == abi::OsLinux {
10591059
// GNU-style linkers will use this to omit linking to libraries which
10601060
// don't actually fulfill any relocations, but only for libraries which
1061-
// follow this flag. Thus, use it before specifing libraries to link to.
1061+
// follow this flag. Thus, use it before specifying libraries to link to.
10621062
args.push(~"-Wl,--as-needed");
10631063

10641064
// GNU-style linkers support optimization with -O. --gc-sections
@@ -1074,7 +1074,7 @@ fn link_args(sess: Session,
10741074
if sess.targ_cfg.os == abi::OsWin32 {
10751075
// Make sure that we link to the dynamic libgcc, otherwise cross-module
10761076
// DWARF stack unwinding will not work.
1077-
// This behavior may be overriden by --link-args "-static-libgcc"
1077+
// This behavior may be overridden by --link-args "-static-libgcc"
10781078
args.push(~"-shared-libgcc");
10791079
}
10801080

@@ -1124,7 +1124,7 @@ fn link_args(sess: Session,
11241124

11251125
// # Native library linking
11261126
//
1127-
// User-supplied library search paths (-L on the cammand line) These are
1127+
// User-supplied library search paths (-L on the command line). These are
11281128
// the same paths used to find Rust crates, so some of them may have been
11291129
// added already by the previous crate linking code. This only allows them
11301130
// to be found at compile time so it is still entirely up to outside
@@ -1182,12 +1182,12 @@ fn add_upstream_rust_crates(args: &mut ~[~str], sess: Session,
11821182
if !dylib && !sess.prefer_dynamic() {
11831183
// With an executable, things get a little interesting. As a limitation
11841184
// of the current implementation, we require that everything must be
1185-
// static, or everything must be dynamic. The reasons for this are a
1185+
// static or everything must be dynamic. The reasons for this are a
11861186
// little subtle, but as with the above two cases, the goal is to
11871187
// prevent duplicate copies of the same library showing up. For example,
11881188
// a static immediate dependency might show up as an upstream dynamic
11891189
// dependency and we currently have no way of knowing that. We know that
1190-
// all dynamic libaries require dynamic dependencies (see above), so
1190+
// all dynamic libraries require dynamic dependencies (see above), so
11911191
// it's satisfactory to include either all static libraries or all
11921192
// dynamic libraries.
11931193
let crates = cstore.get_used_crates(cstore::RequireStatic);
@@ -1232,7 +1232,7 @@ fn add_upstream_rust_crates(args: &mut ~[~str], sess: Session,
12321232
}
12331233

12341234
// If we're performing LTO, then it should have been previously required
1235-
// that all upstream rust depenencies were available in an rlib format.
1235+
// that all upstream rust dependencies were available in an rlib format.
12361236
assert!(!sess.lto());
12371237

12381238
// This is a fallback of three different cases of linking:

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

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -496,9 +496,8 @@ fn encode_reexported_static_methods(ecx: &EncodeContext,
496496
ebml_w: &mut writer::Encoder,
497497
mod_path: &[ast_map::PathElem],
498498
exp: &middle::resolve::Export2) {
499-
let items = ecx.tcx.items.borrow();
500-
match items.get().find(&exp.def_id.node) {
501-
Some(&ast_map::NodeItem(item, path)) => {
499+
match ecx.tcx.items.find(exp.def_id.node) {
500+
Some(ast_map::NodeItem(item, path)) => {
502501
let original_name = ecx.tcx.sess.str_of(item.ident);
503502

504503
//
@@ -1196,6 +1195,7 @@ fn encode_info_for_item(ecx: &EncodeContext,
11961195
encode_trait_ref(ebml_w, ecx, trait_def.trait_ref, tag_item_trait_ref);
11971196
encode_name(ecx, ebml_w, item.ident);
11981197
encode_attributes(ebml_w, item.attrs);
1198+
encode_visibility(ebml_w, vis);
11991199
for &method_def_id in ty::trait_method_def_ids(tcx, def_id).iter() {
12001200
ebml_w.start_tag(tag_item_trait_method);
12011201
encode_def_id(ebml_w, method_def_id);
@@ -1347,8 +1347,7 @@ fn my_visit_item(i: &Item,
13471347
ebml_w: &mut writer::Encoder,
13481348
ecx_ptr: *int,
13491349
index: @RefCell<~[entry<i64>]>) {
1350-
let items = items.borrow();
1351-
match items.get().get_copy(&i.id) {
1350+
match items.get(i.id) {
13521351
ast_map::NodeItem(_, pt) => {
13531352
let mut ebml_w = unsafe {
13541353
ebml_w.unsafe_clone()
@@ -1366,8 +1365,7 @@ fn my_visit_foreign_item(ni: &ForeignItem,
13661365
ebml_w: &mut writer::Encoder,
13671366
ecx_ptr:*int,
13681367
index: @RefCell<~[entry<i64>]>) {
1369-
let items = items.borrow();
1370-
match items.get().get_copy(&ni.id) {
1368+
match items.get(ni.id) {
13711369
ast_map::NodeForeignItem(_, abi, _, pt) => {
13721370
debug!("writing foreign item {}::{}",
13731371
ast_map::path_to_str(

branches/snap-stage3/src/librustc/middle/borrowck/mod.rs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -550,9 +550,8 @@ impl BorrowckCtxt {
550550
move_data::Declared => {}
551551

552552
move_data::MoveExpr => {
553-
let items = self.tcx.items.borrow();
554-
let (expr_ty, expr_span) = match items.get().find(&move.id) {
555-
Some(&ast_map::NodeExpr(expr)) => {
553+
let (expr_ty, expr_span) = match self.tcx.items.find(move.id) {
554+
Some(ast_map::NodeExpr(expr)) => {
556555
(ty::expr_ty_adjusted(self.tcx, expr), expr.span)
557556
}
558557
r => self.tcx.sess.bug(format!("MoveExpr({:?}) maps to {:?}, not Expr",
@@ -578,9 +577,8 @@ impl BorrowckCtxt {
578577
}
579578

580579
move_data::Captured => {
581-
let items = self.tcx.items.borrow();
582-
let (expr_ty, expr_span) = match items.get().find(&move.id) {
583-
Some(&ast_map::NodeExpr(expr)) => {
580+
let (expr_ty, expr_span) = match self.tcx.items.find(move.id) {
581+
Some(ast_map::NodeExpr(expr)) => {
584582
(ty::expr_ty_adjusted(self.tcx, expr), expr.span)
585583
}
586584
r => self.tcx.sess.bug(format!("Captured({:?}) maps to {:?}, not Expr",
@@ -768,9 +766,8 @@ impl BorrowckCtxt {
768766
out: &mut ~str) {
769767
match *loan_path {
770768
LpVar(id) => {
771-
let items = self.tcx.items.borrow();
772-
match items.get().find(&id) {
773-
Some(&ast_map::NodeLocal(ref ident, _)) => {
769+
match self.tcx.items.find(id) {
770+
Some(ast_map::NodeLocal(ref ident, _)) => {
774771
out.push_str(token::ident_to_str(ident));
775772
}
776773
r => {

branches/snap-stage3/src/librustc/middle/check_const.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,8 +250,7 @@ impl<'a> Visitor<()> for CheckItemRecursionVisitor<'a> {
250250
match def_map.get().find(&e.id) {
251251
Some(&DefStatic(def_id, _)) if
252252
ast_util::is_local(def_id) => {
253-
let ast_map = self.ast_map.borrow();
254-
match ast_map.get().get_copy(&def_id.node) {
253+
match self.ast_map.get(def_id.node) {
255254
ast_map::NodeItem(it, _) => {
256255
self.visit_item(it, ());
257256
}

branches/snap-stage3/src/librustc/middle/const_eval.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,9 @@ pub fn lookup_variant_by_id(tcx: ty::ctxt,
108108

109109
if ast_util::is_local(enum_def) {
110110
{
111-
let items = tcx.items.borrow();
112-
match items.get().find(&enum_def.node) {
111+
match tcx.items.find(enum_def.node) {
113112
None => None,
114-
Some(&ast_map::NodeItem(it, _)) => match it.node {
113+
Some(ast_map::NodeItem(it, _)) => match it.node {
115114
ItemEnum(ast::EnumDef { variants: ref variants }, _) => {
116115
variant_expr(*variants, variant_def.node)
117116
}
@@ -161,10 +160,9 @@ pub fn lookup_const_by_id(tcx: ty::ctxt, def_id: ast::DefId)
161160
-> Option<@Expr> {
162161
if ast_util::is_local(def_id) {
163162
{
164-
let items = tcx.items.borrow();
165-
match items.get().find(&def_id.node) {
163+
match tcx.items.find(def_id.node) {
166164
None => None,
167-
Some(&ast_map::NodeItem(it, _)) => match it.node {
165+
Some(ast_map::NodeItem(it, _)) => match it.node {
168166
ItemStatic(_, ast::MutImmutable, const_expr) => {
169167
Some(const_expr)
170168
}

branches/snap-stage3/src/librustc/middle/dead.rs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,11 @@ fn should_explore(tcx: ty::ctxt, def_id: ast::DefId) -> bool {
3838
return false;
3939
}
4040

41-
let items = tcx.items.borrow();
42-
match items.get().find(&def_id.node) {
43-
Some(&ast_map::NodeItem(..))
44-
| Some(&ast_map::NodeMethod(..))
45-
| Some(&ast_map::NodeForeignItem(..))
46-
| Some(&ast_map::NodeTraitMethod(..)) => true,
41+
match tcx.items.find(def_id.node) {
42+
Some(ast_map::NodeItem(..))
43+
| Some(ast_map::NodeMethod(..))
44+
| Some(ast_map::NodeForeignItem(..))
45+
| Some(ast_map::NodeTraitMethod(..)) => true,
4746
_ => false
4847
}
4948
}
@@ -136,9 +135,8 @@ impl MarkSymbolVisitor {
136135
}
137136
scanned.insert(id);
138137

139-
let items = self.tcx.items.borrow();
140-
match items.get().find(&id) {
141-
Some(node) => {
138+
match self.tcx.items.find(id) {
139+
Some(ref node) => {
142140
self.live_symbols.insert(id);
143141
self.visit_node(node);
144142
}

branches/snap-stage3/src/librustc/middle/entry.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,8 @@ fn find_item(item: &Item, ctxt: &mut EntryContext) {
7575
ItemFn(..) => {
7676
if item.ident.name == special_idents::main.name {
7777
{
78-
let ast_map = ctxt.ast_map.borrow();
79-
match ast_map.get().find(&item.id) {
80-
Some(&ast_map::NodeItem(_, path)) => {
78+
match ctxt.ast_map.find(item.id) {
79+
Some(ast_map::NodeItem(_, path)) => {
8180
if path.len() == 0 {
8281
// This is a top-level function so can be 'main'
8382
if ctxt.main_fn.is_none() {

branches/snap-stage3/src/librustc/middle/lint.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1330,8 +1330,7 @@ fn check_stability(cx: &Context, e: &ast::Expr) {
13301330

13311331
let stability = if ast_util::is_local(id) {
13321332
// this crate
1333-
let items = cx.tcx.items.borrow();
1334-
match items.get().find(&id.node) {
1333+
match cx.tcx.items.find(id.node) {
13351334
Some(ast_node) => {
13361335
let s = ast_node.with_attrs(|attrs| {
13371336
attrs.map(|a| {

0 commit comments

Comments
 (0)