Skip to content

Commit c85f0fc

Browse files
committed
---
yaml --- r: 95869 b: refs/heads/dist-snap c: c3089a1 h: refs/heads/master i: 95867: f80d221 v: v3
1 parent bf33041 commit c85f0fc

File tree

30 files changed

+157
-238
lines changed

30 files changed

+157
-238
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: c274a6888410ce3e357e014568b43310ed787d36
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/dist-snap: 94677c18af3b639ac374a265af461e5acfe340ca
9+
refs/heads/dist-snap: c3089a1d314dded358ced2b5fbb4d95397e02467
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1212
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/Makefile.in

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -280,35 +280,35 @@ $(foreach target,$(CFG_TARGET),\
280280
# Standard library variables
281281
######################################################################
282282

283-
STDLIB_CRATE := $(S)src/libstd/lib.rs
283+
STDLIB_CRATE := $(S)src/libstd/std.rs
284284
STDLIB_INPUTS := $(wildcard $(addprefix $(S)src/libstd/, \
285285
*.rs */*.rs */*/*rs */*/*/*rs))
286286

287287
######################################################################
288288
# Extra library variables
289289
######################################################################
290290

291-
EXTRALIB_CRATE := $(S)src/libextra/lib.rs
291+
EXTRALIB_CRATE := $(S)src/libextra/extra.rs
292292
EXTRALIB_INPUTS := $(wildcard $(addprefix $(S)src/libextra/, \
293293
*.rs */*.rs))
294294

295295
######################################################################
296296
# Rust UV library variables
297297
######################################################################
298298

299-
LIBRUSTUV_CRATE := $(S)src/librustuv/lib.rs
299+
LIBRUSTUV_CRATE := $(S)src/librustuv/rustuv.rs
300300
LIBRUSTUV_INPUTS := $(wildcard $(addprefix $(S)src/librustuv/, \
301301
*.rs */*.rs))
302302

303303
######################################################################
304304
# rustc crate variables
305305
######################################################################
306306

307-
COMPILER_CRATE := $(S)src/librustc/lib.rs
307+
COMPILER_CRATE := $(S)src/librustc/rustc.rs
308308
COMPILER_INPUTS := $(wildcard $(addprefix $(S)src/librustc/, \
309309
*.rs */*.rs */*/*.rs */*/*/*.rs))
310310

311-
LIBSYNTAX_CRATE := $(S)src/libsyntax/lib.rs
311+
LIBSYNTAX_CRATE := $(S)src/libsyntax/syntax.rs
312312
LIBSYNTAX_INPUTS := $(wildcard $(addprefix $(S)src/libsyntax/, \
313313
*.rs */*.rs */*/*.rs */*/*/*.rs))
314314

branches/dist-snap/doc/rust.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2063,7 +2063,7 @@ The currently implemented features of the compiler are:
20632063

20642064
* `once_fns` - Onceness guarantees a closure is only executed once. Defining a
20652065
closure as `once` is unlikely to be supported going forward. So
2066-
they are hidden behind this feature until they are to be removed.
2066+
they are hidden behind this feature until they are to be removed.
20672067

20682068
If a feature is promoted to a language feature, then all existing programs will
20692069
start to receive compilation warnings about #[feature] directives which enabled
@@ -2748,10 +2748,11 @@ do k(3) |j| {
27482748

27492749
~~~~ {.ebnf .gram}
27502750
for_expr : "for" pat "in" expr '{' block '}' ;
2751-
~~~~
2751+
~~~~
27522752

2753-
A `for` expression is a syntactic construct for looping over elements
2754-
provided by an implementation of `std::iter::Iterator`.
2753+
A `for` expression is a syntactic construct for looping
2754+
over elements provided by an implementation of
2755+
`std::iterator::Iterator`.
27552756

27562757
An example of a for loop over the contents of a vector:
27572758

branches/dist-snap/doc/tutorial-container.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ heapsort.
6969
## Iteration protocol
7070

7171
The iteration protocol is defined by the `Iterator` trait in the
72-
`std::iter` module. The minimal implementation of the trait is a `next`
72+
`std::iterator` module. The minimal implementation of the trait is a `next`
7373
method, yielding the next element from an iterator object:
7474

7575
~~~

branches/dist-snap/doc/tutorial.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -759,7 +759,6 @@ different type from `Bar(1, 2)`), and tuple structs' _fields_ do not have
759759
names.
760760

761761
For example:
762-
763762
~~~~
764763
struct MyTup(int, int, f64);
765764
let mytup: MyTup = MyTup(10, 20, 30.0);

branches/dist-snap/mk/tools.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ COMPILETEST_CRATE := $(S)src/compiletest/compiletest.rs
1616
COMPILETEST_INPUTS := $(wildcard $(S)src/compiletest/*.rs)
1717

1818
# Rustpkg, the package manager and build system
19-
RUSTPKG_LIB := $(S)src/librustpkg/lib.rs
19+
RUSTPKG_LIB := $(S)src/librustpkg/rustpkg.rs
2020
RUSTPKG_INPUTS := $(wildcard $(S)src/librustpkg/*.rs)
2121

2222
# Rustdoc, the documentation tool
23-
RUSTDOC_LIB := $(S)src/librustdoc/lib.rs
23+
RUSTDOC_LIB := $(S)src/librustdoc/rustdoc.rs
2424
RUSTDOC_INPUTS := $(wildcard $(addprefix $(S)src/librustdoc/, \
2525
*.rs */*.rs */*/*.rs))
2626

branches/dist-snap/src/libextra/lib.rs renamed to branches/dist-snap/src/libextra/extra.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ pub mod uuid;
9898
#[cfg(unicode)]
9999
mod unicode;
100100

101+
#[path="terminfo/terminfo.rs"]
101102
pub mod terminfo;
102103

103104
// Compiler support modules

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,8 @@ pub fn compile_input(sess: Session, cfg: ast::CrateConfig, input: &input,
441441
};
442442
let analysis = phase_3_run_analysis_passes(sess, &expanded_crate);
443443
if stop_after_phase_3(sess) { return; }
444-
let outputs = build_output_filenames(input, outdir, output, [], sess);
444+
let outputs = build_output_filenames(input, outdir, output,
445+
expanded_crate.attrs, sess);
445446
let trans = phase_4_translate_to_llvm(sess, expanded_crate,
446447
&analysis, outputs);
447448
(outputs, trans)

branches/dist-snap/src/librustc/middle/trans/base.rs

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -523,23 +523,16 @@ pub fn get_res_dtor(ccx: @mut CrateContext,
523523
substs: &[ty::t])
524524
-> ValueRef {
525525
let _icx = push_ctxt("trans_res_dtor");
526-
let did = if did.crate != ast::LOCAL_CRATE {
527-
inline::maybe_instantiate_inline(ccx, did)
528-
} else {
529-
did
530-
};
531526
if !substs.is_empty() {
527+
let did = if did.crate != ast::LOCAL_CRATE {
528+
inline::maybe_instantiate_inline(ccx, did)
529+
} else {
530+
did
531+
};
532532
assert_eq!(did.crate, ast::LOCAL_CRATE);
533533
let tsubsts = ty::substs {regions: ty::ErasedRegions,
534534
self_ty: None,
535535
tps: /*bad*/ substs.to_owned() };
536-
537-
// FIXME: #4252: Generic destructors with type bounds are broken.
538-
//
539-
// Since the vtables aren't passed to `monomorphic_fn` here, generic destructors with type
540-
// bounds are broken. Sadly, the `typeck` pass isn't outputting the necessary metadata
541-
// because it does so based on method calls present in the AST. Destructor calls are not yet
542-
// known about at that stage of compilation, since `trans` handles cleanups.
543536
let (val, _) = monomorphize::monomorphic_fn(ccx,
544537
did,
545538
&tsubsts,

branches/dist-snap/src/librustc/middle/trans/glue.rs

Lines changed: 40 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -395,11 +395,39 @@ pub fn trans_struct_drop_flag(bcx: @mut Block, t: ty::t, v0: ValueRef, dtor_did:
395395
let repr = adt::represent_type(bcx.ccx(), t);
396396
let drop_flag = adt::trans_drop_flag_ptr(bcx, repr, v0);
397397
do with_cond(bcx, IsNotNull(bcx, Load(bcx, drop_flag))) |cx| {
398-
trans_struct_drop(cx, t, v0, dtor_did, class_did, substs)
398+
let mut bcx = cx;
399+
400+
// Find and call the actual destructor
401+
let dtor_addr = get_res_dtor(bcx.ccx(), dtor_did,
402+
class_did, substs.tps.clone());
403+
404+
// The second argument is the "self" argument for drop
405+
let params = unsafe {
406+
let ty = Type::from_ref(llvm::LLVMTypeOf(dtor_addr));
407+
ty.element_type().func_params()
408+
};
409+
410+
// Class dtors have no explicit args, so the params should
411+
// just consist of the environment (self)
412+
assert_eq!(params.len(), 1);
413+
414+
let self_arg = PointerCast(bcx, v0, params[0]);
415+
let args = ~[self_arg];
416+
417+
Call(bcx, dtor_addr, args, []);
418+
419+
// Drop the fields
420+
let field_tys = ty::struct_fields(bcx.tcx(), class_did, substs);
421+
for (i, fld) in field_tys.iter().enumerate() {
422+
let llfld_a = adt::trans_field_ptr(bcx, repr, v0, 0, i);
423+
bcx = drop_ty(bcx, llfld_a, fld.mt.ty);
424+
}
425+
426+
bcx
399427
}
400428
}
401429

402-
pub fn trans_struct_drop(bcx: @mut Block, t: ty::t, v0: ValueRef, dtor_did: ast::DefId,
430+
pub fn trans_struct_drop(mut bcx: @mut Block, t: ty::t, v0: ValueRef, dtor_did: ast::DefId,
403431
class_did: ast::DefId, substs: &ty::substs) -> @mut Block {
404432
let repr = adt::represent_type(bcx.ccx(), t);
405433

@@ -417,24 +445,19 @@ pub fn trans_struct_drop(bcx: @mut Block, t: ty::t, v0: ValueRef, dtor_did: ast:
417445
// just consist of the environment (self)
418446
assert_eq!(params.len(), 1);
419447

420-
// Be sure to put all of the fields into a scope so we can use an invoke
421-
// instruction to call the user destructor but still call the field
422-
// destructors if the user destructor fails.
423-
do with_scope(bcx, None, "field drops") |bcx| {
424-
let self_arg = PointerCast(bcx, v0, params[0]);
425-
let args = ~[self_arg];
448+
let self_arg = PointerCast(bcx, v0, params[0]);
449+
let args = ~[self_arg];
426450

427-
// Add all the fields as a value which needs to be cleaned at the end of
428-
// this scope.
429-
let field_tys = ty::struct_fields(bcx.tcx(), class_did, substs);
430-
for (i, fld) in field_tys.iter().enumerate() {
431-
let llfld_a = adt::trans_field_ptr(bcx, repr, v0, 0, i);
432-
add_clean(bcx, llfld_a, fld.mt.ty);
433-
}
451+
Call(bcx, dtor_addr, args, []);
434452

435-
let (_, bcx) = invoke(bcx, dtor_addr, args, []);
436-
bcx
453+
// Drop the fields
454+
let field_tys = ty::struct_fields(bcx.tcx(), class_did, substs);
455+
for (i, fld) in field_tys.iter().enumerate() {
456+
let llfld_a = adt::trans_field_ptr(bcx, repr, v0, 0, i);
457+
bcx = drop_ty(bcx, llfld_a, fld.mt.ty);
437458
}
459+
460+
bcx
438461
}
439462

440463
pub fn make_drop_glue(bcx: @mut Block, v0: ValueRef, t: ty::t) -> @mut Block {

branches/dist-snap/src/librustc/middle/trans/intrinsic.rs

Lines changed: 17 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -74,24 +74,14 @@ pub fn trans_intrinsic(ccx: @mut CrateContext,
7474
}
7575
}
7676

77-
fn copy_intrinsic(bcx: @mut Block, allow_overlap: bool, tp_ty: ty::t) {
77+
fn memcpy_intrinsic(bcx: @mut Block, name: &'static str, tp_ty: ty::t, sizebits: u8) {
7878
let ccx = bcx.ccx();
7979
let lltp_ty = type_of::type_of(ccx, tp_ty);
8080
let align = C_i32(machine::llalign_of_min(ccx, lltp_ty) as i32);
81-
let size = machine::llsize_of(ccx, lltp_ty);
82-
let int_size = machine::llbitsize_of_real(ccx, ccx.int_type);
83-
let name = if allow_overlap {
84-
if int_size == 32 {
85-
"llvm.memmove.p0i8.p0i8.i32"
86-
} else {
87-
"llvm.memmove.p0i8.p0i8.i64"
88-
}
89-
} else {
90-
if int_size == 32 {
91-
"llvm.memcpy.p0i8.p0i8.i32"
92-
} else {
93-
"llvm.memcpy.p0i8.p0i8.i64"
94-
}
81+
let size = match sizebits {
82+
32 => C_i32(machine::llsize_of_real(ccx, lltp_ty) as i32),
83+
64 => C_i64(machine::llsize_of_real(ccx, lltp_ty) as i64),
84+
_ => ccx.sess.fatal("Invalid value for sizebits")
9585
};
9686

9787
let decl = bcx.fcx.llfn;
@@ -105,15 +95,14 @@ pub fn trans_intrinsic(ccx: @mut CrateContext,
10595
RetVoid(bcx);
10696
}
10797

108-
fn memset_intrinsic(bcx: @mut Block, tp_ty: ty::t) {
98+
fn memset_intrinsic(bcx: @mut Block, name: &'static str, tp_ty: ty::t, sizebits: u8) {
10999
let ccx = bcx.ccx();
110100
let lltp_ty = type_of::type_of(ccx, tp_ty);
111101
let align = C_i32(machine::llalign_of_min(ccx, lltp_ty) as i32);
112-
let size = machine::llsize_of(ccx, lltp_ty);
113-
let name = if machine::llbitsize_of_real(ccx, ccx.int_type) == 32 {
114-
"llvm.memset.p0i8.i32"
115-
} else {
116-
"llvm.memset.p0i8.i64"
102+
let size = match sizebits {
103+
32 => C_i32(machine::llsize_of_real(ccx, lltp_ty) as i32),
104+
64 => C_i64(machine::llsize_of_real(ccx, lltp_ty) as i64),
105+
_ => ccx.sess.fatal("Invalid value for sizebits")
117106
};
118107

119108
let decl = bcx.fcx.llfn;
@@ -232,7 +221,7 @@ pub fn trans_intrinsic(ccx: @mut CrateContext,
232221
"abort" => {
233222
let llfn = bcx.ccx().intrinsics.get_copy(&("llvm.trap"));
234223
Call(bcx, llfn, [], []);
235-
Unreachable(bcx);
224+
RetVoid(bcx);
236225
}
237226
"size_of" => {
238227
let tp_ty = substs.tys[0];
@@ -410,9 +399,12 @@ pub fn trans_intrinsic(ccx: @mut CrateContext,
410399
let lladdr = InBoundsGEP(bcx, ptr, [offset]);
411400
Ret(bcx, lladdr);
412401
}
413-
"copy_nonoverlapping_memory" => copy_intrinsic(bcx, false, substs.tys[0]),
414-
"copy_memory" => copy_intrinsic(bcx, true, substs.tys[0]),
415-
"set_memory" => memset_intrinsic(bcx, substs.tys[0]),
402+
"memcpy32" => memcpy_intrinsic(bcx, "llvm.memcpy.p0i8.p0i8.i32", substs.tys[0], 32),
403+
"memcpy64" => memcpy_intrinsic(bcx, "llvm.memcpy.p0i8.p0i8.i64", substs.tys[0], 64),
404+
"memmove32" => memcpy_intrinsic(bcx, "llvm.memmove.p0i8.p0i8.i32", substs.tys[0], 32),
405+
"memmove64" => memcpy_intrinsic(bcx, "llvm.memmove.p0i8.p0i8.i64", substs.tys[0], 64),
406+
"memset32" => memset_intrinsic(bcx, "llvm.memset.p0i8.i32", substs.tys[0], 32),
407+
"memset64" => memset_intrinsic(bcx, "llvm.memset.p0i8.i64", substs.tys[0], 64),
416408
"sqrtf32" => simple_llvm_intrinsic(bcx, "llvm.sqrt.f32", 1),
417409
"sqrtf64" => simple_llvm_intrinsic(bcx, "llvm.sqrt.f64", 1),
418410
"powif32" => simple_llvm_intrinsic(bcx, "llvm.powi.f32", 2),

branches/dist-snap/src/librustc/middle/typeck/check/mod.rs

Lines changed: 48 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3734,7 +3734,7 @@ pub fn check_intrinsic_type(ccx: @mut CrateCtxt, it: @ast::foreign_item) {
37343734
mutbl: ast::MutImmutable
37353735
}))
37363736
}
3737-
"copy_nonoverlapping_memory" => {
3737+
"memcpy32" => {
37383738
(1,
37393739
~[
37403740
ty::mk_ptr(tcx, ty::mt {
@@ -3745,11 +3745,11 @@ pub fn check_intrinsic_type(ccx: @mut CrateCtxt, it: @ast::foreign_item) {
37453745
ty: param(ccx, 0),
37463746
mutbl: ast::MutImmutable
37473747
}),
3748-
ty::mk_uint()
3748+
ty::mk_u32()
37493749
],
37503750
ty::mk_nil())
37513751
}
3752-
"copy_memory" => {
3752+
"memcpy64" => {
37533753
(1,
37543754
~[
37553755
ty::mk_ptr(tcx, ty::mt {
@@ -3760,19 +3760,61 @@ pub fn check_intrinsic_type(ccx: @mut CrateCtxt, it: @ast::foreign_item) {
37603760
ty: param(ccx, 0),
37613761
mutbl: ast::MutImmutable
37623762
}),
3763-
ty::mk_uint()
3763+
ty::mk_u64()
37643764
],
37653765
ty::mk_nil())
37663766
}
3767-
"set_memory" => {
3767+
"memmove32" => {
3768+
(1,
3769+
~[
3770+
ty::mk_ptr(tcx, ty::mt {
3771+
ty: param(ccx, 0),
3772+
mutbl: ast::MutMutable
3773+
}),
3774+
ty::mk_ptr(tcx, ty::mt {
3775+
ty: param(ccx, 0),
3776+
mutbl: ast::MutImmutable
3777+
}),
3778+
ty::mk_u32()
3779+
],
3780+
ty::mk_nil())
3781+
}
3782+
"memmove64" => {
3783+
(1,
3784+
~[
3785+
ty::mk_ptr(tcx, ty::mt {
3786+
ty: param(ccx, 0),
3787+
mutbl: ast::MutMutable
3788+
}),
3789+
ty::mk_ptr(tcx, ty::mt {
3790+
ty: param(ccx, 0),
3791+
mutbl: ast::MutImmutable
3792+
}),
3793+
ty::mk_u64()
3794+
],
3795+
ty::mk_nil())
3796+
}
3797+
"memset32" => {
3798+
(1,
3799+
~[
3800+
ty::mk_ptr(tcx, ty::mt {
3801+
ty: param(ccx, 0),
3802+
mutbl: ast::MutMutable
3803+
}),
3804+
ty::mk_u8(),
3805+
ty::mk_u32()
3806+
],
3807+
ty::mk_nil())
3808+
}
3809+
"memset64" => {
37683810
(1,
37693811
~[
37703812
ty::mk_ptr(tcx, ty::mt {
37713813
ty: param(ccx, 0),
37723814
mutbl: ast::MutMutable
37733815
}),
37743816
ty::mk_u8(),
3775-
ty::mk_uint()
3817+
ty::mk_u64()
37763818
],
37773819
ty::mk_nil())
37783820
}

0 commit comments

Comments
 (0)