Skip to content

Commit edecc7a

Browse files
committed
---
yaml --- r: 89961 b: refs/heads/master c: 6143400 h: refs/heads/master i: 89959: 345c788 v: v3
1 parent ef13749 commit edecc7a

File tree

26 files changed

+234
-71
lines changed

26 files changed

+234
-71
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: c06ce4c9bf2ce649dafaa695b2d0078d75676c71
2+
refs/heads/master: 6143400aaac2239feb979deebe9777f6edccce1a
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: a6d3e57dca68fde4effdda3e4ae2887aa535fcd6
55
refs/heads/try: b160761e35efcd1207112b3b782c06633cf441a8

trunk/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

trunk/doc/rust.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1131,9 +1131,8 @@ block.
11311131
let fptr: extern "C" fn() -> ~[int] = new_vec;
11321132
~~~~
11331133

1134-
Extern functions may be called from Rust code, but
1135-
caution must be taken with respect to the size of the stack
1136-
segment, just as when calling an extern function normally.
1134+
Extern functions may be called directly from Rust code as Rust uses large,
1135+
contiguous stack segments like C.
11371136

11381137
### Type definitions
11391138

@@ -3162,7 +3161,7 @@ Borrowed pointers (`&`)
31623161
Borrowed pointers arise by (automatic) conversion from owning pointers, managed pointers,
31633162
or by applying the borrowing operator `&` to some other value,
31643163
including [lvalues, rvalues or temporaries](#lvalues-rvalues-and-temporaries).
3165-
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`,
31663165
for example `&int` means a borrowed pointer to an integer.
31673166
Copying a borrowed pointer is a "shallow" operation:
31683167
it involves only copying the pointer itself.
@@ -3597,9 +3596,9 @@ and releases them back to its environment when they are no longer needed.
35973596
The default implementation of the service-provider interface
35983597
consists of the C runtime functions `malloc` and `free`.
35993598

3600-
The runtime memory-management system, in turn, supplies Rust tasks
3601-
with facilities for allocating, extending and releasing stacks,
3602-
as well as allocating and freeing heap data.
3599+
The runtime memory-management system, in turn, supplies Rust tasks with
3600+
facilities for allocating releasing stacks, as well as allocating and freeing
3601+
heap data.
36033602

36043603
### Built in types
36053604

@@ -3762,7 +3761,6 @@ have come and gone during the course of Rust's development:
37623761

37633762
Additional specific influences can be seen from the following languages:
37643763

3765-
* The stack-growth implementation of Go.
37663764
* The structural algebraic types and compilation manager of SML.
37673765
* The attribute and assembly systems of C#.
37683766
* The references and deterministic destructor system of C++.

trunk/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}/

trunk/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

trunk/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 {

trunk/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,

trunk/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={})",

trunk/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));

trunk/src/librustdoc/html/render.rs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -466,14 +466,15 @@ impl DocFolder for Cache {
466466
// Register any generics to their corresponding string. This is used
467467
// when pretty-printing types
468468
match item.inner {
469-
clean::StructItem(ref s) => self.generics(&s.generics),
470-
clean::EnumItem(ref e) => self.generics(&e.generics),
471-
clean::FunctionItem(ref f) => self.generics(&f.generics),
472-
clean::TypedefItem(ref t) => self.generics(&t.generics),
473-
clean::TraitItem(ref t) => self.generics(&t.generics),
474-
clean::ImplItem(ref i) => self.generics(&i.generics),
475-
clean::TyMethodItem(ref i) => self.generics(&i.generics),
476-
clean::MethodItem(ref i) => self.generics(&i.generics),
469+
clean::StructItem(ref s) => self.generics(&s.generics),
470+
clean::EnumItem(ref e) => self.generics(&e.generics),
471+
clean::FunctionItem(ref f) => self.generics(&f.generics),
472+
clean::TypedefItem(ref t) => self.generics(&t.generics),
473+
clean::TraitItem(ref t) => self.generics(&t.generics),
474+
clean::ImplItem(ref i) => self.generics(&i.generics),
475+
clean::TyMethodItem(ref i) => self.generics(&i.generics),
476+
clean::MethodItem(ref i) => self.generics(&i.generics),
477+
clean::ForeignFunctionItem(ref f) => self.generics(&f.generics),
477478
_ => {}
478479
}
479480

trunk/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+
}

trunk/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 */

trunk/src/libstd/ptr.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ pub unsafe fn replace_ptr<T>(dest: *mut T, mut src: T) -> T {
155155
* Reads the value from `*src` and returns it. Does not copy `*src`.
156156
*/
157157
#[inline(always)]
158-
pub unsafe fn read_ptr<T>(src: *mut T) -> T {
158+
pub unsafe fn read_ptr<T>(src: *T) -> T {
159159
let mut tmp: T = intrinsics::uninit();
160160
copy_nonoverlapping_memory(&mut tmp, src, 1);
161161
tmp
@@ -168,7 +168,7 @@ pub unsafe fn read_ptr<T>(src: *mut T) -> T {
168168
#[inline(always)]
169169
pub unsafe fn read_and_zero_ptr<T>(dest: *mut T) -> T {
170170
// Copy the data out from `dest`:
171-
let tmp = read_ptr(dest);
171+
let tmp = read_ptr(&*dest);
172172

173173
// Now zero out `dest`:
174174
zero_memory(dest, 1);

0 commit comments

Comments
 (0)