Skip to content

Commit 116faec

Browse files
committed
---
yaml --- r: 60395 b: refs/heads/master c: 305331c h: refs/heads/master i: 60393: d85064c 60391: dda1cc5 v: v3
1 parent 740bd39 commit 116faec

40 files changed

+191
-497
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: cf8341fc9e1c18c973a6744ecd7ebb97adbd3025
2+
refs/heads/master: 305331c00fe0b3838479e536903915420c4274ef
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 2d28d645422c1617be58c8ca7ad9a457264ca850
55
refs/heads/try: c50a9d5b664478e533ba1d1d353213d70c8ad589

trunk/.swo

72 KB
Binary file not shown.

trunk/doc/rust.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1562,7 +1562,7 @@ Supported traits for `deriving` are:
15621562

15631563
* Comparison traits: `Eq`, `TotalEq`, `Ord`, `TotalOrd`.
15641564
* Serialization: `Encodable`, `Decodable`. These require `std`.
1565-
* `Clone` and `DeepClone`, to perform (deep) copies.
1565+
* `Clone`, to perform deep copies.
15661566
* `IterBytes`, to iterate over the bytes in a data type.
15671567
* `Rand`, to create a random instance of a data type.
15681568
* `ToStr`, to convert to a string. For a type with this instance,

trunk/doc/tutorial.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2308,8 +2308,8 @@ enum ABC { A, B, C }
23082308
~~~
23092309

23102310
The full list of derivable traits is `Eq`, `TotalEq`, `Ord`,
2311-
`TotalOrd`, `Encodable` `Decodable`, `Clone`, `DeepClone`,
2312-
`IterBytes`, `Rand` and `ToStr`.
2311+
`TotalOrd`, `Encodable` `Decodable`, `Clone`, `IterBytes`, `Rand` and
2312+
`ToStr`.
23132313

23142314
# Modules and crates
23152315

trunk/src/libcore/clone.rs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,6 @@ impl<T> Clone for @mut T {
4848
fn clone(&self) -> @mut T { *self }
4949
}
5050

51-
impl<'self, T> Clone for &'self T {
52-
/// Return a shallow copy of the borrowed pointer.
53-
#[inline(always)]
54-
fn clone(&self) -> &'self T { *self }
55-
}
56-
5751
macro_rules! clone_impl(
5852
($t:ty) => {
5953
impl Clone for $t {
@@ -172,11 +166,3 @@ fn test_managed_mut_clone() {
172166
*b = 10;
173167
assert!(a == b);
174168
}
175-
176-
#[test]
177-
fn test_borrowed_clone() {
178-
let x = 5i;
179-
let y: &int = &x;
180-
let z: &int = (&y).clone();
181-
assert_eq!(*z, 5);
182-
}

trunk/src/libcore/unstable/intrinsics.rs

Lines changed: 68 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,62 +8,119 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
/*!
12-
An attempt to move all intrinsic declarations to a single place,
13-
as mentioned in #3369
14-
The intrinsics are defined in librustc/middle/trans/foreign.rs.
11+
/*! rustc compiler intrinsics.
12+
13+
The corresponding definitions are in librustc/middle/trans/foreign.rs.
14+
15+
# Atomics
16+
17+
The atomic intrinsics provide common atomic operations on machine
18+
words, with multiple possible memory orderings. They obey the same
19+
semantics as C++0x. See the LLVM documentation on [[atomics]].
20+
21+
[atomics]: http://llvm.org/docs/Atomics.html
22+
23+
A quick refresher on memory ordering:
24+
25+
* Acquire - a barrier for aquiring a lock. Subsequent reads and writes
26+
take place after the barrier.
27+
* Release - a barrier for releasing a lock. Preceding reads and writes
28+
take place before the barrier.
29+
* Sequentially consistent - sequentially consistent operations are
30+
guaranteed to happen in order. This is the standard mode for working
31+
with atomic types and is equivalent to Java's `volatile`.
32+
1533
*/
1634

1735
#[abi = "rust-intrinsic"]
1836
pub extern "rust-intrinsic" {
37+
38+
/// Atomic compare and exchange, sequentially consistent.
1939
pub fn atomic_cxchg(dst: &mut int, old: int, src: int) -> int;
40+
/// Atomic compare and exchange, acquire ordering.
2041
pub fn atomic_cxchg_acq(dst: &mut int, old: int, src: int) -> int;
42+
/// Atomic compare and exchange, release ordering.
2143
pub fn atomic_cxchg_rel(dst: &mut int, old: int, src: int) -> int;
2244

45+
/// Atomic load, sequentially consistent.
2346
#[cfg(not(stage0))]
2447
pub fn atomic_load(src: &int) -> int;
48+
/// Atomic load, acquire ordering.
2549
#[cfg(not(stage0))]
2650
pub fn atomic_load_acq(src: &int) -> int;
2751

52+
/// Atomic store, sequentially consistent.
2853
#[cfg(not(stage0))]
2954
pub fn atomic_store(dst: &mut int, val: int);
55+
/// Atomic store, release ordering.
3056
#[cfg(not(stage0))]
3157
pub fn atomic_store_rel(dst: &mut int, val: int);
3258

59+
/// Atomic exchange, sequentially consistent.
3360
pub fn atomic_xchg(dst: &mut int, src: int) -> int;
61+
/// Atomic exchange, acquire ordering.
3462
pub fn atomic_xchg_acq(dst: &mut int, src: int) -> int;
63+
/// Atomic exchange, release ordering.
3564
pub fn atomic_xchg_rel(dst: &mut int, src: int) -> int;
3665

66+
/// Atomic addition, sequentially consistent.
3767
pub fn atomic_xadd(dst: &mut int, src: int) -> int;
68+
/// Atomic addition, acquire ordering.
3869
pub fn atomic_xadd_acq(dst: &mut int, src: int) -> int;
70+
/// Atomic addition, release ordering.
3971
pub fn atomic_xadd_rel(dst: &mut int, src: int) -> int;
4072

73+
/// Atomic subtraction, sequentially consistent.
4174
pub fn atomic_xsub(dst: &mut int, src: int) -> int;
75+
/// Atomic subtraction, acquire ordering.
4276
pub fn atomic_xsub_acq(dst: &mut int, src: int) -> int;
77+
/// Atomic subtraction, release ordering.
4378
pub fn atomic_xsub_rel(dst: &mut int, src: int) -> int;
4479

80+
/// The size of a type in bytes.
81+
///
82+
/// This is the exact number of bytes in memory taken up by a
83+
/// value of the given type. In other words, a memset of this size
84+
/// would *exactly* overwrite a value. When laid out in vectors
85+
/// and structures there may be additional padding between
86+
/// elements.
4587
pub fn size_of<T>() -> uint;
4688

89+
/// Move a value to a memory location containing a value.
90+
///
91+
/// Drop glue is run on the destination, which must contain a
92+
/// valid Rust value.
4793
pub fn move_val<T>(dst: &mut T, src: T);
94+
95+
/// Move a value to an uninitialized memory location.
96+
///
97+
/// Drop glue is not run on the destination.
4898
pub fn move_val_init<T>(dst: &mut T, src: T);
4999

50100
pub fn min_align_of<T>() -> uint;
51101
pub fn pref_align_of<T>() -> uint;
52102

103+
/// Get a static pointer to a type descriptor.
53104
pub fn get_tydesc<T>() -> *();
54105

55-
/// init is unsafe because it returns a zeroed-out datum,
106+
/// Create a value initialized to zero.
107+
///
108+
/// `init` is unsafe because it returns a zeroed-out datum,
56109
/// which is unsafe unless T is POD. We don't have a POD
57-
/// kind yet. (See #4074)
110+
/// kind yet. (See #4074).
58111
pub unsafe fn init<T>() -> T;
59112

113+
/// Create an uninitialized value.
60114
#[cfg(not(stage0))]
61115
pub unsafe fn uninit<T>() -> T;
62116

63-
/// forget is unsafe because the caller is responsible for
64-
/// ensuring the argument is deallocated already
117+
/// Move a value out of scope without running drop glue.
118+
///
119+
/// `forget` is unsafe because the caller is responsible for
120+
/// ensuring the argument is deallocated already.
65121
pub unsafe fn forget<T>(_: T) -> ();
66122

123+
/// Returns `true` if a type requires drop glue.
67124
pub fn needs_drop<T>() -> bool;
68125

69126
// XXX: intrinsic uses legacy modes and has reference to TyDesc
@@ -72,9 +129,12 @@ pub extern "rust-intrinsic" {
72129
// XXX: intrinsic uses legacy modes
73130
//fn frame_address(f: &once fn(*u8));
74131

132+
/// Get the address of the `__morestack` stack growth function.
75133
pub fn morestack_addr() -> *();
76134

135+
/// Equivalent to the `llvm.memmove.p0i8.0i8.i32` intrinsic.
77136
pub fn memmove32(dst: *mut u8, src: *u8, size: u32);
137+
/// Equivalent to the `llvm.memmove.p0i8.0i8.i64` intrinsic.
78138
pub fn memmove64(dst: *mut u8, src: *u8, size: u64);
79139

80140
pub fn sqrtf32(x: f32) -> f32;

trunk/src/librustc/metadata/tydecode.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -470,14 +470,12 @@ fn parse_closure_ty(st: @mut PState, conv: conv_did) -> ty::ClosureTy {
470470
let purity = parse_purity(next(st));
471471
let onceness = parse_onceness(next(st));
472472
let region = parse_region(st);
473-
let bounds = parse_bounds(st, conv);
474473
let sig = parse_sig(st, conv);
475474
ty::ClosureTy {
476475
purity: purity,
477476
sigil: sigil,
478477
onceness: onceness,
479478
region: region,
480-
bounds: bounds.builtin_bounds,
481479
sig: sig
482480
}
483481
}
@@ -542,10 +540,10 @@ pub fn parse_type_param_def_data(data: @~[u8], start: uint,
542540

543541
fn parse_type_param_def(st: @mut PState, conv: conv_did) -> ty::TypeParameterDef {
544542
ty::TypeParameterDef {def_id: parse_def(st, NominalType, conv),
545-
bounds: @parse_bounds(st, conv)}
543+
bounds: parse_bounds(st, conv)}
546544
}
547545

548-
fn parse_bounds(st: @mut PState, conv: conv_did) -> ty::ParamBounds {
546+
fn parse_bounds(st: @mut PState, conv: conv_did) -> @ty::ParamBounds {
549547
let mut param_bounds = ty::ParamBounds {
550548
builtin_bounds: ty::EmptyBuiltinBounds(),
551549
trait_bounds: ~[]
@@ -568,7 +566,7 @@ fn parse_bounds(st: @mut PState, conv: conv_did) -> ty::ParamBounds {
568566
param_bounds.trait_bounds.push(@parse_trait_ref(st, conv));
569567
}
570568
'.' => {
571-
return param_bounds;
569+
return @param_bounds;
572570
}
573571
_ => {
574572
fail!("parse_bounds: bad bounds")

trunk/src/librustc/metadata/tyencode.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -380,9 +380,6 @@ fn enc_closure_ty(w: @io::Writer, cx: @ctxt, ft: &ty::ClosureTy) {
380380
enc_purity(w, ft.purity);
381381
enc_onceness(w, ft.onceness);
382382
enc_region(w, cx, ft.region);
383-
let bounds = ty::ParamBounds {builtin_bounds: ft.bounds,
384-
trait_bounds: ~[]};
385-
enc_bounds(w, cx, &bounds);
386383
enc_fn_sig(w, cx, &ft.sig);
387384
}
388385

@@ -395,7 +392,7 @@ fn enc_fn_sig(w: @io::Writer, cx: @ctxt, fsig: &ty::FnSig) {
395392
enc_ty(w, cx, fsig.output);
396393
}
397394

398-
fn enc_bounds(w: @io::Writer, cx: @ctxt, bs: &ty::ParamBounds) {
395+
fn enc_bounds(w: @io::Writer, cx: @ctxt, bs: @ty::ParamBounds) {
399396
for bs.builtin_bounds.each |bound| {
400397
match bound {
401398
ty::BoundOwned => w.write_char('S'),

trunk/src/librustc/middle/resolve.rs

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ use middle::lint::{allow, level, unused_imports};
2020
use middle::lint::{get_lint_level, get_lint_settings_level};
2121
use middle::pat_util::pat_bindings;
2222

23-
use syntax::ast::{TyParamBound, ty_closure};
2423
use syntax::ast::{RegionTyParamBound, TraitTyParamBound, _mod, add, arm};
2524
use syntax::ast::{binding_mode, bitand, bitor, bitxor, blk};
2625
use syntax::ast::{bind_infer, bind_by_ref, bind_by_copy};
@@ -3733,20 +3732,14 @@ pub impl Resolver {
37333732
type_parameters: &OptVec<TyParam>,
37343733
visitor: ResolveVisitor) {
37353734
for type_parameters.each |type_parameter| {
3736-
for type_parameter.bounds.each |bound| {
3737-
self.resolve_type_parameter_bound(bound, visitor);
3738-
}
3739-
}
3740-
}
3741-
3742-
fn resolve_type_parameter_bound(@mut self,
3743-
type_parameter_bound: &TyParamBound,
3744-
visitor: ResolveVisitor) {
3745-
match *type_parameter_bound {
3746-
TraitTyParamBound(tref) => {
3747-
self.resolve_trait_reference(tref, visitor)
3735+
for type_parameter.bounds.each |&bound| {
3736+
match bound {
3737+
TraitTyParamBound(tref) => {
3738+
self.resolve_trait_reference(tref, visitor)
3739+
}
3740+
RegionTyParamBound => {}
3741+
}
37483742
}
3749-
RegionTyParamBound => {}
37503743
}
37513744
}
37523745

@@ -4077,13 +4070,6 @@ pub impl Resolver {
40774070
}
40784071
}
40794072

4080-
ty_closure(c) => {
4081-
for c.bounds.each |bound| {
4082-
self.resolve_type_parameter_bound(bound, visitor);
4083-
}
4084-
visit_ty(ty, (), visitor);
4085-
}
4086-
40874073
_ => {
40884074
// Just resolve embedded types.
40894075
visit_ty(ty, (), visitor);

trunk/src/librustc/middle/trans/foreign.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -818,7 +818,6 @@ pub fn trans_intrinsic(ccx: @CrateContext,
818818
sigil: ast::BorrowedSigil,
819819
onceness: ast::Many,
820820
region: ty::re_bound(ty::br_anon(0)),
821-
bounds: ty::EmptyBuiltinBounds(),
822821
sig: FnSig {
823822
bound_lifetime_names: opt_vec::Empty,
824823
inputs: ~[ star_u8 ],

trunk/src/librustc/middle/trans/monomorphize.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,6 @@ pub fn normalize_for_monomorphization(tcx: ty::ctxt,
330330
sigil: sigil,
331331
onceness: ast::Many,
332332
region: ty::re_static,
333-
bounds: ty::EmptyBuiltinBounds(),
334333
sig: ty::FnSig {bound_lifetime_names: opt_vec::Empty,
335334
inputs: ~[],
336335
output: ty::mk_nil()}})

trunk/src/librustc/middle/ty.rs

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use middle::typeck;
2222
use middle;
2323
use util::ppaux::{note_and_explain_region, bound_region_to_str};
2424
use util::ppaux::{trait_store_to_str, ty_to_str, vstore_to_str};
25-
use util::ppaux::{Repr, UserString};
25+
use util::ppaux::Repr;
2626
use util::common::{indenter};
2727
use util::enum_set::{EnumSet, CLike};
2828

@@ -390,8 +390,7 @@ pub struct ClosureTy {
390390
sigil: ast::Sigil,
391391
onceness: ast::Onceness,
392392
region: Region,
393-
bounds: BuiltinBounds,
394-
sig: FnSig,
393+
sig: FnSig
395394
}
396395

397396
/**
@@ -686,7 +685,6 @@ pub enum type_err {
686685
terr_int_mismatch(expected_found<IntVarValue>),
687686
terr_float_mismatch(expected_found<ast::float_ty>),
688687
terr_traits(expected_found<ast::def_id>),
689-
terr_builtin_bounds(expected_found<BuiltinBounds>),
690688
}
691689

692690
#[deriving(Eq, IterBytes)]
@@ -709,15 +707,6 @@ pub fn EmptyBuiltinBounds() -> BuiltinBounds {
709707
EnumSet::empty()
710708
}
711709

712-
pub fn AllBuiltinBounds() -> BuiltinBounds {
713-
let mut set = EnumSet::empty();
714-
set.add(BoundCopy);
715-
set.add(BoundStatic);
716-
set.add(BoundOwned);
717-
set.add(BoundConst);
718-
set
719-
}
720-
721710
impl CLike for BuiltinBound {
722711
pub fn to_uint(&self) -> uint {
723712
*self as uint
@@ -3180,7 +3169,6 @@ pub fn adjust_ty(cx: ctxt,
31803169
sigil: s,
31813170
onceness: ast::Many,
31823171
region: r,
3183-
bounds: ty::AllBuiltinBounds(),
31843172
sig: copy b.sig})
31853173
}
31863174
ref b => {
@@ -3709,19 +3697,6 @@ pub fn type_err_to_str(cx: ctxt, err: &type_err) -> ~str {
37093697
item_path_str(cx, values.expected),
37103698
item_path_str(cx, values.found))
37113699
}
3712-
terr_builtin_bounds(values) => {
3713-
if values.expected.is_empty() {
3714-
fmt!("expected no bounds but found `%s`",
3715-
values.found.user_string(cx))
3716-
} else if values.found.is_empty() {
3717-
fmt!("expected bounds `%s` but found no bounds",
3718-
values.expected.user_string(cx))
3719-
} else {
3720-
fmt!("expected bounds `%s` but found bounds `%s`",
3721-
values.expected.user_string(cx),
3722-
values.found.user_string(cx))
3723-
}
3724-
}
37253700
terr_self_substs => {
37263701
~"inconsistent self substitution" // XXX this is more of a bug
37273702
}

0 commit comments

Comments
 (0)