Skip to content

Commit 6eed499

Browse files
committed
---
yaml --- r: 139174 b: refs/heads/try2 c: 9584c60 h: refs/heads/master v: v3
1 parent e5fd1e3 commit 6eed499

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+501
-675
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: e7dbe6cd6f40b5360d6121ce9dba9803f2cf3233
8+
refs/heads/try2: 9584c60871dc712f95a2f37f24853cf3faf6191e
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/doc/tutorial.md

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -579,21 +579,30 @@ Structs are quite similar to C structs and are even laid out the same way in
579579
memory (so you can read from a Rust struct in C, and vice-versa). Use the dot
580580
operator to access struct fields, as in `mypoint.x`.
581581

582-
Inherited mutability means that any field of a struct may be mutable, if the
583-
struct is in a mutable slot (or a field of a struct in a mutable slot, and
584-
so forth).
585-
586582
~~~~
587-
struct Stack {
588-
content: ~[int],
589-
head: uint
583+
struct Point {
584+
x: float,
585+
y: float
590586
}
591587
~~~~
592588

593-
With a value (say, `mystack`) of such a type in a mutable location, you can do
594-
`mystack.head += 1`. But in an immutable location, such an assignment to a
589+
Inherited mutability means that any field of a struct may be mutable, if the
590+
struct is in a mutable slot (or a field of a struct in a mutable slot, and
591+
so forth).
592+
593+
With a value (say, `mypoint`) of such a type in a mutable location, you can do
594+
`mypoint.y += 1.0`. But in an immutable location, such an assignment to a
595595
struct without inherited mutability would result in a type error.
596596

597+
~~~~ {.xfail-test}
598+
# struct Point { x: float, y: float }
599+
let mut mypoint = Point { x: 1.0, y: 1.0 };
600+
let origin = Point { x: 0.0, y: 0.0 };
601+
602+
mypoint.y += 1.0; // mypoint is mutable, and its fields as well
603+
origin.y += 1.0; // ERROR: assigning to immutable field
604+
~~~~
605+
597606
`match` patterns destructure structs. The basic syntax is
598607
`Name { fieldname: pattern, ... }`:
599608

branches/try2/mk/install.mk

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,6 @@ install-host: $(CSREQ$(ISTAGE)_T_$(CFG_BUILD_TRIPLE)_H_$(CFG_BUILD_TRIPLE))
113113
$(Q)$(call INSTALL,$(HB2),$(PHB),rustdoc$(X_$(CFG_BUILD_TRIPLE)))
114114
$(Q)$(call INSTALL,$(HB2),$(PHB),rusti$(X_$(CFG_BUILD_TRIPLE)))
115115
$(Q)$(call INSTALL,$(HB2),$(PHB),rust$(X_$(CFG_BUILD_TRIPLE)))
116-
$(Q)$(call INSTALL,$(HL),$(PHL),$(CFG_LIBRUSTC_$(CFG_BUILD_TRIPLE)))
117-
$(Q)$(call INSTALL,$(HL),$(PHL),$(CFG_LIBRUSTPKG_$(CFG_BUILD_TRIPLE)))
118-
$(Q)$(call INSTALL,$(HL),$(PHL),$(CFG_LIBRUSTDOC_$(CFG_BUILD_TRIPLE)))
119-
$(Q)$(call INSTALL,$(HL),$(PHL),$(CFG_LIBRUSTI_$(CFG_BUILD_TRIPLE)))
120-
$(Q)$(call INSTALL,$(HL),$(PHL),$(CFG_LIBRUST_$(CFG_BUILD_TRIPLE)))
121116
$(Q)$(call INSTALL_LIB,$(HL),$(PHL),$(CORELIB_GLOB_$(CFG_BUILD_TRIPLE)))
122117
$(Q)$(call INSTALL_LIB,$(HL),$(PHL),$(STDLIB_GLOB_$(CFG_BUILD_TRIPLE)))
123118
$(Q)$(call INSTALL_LIB,$(HL),$(PHL),$(LIBRUSTC_GLOB_$(CFG_BUILD_TRIPLE)))
@@ -142,11 +137,6 @@ uninstall:
142137
$(Q)rm -f $(PHB)/rust$(X_$(CFG_BUILD_TRIPLE))
143138
$(Q)rm -f $(PHB)/rustdoc$(X_$(CFG_BUILD_TRIPLE))
144139
$(Q)rm -f $(PHL)/$(CFG_RUSTLLVM_$(CFG_BUILD_TRIPLE))
145-
$(Q)rm -f $(PHL)/$(CFG_LIBRUSTPKG_$(CFG_BUILD_TRIPLE))
146-
$(Q)rm -f $(PHL)/$(CFG_LIBRUSTC_$(CFG_BUILD_TRIPLE))
147-
$(Q)rm -f $(PHL)/$(CFG_LIBRUSTDOC_$(CFG_BUILD_TRIPLE))
148-
$(Q)rm -f $(PHL)/$(CFG_LIBRUSTI_$(CFG_BUILD_TRIPLE))
149-
$(Q)rm -f $(PHL)/$(CFG_LIBRUST_$(CFG_BUILD_TRIPLE))
150140
$(Q)rm -f $(PHL)/$(CFG_RUNTIME_$(CFG_BUILD_TRIPLE))
151141
$(Q)for i in \
152142
$(call HOST_LIB_FROM_HL_GLOB,$(CORELIB_GLOB_$(CFG_BUILD_TRIPLE))) \

branches/try2/src/libcore/condition.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ struct Guard<T, U> {
8484
cond: &'self Condition/&self<T, U>
8585
}
8686

87+
#[unsafe_destructor]
8788
impl<T, U> Drop for Guard/&self<T, U> {
8889
fn finalize(&self) {
8990
unsafe {

branches/try2/src/libcore/core.rc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ pub use path::WindowsPath;
198198
pub use path::PosixPath;
199199

200200
pub use tuple::{CopyableTuple, ImmutableTuple, ExtendedTupleOps};
201-
pub use str::{StrSlice, Trimmable};
201+
pub use str::{StrSlice};
202202
pub use container::{Container, Mutable};
203203
pub use vec::{CopyableVector, ImmutableVector};
204204
pub use vec::{ImmutableEqVector, ImmutableCopyableVector};

branches/try2/src/libcore/io.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1224,15 +1224,17 @@ pub mod fsync {
12241224
arg: Arg<t>,
12251225
}
12261226

1227+
#[unsafe_destructor]
12271228
impl<T:Copy> Drop for Res<T> {
12281229
fn finalize(&self) {
1229-
match self.arg.opt_level {
1230-
None => (),
1231-
Some(level) => {
1232-
// fail hard if not succesful
1233-
fail_unless!(((self.arg.fsync_fn)(self.arg.val, level) != -1));
1230+
match self.arg.opt_level {
1231+
None => (),
1232+
Some(level) => {
1233+
// fail hard if not succesful
1234+
fail_unless!(((self.arg.fsync_fn)(self.arg.val, level)
1235+
!= -1));
1236+
}
12341237
}
1235-
}
12361238
}
12371239
}
12381240

branches/try2/src/libcore/managed.rs

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,23 +49,43 @@ pub pure fn mut_ptr_eq<T>(a: @mut T, b: @mut T) -> bool {
4949
}
5050

5151
#[cfg(notest)]
52-
impl<T:Eq> Eq for @const T {
52+
impl<T:Eq> Eq for @T {
5353
#[inline(always)]
54-
pure fn eq(&self, other: &@const T) -> bool { *(*self) == *(*other) }
54+
pure fn eq(&self, other: &@T) -> bool { *(*self) == *(*other) }
5555
#[inline(always)]
56-
pure fn ne(&self, other: &@const T) -> bool { *(*self) != *(*other) }
56+
pure fn ne(&self, other: &@T) -> bool { *(*self) != *(*other) }
5757
}
5858

5959
#[cfg(notest)]
60-
impl<T:Ord> Ord for @const T {
60+
impl<T:Eq> Eq for @mut T {
6161
#[inline(always)]
62-
pure fn lt(&self, other: &@const T) -> bool { *(*self) < *(*other) }
62+
pure fn eq(&self, other: &@mut T) -> bool { *(*self) == *(*other) }
6363
#[inline(always)]
64-
pure fn le(&self, other: &@const T) -> bool { *(*self) <= *(*other) }
64+
pure fn ne(&self, other: &@mut T) -> bool { *(*self) != *(*other) }
65+
}
66+
67+
#[cfg(notest)]
68+
impl<T:Ord> Ord for @T {
69+
#[inline(always)]
70+
pure fn lt(&self, other: &@T) -> bool { *(*self) < *(*other) }
71+
#[inline(always)]
72+
pure fn le(&self, other: &@T) -> bool { *(*self) <= *(*other) }
73+
#[inline(always)]
74+
pure fn ge(&self, other: &@T) -> bool { *(*self) >= *(*other) }
75+
#[inline(always)]
76+
pure fn gt(&self, other: &@T) -> bool { *(*self) > *(*other) }
77+
}
78+
79+
#[cfg(notest)]
80+
impl<T:Ord> Ord for @mut T {
81+
#[inline(always)]
82+
pure fn lt(&self, other: &@mut T) -> bool { *(*self) < *(*other) }
83+
#[inline(always)]
84+
pure fn le(&self, other: &@mut T) -> bool { *(*self) <= *(*other) }
6585
#[inline(always)]
66-
pure fn ge(&self, other: &@const T) -> bool { *(*self) >= *(*other) }
86+
pure fn ge(&self, other: &@mut T) -> bool { *(*self) >= *(*other) }
6787
#[inline(always)]
68-
pure fn gt(&self, other: &@const T) -> bool { *(*self) > *(*other) }
88+
pure fn gt(&self, other: &@mut T) -> bool { *(*self) > *(*other) }
6989
}
7090

7191
#[test]

branches/try2/src/libcore/option.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,7 @@ fn test_unwrap_resource() {
514514
i: @mut int,
515515
}
516516

517+
#[unsafe_destructor]
517518
impl ::ops::Drop for R {
518519
fn finalize(&self) { *(self.i) += 1; }
519520
}

branches/try2/src/libcore/pipes.rs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,7 @@ struct BufferResource<T> {
350350
351351
}
352352
353+
#[unsafe_destructor]
353354
impl<T> ::ops::Drop for BufferResource<T> {
354355
fn finalize(&self) {
355356
unsafe {
@@ -445,16 +446,17 @@ pub fn try_recv<T:Owned,Tbuffer:Owned>(p: RecvPacketBuffered<T, Tbuffer>)
445446
let p_ = p.unwrap();
446447
let p = unsafe { &*p_ };
447448
449+
#[unsafe_destructor]
448450
struct DropState {
449451
p: &'self PacketHeader,
450452
451453
drop {
452-
if task::failing() {
453-
self.p.state = Terminated;
454-
let old_task = swap_task(&mut self.p.blocked_task,
455-
ptr::null());
456-
if !old_task.is_null() {
457-
unsafe {
454+
unsafe {
455+
if task::failing() {
456+
self.p.state = Terminated;
457+
let old_task = swap_task(&mut self.p.blocked_task,
458+
ptr::null());
459+
if !old_task.is_null() {
458460
rustrt::rust_task_deref(old_task);
459461
}
460462
}
@@ -773,6 +775,7 @@ pub struct SendPacketBuffered<T, Tbuffer> {
773775
mut buffer: Option<BufferResource<Tbuffer>>,
774776
}
775777
778+
#[unsafe_destructor]
776779
impl<T:Owned,Tbuffer:Owned> ::ops::Drop for SendPacketBuffered<T,Tbuffer> {
777780
fn finalize(&self) {
778781
//if self.p != none {
@@ -842,6 +845,7 @@ pub struct RecvPacketBuffered<T, Tbuffer> {
842845
mut buffer: Option<BufferResource<Tbuffer>>,
843846
}
844847
848+
#[unsafe_destructor]
845849
impl<T:Owned,Tbuffer:Owned> ::ops::Drop for RecvPacketBuffered<T,Tbuffer> {
846850
fn finalize(&self) {
847851
//if self.p != none {

branches/try2/src/libcore/prelude.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ pub use path::Path;
3636
pub use path::PosixPath;
3737
pub use path::WindowsPath;
3838
pub use ptr::Ptr;
39-
pub use str::{StrSlice, Trimmable, OwnedStr};
39+
pub use str::{StrSlice, OwnedStr};
4040
pub use to_bytes::IterBytes;
4141
pub use to_str::ToStr;
4242
pub use tuple::{CopyableTuple, ImmutableTuple, ExtendedTupleOps};

0 commit comments

Comments
 (0)