Skip to content

Commit 0e67e03

Browse files
committed
---
yaml --- r: 146751 b: refs/heads/try2 c: 020126e h: refs/heads/master i: 146749: a127d31 146747: 275d1ed 146743: e5dcaa0 146735: 739193a 146719: e3dd88c 146687: 06c094d v: v3
1 parent 76812dd commit 0e67e03

File tree

30 files changed

+158
-333
lines changed

30 files changed

+158
-333
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 1dea21f41d28640d8fa6e9d43a55b9a034383f34
8+
refs/heads/try2: 020126ef75e318267415758cf771f25c3ac83bdd
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/configure

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

523-
BIN_SUF=
524-
if [ $CFG_OSTYPE = "pc-mingw32" ]
525-
then
526-
BIN_SUF=.exe
527-
fi
528-
529523
if [ ! -z "$CFG_ENABLE_LOCAL_RUST" ]
530524
then
531-
if [ ! -f ${CFG_LOCAL_RUST_ROOT}/bin/rustc${BIN_SUF} ]
525+
if [ ! -f ${CFG_LOCAL_RUST_ROOT}/bin/rustc ]
532526
then
533527
err "no local rust to use"
534528
else
535-
LRV=`${CFG_LOCAL_RUST_ROOT}/bin/rustc${BIN_SUF} --version`
536-
step_msg "using rustc at: ${CFG_LOCAL_RUST_ROOT} with version: $LRV"
529+
LRV=`${CFG_LOCAL_RUST_ROOT}/bin/rustc --version`
530+
step_msg "using rustc at: ${CFG_LOCAL_RUST_ROOT} with version: " $LRV
537531
fi
538532
fi
539533

branches/try2/doc/rust.md

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

1134-
Extern functions may be called directly from Rust code as Rust uses large,
1135-
contiguous stack segments like C.
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.
11361137

11371138
### Type definitions
11381139

@@ -3161,7 +3162,7 @@ Borrowed pointers (`&`)
31613162
Borrowed pointers arise by (automatic) conversion from owning pointers, managed pointers,
31623163
or by applying the borrowing operator `&` to some other value,
31633164
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`,
3165+
Borrowed pointers are written `&content`, or in some cases `&f/content` for some lifetime-variable `f`,
31653166
for example `&int` means a borrowed pointer to an integer.
31663167
Copying a borrowed pointer is a "shallow" operation:
31673168
it involves only copying the pointer itself.
@@ -3596,9 +3597,9 @@ and releases them back to its environment when they are no longer needed.
35963597
The default implementation of the service-provider interface
35973598
consists of the C runtime functions `malloc` and `free`.
35983599

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.
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.
36023603

36033604
### Built in types
36043605

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

37623763
Additional specific influences can be seen from the following languages:
37633764

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

branches/try2/doc/tutorial.md

Lines changed: 48 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -890,7 +890,9 @@ calling the destructor, and the owner determines whether the object is mutable.
890890

891891
Ownership is recursive, so mutability is inherited recursively and a destructor
892892
destroys the contained tree of owned objects. Variables are top-level owners
893-
and destroy the contained object when they go out of scope.
893+
and destroy the contained object when they go out of scope. A box managed by
894+
the garbage collector starts a new ownership tree, and the destructor is called
895+
when it is collected.
894896

895897
~~~~
896898
// the struct owns the objects contained in the `x` and `y` fields
@@ -1007,6 +1009,51 @@ let mut s = r; // box becomes mutable
10071009
let t = s; // box becomes immutable
10081010
~~~~
10091011

1012+
# Managed boxes
1013+
1014+
A managed box (`@`) is a heap allocation with the lifetime managed by a
1015+
task-local garbage collector. It will be destroyed at some point after there
1016+
are no references left to the box, no later than the end of the task. Managed
1017+
boxes lack an owner, so they start a new ownership tree and don't inherit
1018+
mutability. They do own the contained object, and mutability is defined by the
1019+
type of the managed box (`@` or `@mut`). An object containing a managed box is
1020+
not `Owned`, and can't be sent between tasks.
1021+
1022+
~~~~
1023+
let a = @5; // immutable
1024+
1025+
let mut b = @5; // mutable variable, immutable box
1026+
b = @10;
1027+
1028+
let c = @mut 5; // immutable variable, mutable box
1029+
*c = 10;
1030+
1031+
let mut d = @mut 5; // mutable variable, mutable box
1032+
*d += 5;
1033+
d = @mut 15;
1034+
~~~~
1035+
1036+
A mutable variable and an immutable variable can refer to the same box, given
1037+
that their types are compatible. Mutability of a box is a property of its type,
1038+
however, so for example a mutable handle to an immutable box cannot be
1039+
assigned a reference to a mutable box.
1040+
1041+
~~~~
1042+
let a = @1; // immutable box
1043+
let b = @mut 2; // mutable box
1044+
1045+
let mut c : @int; // declare a variable with type managed immutable int
1046+
let mut d : @mut int; // and one of type managed mutable int
1047+
1048+
c = a; // box type is the same, okay
1049+
d = b; // box type is the same, okay
1050+
~~~~
1051+
1052+
~~~~ {.xfail-test}
1053+
// but b cannot be assigned to c, or a to d
1054+
c = b; // error
1055+
~~~~
1056+
10101057
# Borrowed pointers
10111058

10121059
Rust's borrowed pointers are a general purpose reference type. In contrast with
@@ -1300,52 +1347,6 @@ defined in [`std::vec`] and [`std::str`].
13001347
[`std::vec`]: std/vec/index.html
13011348
[`std::str`]: std/str/index.html
13021349
1303-
# Ownership escape hatches
1304-
1305-
Ownership can cleanly describe tree-like data structures, and borrowed pointers provide non-owning
1306-
references. However, more flexibility is often desired and Rust provides ways to escape from strict
1307-
single parent ownership.
1308-
1309-
The standard library provides the `std::rc::Rc` pointer type to express *shared ownership* over a
1310-
reference counted box. As soon as all of the `Rc` pointers go out of scope, the box and the
1311-
contained value are destroyed.
1312-
1313-
~~~
1314-
use std::rc::Rc;
1315-
1316-
// A fixed-size array allocated in a reference-counted box
1317-
let x = Rc::new([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
1318-
let y = x.clone(); // a new owner
1319-
let z = x; // this moves `x` into `z`, rather than creating a new owner
1320-
1321-
assert_eq!(*z.borrow(), [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
1322-
1323-
let mut a = Rc::new([10, 9, 8, 7, 6, 5, 4, 3, 2, 1]); // the variable is mutable, but not the box
1324-
a = z;
1325-
~~~
1326-
1327-
A garbage collected pointer is provided via `std::gc::Gc`, with a task-local garbage collector
1328-
having ownership of the box. It allows the creation of cycles, and the individual `Gc` pointers do
1329-
not have a destructor.
1330-
1331-
~~~
1332-
use std::gc::Gc;
1333-
1334-
// A fixed-size array allocated in a garbage-collected box
1335-
let x = Gc::new([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
1336-
let y = x; // does not perform a move, unlike with `Rc`
1337-
let z = x;
1338-
1339-
assert_eq!(*z.borrow(), [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
1340-
~~~
1341-
1342-
With shared ownership, mutability cannot be inherited so the boxes are always immutable. However,
1343-
it's possible to use *dynamic* mutability via types like `std::cell::Cell` where freezing is handled
1344-
via dynamic checks and can fail at runtime.
1345-
1346-
The `Rc` and `Gc` types are not sendable, so they cannot be used to share memory between tasks. Safe
1347-
immutable and mutable shared memory is provided by the `extra::arc` module.
1348-
13491350
# Closures
13501351
13511352
Named functions, like those we've seen so far, may not refer to local

branches/try2/src/etc/local_stage0.sh

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

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

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

35-
if [ ! -e ${PREFIX}/bin/rustc${BIN_SUF} ]; then
34+
if [ ! -e ${PREFIX}/bin/rustc ]; then
3635
echo "No local rust installed at ${PREFIX}"
3736
exit 1
3837
fi
@@ -42,9 +41,9 @@ if [ -z $TARG_DIR ]; then
4241
exit 1
4342
fi
4443

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

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

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

3938
pub enum Visibility {

branches/try2/src/librustc/middle/lint.rs

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ pub enum lint {
7575
type_limits,
7676
type_overflow,
7777
unused_unsafe,
78-
unsafe_block,
7978

8079
managed_heap_memory,
8180
owned_heap_memory,
@@ -237,13 +236,6 @@ static lint_table: &'static [(&'static str, LintSpec)] = &[
237236
default: warn
238237
}),
239238

240-
("unsafe_block",
241-
LintSpec {
242-
lint: unsafe_block,
243-
desc: "usage of an `unsafe` block",
244-
default: allow
245-
}),
246-
247239
("unused_variable",
248240
LintSpec {
249241
lint: unused_variable,
@@ -878,7 +870,8 @@ fn check_pat_non_uppercase_statics(cx: &Context, p: &ast::Pat) {
878870

879871
fn check_unused_unsafe(cx: &Context, e: &ast::Expr) {
880872
match e.node {
881-
// Don't warn about generated blocks, that'll just pollute the output.
873+
// Don't warn about generated blocks, that'll just pollute the
874+
// output.
882875
ast::ExprBlock(ref blk) => {
883876
if blk.rules == ast::UnsafeBlock(ast::UserProvided) &&
884877
!cx.tcx.used_unsafe.contains(&blk.id) {
@@ -890,16 +883,6 @@ fn check_unused_unsafe(cx: &Context, e: &ast::Expr) {
890883
}
891884
}
892885

893-
fn check_unsafe_block(cx: &Context, e: &ast::Expr) {
894-
match e.node {
895-
// Don't warn about generated blocks, that'll just pollute the output.
896-
ast::ExprBlock(ref blk) if blk.rules == ast::UnsafeBlock(ast::UserProvided) => {
897-
cx.span_lint(unsafe_block, blk.span, "usage of an `unsafe` block");
898-
}
899-
_ => ()
900-
}
901-
}
902-
903886
fn check_unused_mut_pat(cx: &Context, p: @ast::Pat) {
904887
match p.node {
905888
ast::PatIdent(ast::BindByValue(ast::MutMutable),
@@ -1143,7 +1126,6 @@ impl<'self> Visitor<()> for Context<'self> {
11431126
check_while_true_expr(self, e);
11441127
check_stability(self, e);
11451128
check_unused_unsafe(self, e);
1146-
check_unsafe_block(self, e);
11471129
check_unnecessary_allocation(self, e);
11481130
check_heap_expr(self, e);
11491131

branches/try2/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, Pos};
32+
use syntax::codemap::{Span, dummy_sp, BytePos};
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 + Pos::from_uint(segment_name.len()),
2627+
hi: span.lo + BytePos(segment_name.len()),
26282628
expn_info: span.expn_info,
26292629
};
26302630
self.resolve_error(span,

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

Lines changed: 2 additions & 11 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, Win64};
36+
Cdecl, Aapcs, C, AbiSet};
3737
use util::ppaux::{Repr, UserString};
3838
use middle::trans::type_::Type;
3939

@@ -96,7 +96,6 @@ 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,
10099

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

400399
let tys = foreign_types_for_id(ccx, node_id);
401400
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-
};
410401
let llfn = base::register_fn_llvmty(ccx,
411402
sp,
412403
sym,
413404
node_id,
414-
cconv,
405+
lib::llvm::CCallConv,
415406
llfn_ty);
416407
add_argument_attributes(&tys, llfn);
417408
debug!("register_rust_fn_with_foreign_abi(node_id={:?}, llfn_ty={}, llfn={})",

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,10 @@ 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+
}
563567
};
564568

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

branches/try2/src/librustdoc/html/render.rs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -466,15 +466,14 @@ 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),
477-
clean::ForeignFunctionItem(ref f) => self.generics(&f.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),
478477
_ => {}
479478
}
480479

0 commit comments

Comments
 (0)