Skip to content

Commit 769b008

Browse files
committed
---
yaml --- r: 93790 b: refs/heads/try c: 97aaf42 h: refs/heads/master v: v3
1 parent 18af3ca commit 769b008

File tree

23 files changed

+217
-53
lines changed

23 files changed

+217
-53
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 0da105a8b7b6b1e0568e8ff20f6ff4b13cc7ecc2
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: a6d3e57dca68fde4effdda3e4ae2887aa535fcd6
5-
refs/heads/try: 1de47cb84286dd769b398da5d7dd1df2fd6f3406
5+
refs/heads/try: 97aaf42462ff35ad2bf097c8c1351e876d8d72b8
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/configure

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -520,14 +520,20 @@ then
520520
fi
521521
fi
522522

523+
BIN_SUF=
524+
if [ $CFG_OSTYPE = "pc-mingw32" ]
525+
then
526+
BIN_SUF=.exe
527+
fi
528+
523529
if [ ! -z "$CFG_ENABLE_LOCAL_RUST" ]
524530
then
525-
if [ ! -f ${CFG_LOCAL_RUST_ROOT}/bin/rustc ]
531+
if [ ! -f ${CFG_LOCAL_RUST_ROOT}/bin/rustc${BIN_SUF} ]
526532
then
527533
err "no local rust to use"
528534
else
529-
LRV=`${CFG_LOCAL_RUST_ROOT}/bin/rustc --version`
530-
step_msg "using rustc at: ${CFG_LOCAL_RUST_ROOT} with version: " $LRV
535+
LRV=`${CFG_LOCAL_RUST_ROOT}/bin/rustc${BIN_SUF} --version`
536+
step_msg "using rustc at: ${CFG_LOCAL_RUST_ROOT} with version: $LRV"
531537
fi
532538
fi
533539

branches/try/doc/rust.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3161,7 +3161,7 @@ Borrowed pointers (`&`)
31613161
Borrowed pointers arise by (automatic) conversion from owning pointers, managed pointers,
31623162
or by applying the borrowing operator `&` to some other value,
31633163
including [lvalues, rvalues or temporaries](#lvalues-rvalues-and-temporaries).
3164-
Borrowed pointers are written `&content`, or in some cases `&f/content` for some lifetime-variable `f`,
3164+
Borrowed pointers are written `&content`, or in some cases `&'f content` for some lifetime-variable `f`,
31653165
for example `&int` means a borrowed pointer to an integer.
31663166
Copying a borrowed pointer is a "shallow" operation:
31673167
it involves only copying the pointer itself.

branches/try/src/etc/local_stage0.sh

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
TARG_DIR=$1
44
PREFIX=$2
55

6-
BINDIR=bin
7-
LIBDIR=lib
6+
LIB_DIR=lib
7+
LIB_PREFIX=lib
88

99
OS=`uname -s`
1010
case $OS in
@@ -21,7 +21,8 @@ case $OS in
2121
(*)
2222
BIN_SUF=.exe
2323
LIB_SUF=.dll
24-
LIBDIR=bin
24+
LIB_DIR=bin
25+
LIB_PREFIX=
2526
break
2627
;;
2728
esac
@@ -31,7 +32,7 @@ if [ -z $PREFIX ]; then
3132
exit 1
3233
fi
3334

34-
if [ ! -e ${PREFIX}/bin/rustc ]; then
35+
if [ ! -e ${PREFIX}/bin/rustc${BIN_SUF} ]; then
3536
echo "No local rust installed at ${PREFIX}"
3637
exit 1
3738
fi
@@ -41,9 +42,9 @@ if [ -z $TARG_DIR ]; then
4142
exit 1
4243
fi
4344

44-
cp ${PREFIX}/bin/rustc ${TARG_DIR}/stage0/bin/
45-
cp ${PREFIX}/lib/rustc/${TARG_DIR}/${LIBDIR}/* ${TARG_DIR}/stage0/${LIBDIR}/
46-
cp ${PREFIX}/lib/libextra*${LIB_SUF} ${TARG_DIR}/stage0/${LIBDIR}/
47-
cp ${PREFIX}/lib/librust*${LIB_SUF} ${TARG_DIR}/stage0/${LIBDIR}/
48-
cp ${PREFIX}/lib/libstd*${LIB_SUF} ${TARG_DIR}/stage0/${LIBDIR}/
49-
cp ${PREFIX}/lib/libsyntax*${LIB_SUF} ${TARG_DIR}/stage0/${LIBDIR}/
45+
cp ${PREFIX}/bin/rustc${BIN_SUF} ${TARG_DIR}/stage0/bin/
46+
cp ${PREFIX}/${LIB_DIR}/rustc/${TARG_DIR}/${LIB_DIR}/* ${TARG_DIR}/stage0/${LIB_DIR}/
47+
cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}extra*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/
48+
cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}rust*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/
49+
cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}std*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/
50+
cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}syntax*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/

branches/try/src/libextra/sync.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ impl Sem<~[WaitQueue]> {
326326
// and rwlock_write_mode.
327327
pub fn access_cond<U>(&self, blk: |c: &Condvar| -> U) -> U {
328328
do self.access {
329-
blk(&Condvar { sem: self, order: Nothing, token: NonCopyable::new() })
329+
blk(&Condvar { sem: self, order: Nothing, token: NonCopyable })
330330
}
331331
}
332332
}
@@ -569,7 +569,7 @@ impl RWLock {
569569
do task::rekillable {
570570
let opt_lock = Just(&self.order_lock);
571571
blk(&Condvar { sem: cond.sem, order: opt_lock,
572-
token: NonCopyable::new() })
572+
token: NonCopyable })
573573
}
574574
}
575575
}
@@ -605,7 +605,7 @@ impl RWLock {
605605
(&self.order_lock).release();
606606
do (|| {
607607
do task::rekillable {
608-
blk(RWLockWriteMode { lock: self, token: NonCopyable::new() })
608+
blk(RWLockWriteMode { lock: self, token: NonCopyable })
609609
}
610610
}).finally {
611611
let writer_or_last_reader;
@@ -662,7 +662,7 @@ impl RWLock {
662662
}
663663
}
664664
}
665-
RWLockReadMode { lock: token.lock, token: NonCopyable::new() }
665+
RWLockReadMode { lock: token.lock, token: NonCopyable }
666666
}
667667
}
668668

@@ -682,7 +682,7 @@ impl<'self> RWLockWriteMode<'self> {
682682
// access lock. See comment in RWLock::write_cond for why.
683683
blk(&Condvar { sem: &self.lock.access_lock,
684684
order: Just(&self.lock.order_lock),
685-
token: NonCopyable::new() })
685+
token: NonCopyable })
686686
}
687687
}
688688

branches/try/src/librustc/lib/llvm.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ pub enum CallConv {
3333
ColdCallConv = 9,
3434
X86StdcallCallConv = 64,
3535
X86FastcallCallConv = 65,
36+
X86_64_Win64 = 79,
3637
}
3738

3839
pub enum Visibility {

branches/try/src/librustc/middle/resolve.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ use syntax::parse::token;
2929
use syntax::parse::token::{ident_interner, interner_get};
3030
use syntax::parse::token::special_idents;
3131
use syntax::print::pprust::path_to_str;
32-
use syntax::codemap::{Span, dummy_sp, BytePos};
32+
use syntax::codemap::{Span, dummy_sp, Pos};
3333
use syntax::opt_vec::OptVec;
3434
use syntax::visit;
3535
use syntax::visit::Visitor;
@@ -2624,7 +2624,7 @@ impl Resolver {
26242624
if "???" == module_name {
26252625
let span = Span {
26262626
lo: span.lo,
2627-
hi: span.lo + BytePos(segment_name.len()),
2627+
hi: span.lo + Pos::from_uint(segment_name.len()),
26282628
expn_info: span.expn_info,
26292629
};
26302630
self.resolve_error(span,

branches/try/src/librustc/middle/trans/foreign.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ use syntax::{ast};
3333
use syntax::{attr, ast_map};
3434
use syntax::parse::token::special_idents;
3535
use syntax::abi::{RustIntrinsic, Rust, Stdcall, Fastcall, System,
36-
Cdecl, Aapcs, C, AbiSet};
36+
Cdecl, Aapcs, C, AbiSet, Win64};
3737
use util::ppaux::{Repr, UserString};
3838
use middle::trans::type_::Type;
3939

@@ -96,6 +96,7 @@ pub fn llvm_calling_convention(ccx: &mut CrateContext,
9696
Stdcall => lib::llvm::X86StdcallCallConv,
9797
Fastcall => lib::llvm::X86FastcallCallConv,
9898
C => lib::llvm::CCallConv,
99+
Win64 => lib::llvm::X86_64_Win64,
99100

100101
// NOTE These API constants ought to be more specific
101102
Cdecl => lib::llvm::CCallConv,
@@ -398,11 +399,19 @@ pub fn register_rust_fn_with_foreign_abi(ccx: @mut CrateContext,
398399

399400
let tys = foreign_types_for_id(ccx, node_id);
400401
let llfn_ty = lltype_for_fn_from_foreign_types(&tys);
402+
let t = ty::node_id_to_type(ccx.tcx, node_id);
403+
let cconv = match ty::get(t).sty {
404+
ty::ty_bare_fn(ref fn_ty) => {
405+
let c = llvm_calling_convention(ccx, fn_ty.abis);
406+
c.unwrap_or(lib::llvm::CCallConv)
407+
}
408+
_ => lib::llvm::CCallConv
409+
};
401410
let llfn = base::register_fn_llvmty(ccx,
402411
sp,
403412
sym,
404413
node_id,
405-
lib::llvm::CCallConv,
414+
cconv,
406415
llfn_ty);
407416
add_argument_attributes(&tys, llfn);
408417
debug!("register_rust_fn_with_foreign_abi(node_id={:?}, llfn_ty={}, llfn={})",

branches/try/src/librustc/middle/typeck/astconv.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -560,10 +560,6 @@ pub fn ast_ty_to_ty<AC:AstConv, RS:RegionScope>(
560560
ast_ty.span,
561561
"found `ty_infer` in unexpected place");
562562
}
563-
ast::ty_mac(_) => {
564-
tcx.sess.span_bug(ast_ty.span,
565-
"found `ty_mac` in unexpected place");
566-
}
567563
};
568564

569565
tcx.ast_ty_to_ty_cache.insert(ast_ty.id, ty::atttce_resolved(typ));

branches/try/src/libstd/gc.rs

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
/*! Task-local garbage-collected boxes
12+
13+
The `Gc` type provides shared ownership of an immutable value. Destruction is not deterministic, and
14+
will occur some time between every `Gc` handle being gone and the end of the task. The garbage
15+
collector is task-local so `Gc<T>` is not sendable.
16+
17+
*/
18+
19+
use kinds::Send;
20+
use clone::{Clone, DeepClone};
21+
22+
/// Immutable garbage-collected pointer type
23+
#[no_send]
24+
#[deriving(Clone)]
25+
pub struct Gc<T> {
26+
priv ptr: @T
27+
}
28+
29+
impl<T: 'static> Gc<T> {
30+
/// Construct a new garbage-collected box
31+
#[inline]
32+
pub fn new(value: T) -> Gc<T> {
33+
Gc { ptr: @value }
34+
}
35+
}
36+
37+
impl<T: 'static> Gc<T> {
38+
/// Borrow the value contained in the garbage-collected box
39+
#[inline]
40+
pub fn borrow<'r>(&'r self) -> &'r T {
41+
&*self.ptr
42+
}
43+
}
44+
45+
/// The `Send` bound restricts this to acyclic graphs where it is well-defined.
46+
///
47+
/// A `Freeze` bound would also work, but `Send` *or* `Freeze` cannot be expressed.
48+
impl<T: DeepClone + Send + 'static> DeepClone for Gc<T> {
49+
#[inline]
50+
fn deep_clone(&self) -> Gc<T> {
51+
Gc::new(self.borrow().deep_clone())
52+
}
53+
}
54+
55+
#[cfg(test)]
56+
mod tests {
57+
use super::*;
58+
use cell::Cell;
59+
60+
#[test]
61+
fn test_clone() {
62+
let x = Gc::new(Cell::new(5));
63+
let y = x.clone();
64+
do x.borrow().with_mut_ref |inner| {
65+
*inner = 20;
66+
}
67+
assert_eq!(y.borrow().take(), 20);
68+
}
69+
70+
#[test]
71+
fn test_deep_clone() {
72+
let x = Gc::new(Cell::new(5));
73+
let y = x.deep_clone();
74+
do x.borrow().with_mut_ref |inner| {
75+
*inner = 20;
76+
}
77+
assert_eq!(y.borrow().take(), 5);
78+
}
79+
80+
#[test]
81+
fn test_simple() {
82+
let x = Gc::new(5);
83+
assert_eq!(*x.borrow(), 5);
84+
}
85+
86+
#[test]
87+
fn test_simple_clone() {
88+
let x = Gc::new(5);
89+
let y = x.clone();
90+
assert_eq!(*x.borrow(), 5);
91+
assert_eq!(*y.borrow(), 5);
92+
}
93+
94+
#[test]
95+
fn test_destructor() {
96+
let x = Gc::new(~5);
97+
assert_eq!(**x.borrow(), 5);
98+
}
99+
}

branches/try/src/libstd/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ pub mod owned;
133133
pub mod managed;
134134
pub mod borrow;
135135
pub mod rc;
136+
pub mod gc;
136137

137138

138139
/* Core language traits */

branches/try/src/libstd/util.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,6 @@ pub fn replace<T>(dest: &mut T, mut src: T) -> T {
6262
#[unsafe_no_drop_flag]
6363
pub struct NonCopyable;
6464

65-
impl NonCopyable {
66-
// FIXME(#8233) should not be necessary
67-
/// Create a new noncopyable token.
68-
pub fn new() -> NonCopyable { NonCopyable }
69-
}
70-
7165
impl Drop for NonCopyable {
7266
fn drop(&mut self) { }
7367
}

branches/try/src/libsyntax/abi.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ pub enum Abi {
2323
Stdcall,
2424
Fastcall,
2525
Aapcs,
26+
Win64,
2627

2728
// Multiplatform ABIs second
2829
Rust,
@@ -73,6 +74,8 @@ static AbiDatas: &'static [AbiData] = &[
7374
AbiData {abi: Stdcall, name: "stdcall", abi_arch: Archs(IntelBits)},
7475
AbiData {abi: Fastcall, name:"fastcall", abi_arch: Archs(IntelBits)},
7576
AbiData {abi: Aapcs, name: "aapcs", abi_arch: Archs(ArmBits)},
77+
AbiData {abi: Win64, name: "win64",
78+
abi_arch: Archs(1 << (X86_64 as uint))},
7679

7780
// Cross-platform ABIs
7881
//

branches/try/src/libsyntax/ast.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -861,7 +861,6 @@ pub enum ty_ {
861861
ty_bare_fn(@TyBareFn),
862862
ty_tup(~[Ty]),
863863
ty_path(Path, Option<OptVec<TyParamBound>>, NodeId), // for #7264; see above
864-
ty_mac(mac),
865864
ty_typeof(@Expr),
866865
// ty_infer means the type should be inferred instead of it having been
867866
// specified. This should only appear at the "top level" of a type and not

branches/try/src/libsyntax/codemap.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,11 @@ pub trait Pos {
2929
fn to_uint(&self) -> uint;
3030
}
3131

32-
/// A byte offset
32+
/// A byte offset. Keep this small (currently 32-bits), as AST contains
33+
/// a lot of them.
3334
#[deriving(Clone, Eq, IterBytes, Ord)]
34-
pub struct BytePos(uint);
35+
pub struct BytePos(u32);
36+
3537
/// A character offset. Because of multibyte utf8 characters, a byte offset
3638
/// is not equivalent to a character offset. The CodeMap will convert BytePos
3739
/// values to CharPos values as necessary.
@@ -42,8 +44,8 @@ pub struct CharPos(uint);
4244
// have been unsuccessful
4345

4446
impl Pos for BytePos {
45-
fn from_uint(n: uint) -> BytePos { BytePos(n) }
46-
fn to_uint(&self) -> uint { **self }
47+
fn from_uint(n: uint) -> BytePos { BytePos(n as u32) }
48+
fn to_uint(&self) -> uint { **self as uint }
4749
}
4850

4951
impl Add<BytePos, BytePos> for BytePos {
@@ -278,7 +280,7 @@ impl CodeMap {
278280

279281
let filemap = @FileMap {
280282
name: filename, substr: substr, src: src,
281-
start_pos: BytePos(start_pos),
283+
start_pos: Pos::from_uint(start_pos),
282284
lines: @mut ~[],
283285
multibyte_chars: @mut ~[],
284286
};

branches/try/src/libsyntax/fold.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,6 @@ pub trait ast_fold {
277277
ty_fixed_length_vec(ref mt, e) => {
278278
ty_fixed_length_vec(fold_mt(mt, self), self.fold_expr(e))
279279
}
280-
ty_mac(ref mac) => ty_mac(self.fold_mac(mac)),
281280
ty_typeof(expr) => ty_typeof(self.fold_expr(expr)),
282281
};
283282
Ty {

0 commit comments

Comments
 (0)