Skip to content

Commit 7d69837

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents 60245b9 + a4ec8af commit 7d69837

Some content is hidden

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

110 files changed

+1957
-721
lines changed

doc/rust.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3168,7 +3168,7 @@ Raw pointers (`*`)
31683168
: Raw pointers are pointers without safety or liveness guarantees.
31693169
Raw pointers are written `*content`,
31703170
for example `*int` means a raw pointer to an integer.
3171-
Copying or dropping a raw pointer is has no effect on the lifecycle of any other value.
3171+
Copying or dropping a raw pointer has no effect on the lifecycle of any other value.
31723172
Dereferencing a raw pointer or converting it to any other pointer type is an [`unsafe` operation](#unsafe-functions).
31733173
Raw pointers are generally discouraged in Rust code;
31743174
they exist to support interoperability with foreign code,
@@ -3395,16 +3395,23 @@ a [temporary](#lvalues-rvalues-and-temporaries), or a local variable.
33953395
A _local variable_ (or *stack-local* allocation) holds a value directly,
33963396
allocated within the stack's memory. The value is a part of the stack frame.
33973397

3398-
Local variables are immutable unless declared with `let mut`. The
3399-
`mut` keyword applies to all local variables declared within that
3400-
declaration (so `let mut (x, y) = ...` declares two mutable variables, `x` and
3401-
`y`).
3398+
Local variables are immutable unless declared otherwise like: `let mut x = ...`.
34023399

34033400
Function parameters are immutable unless declared with `mut`. The
34043401
`mut` keyword applies only to the following parameter (so `|mut x, y|`
34053402
and `fn f(mut x: ~int, y: ~int)` declare one mutable variable `x` and
34063403
one immutable variable `y`).
34073404

3405+
Methods that take either `self` or `~self` can optionally place them in a
3406+
mutable slot by prefixing them with `mut` (similar to regular arguments):
3407+
3408+
~~~
3409+
trait Changer {
3410+
fn change(mut self) -> Self;
3411+
fn modify(mut ~self) -> ~Self;
3412+
}
3413+
~~~
3414+
34083415
Local variables are not initialized when allocated; the entire frame worth of
34093416
local variables are allocated at once, on frame-entry, in an uninitialized
34103417
state. Subsequent statements within a function may or may not initialize the

doc/tutorial.md

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -151,22 +151,6 @@ declaration to appear at the top level of the file: all statements must
151151
live inside a function. Rust programs can also be compiled as
152152
libraries, and included in other programs.
153153

154-
## Using the rust tool
155-
156-
While using `rustc` directly to generate your executables, and then
157-
running them manually is a perfectly valid way to test your code,
158-
for smaller projects, prototypes, or if you're a beginner, it might be
159-
more convenient to use the `rust` tool.
160-
161-
The `rust` tool provides central access to the other rust tools,
162-
as well as handy shortcuts for directly running source files.
163-
For example, if you have a file `foo.rs` in your current directory,
164-
`rust run foo.rs` would attempt to compile it and, if successful,
165-
directly run the resulting binary.
166-
167-
To get a list of all available commands, simply call `rust` without any
168-
argument.
169-
170154
## Editing Rust code
171155

172156
There are vim highlighting and indentation scripts in the Rust source

mk/tests.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,7 @@ $(3)/stage$(1)/test/rustpkgtest-$(2)$$(X_$(2)): \
370370
$$(SREQ$(1)_T_$(2)_H_$(3)) \
371371
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_LIBSYNTAX_$(2)) \
372372
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_LIBRUSTC_$(2)) \
373+
$$(HBIN$(1)_H_$(3))/rustpkg$$(X_$(2)) \
373374
$$(TBIN$(1)_T_$(2)_H_$(3))/rustpkg$$(X_$(2)) \
374375
$$(TBIN$(1)_T_$(2)_H_$(3))/rustc$$(X_$(2))
375376
@$$(call E, compile_and_link: $$@)

src/libextra/arc.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -521,15 +521,15 @@ fn borrow_rwlock<T:Freeze + Send>(state: *mut RWArcInner<T>) -> *RWLock {
521521

522522
/// The "write permission" token used for RWArc.write_downgrade().
523523
pub struct RWWriteMode<'self, T> {
524-
data: &'self mut T,
525-
token: sync::RWLockWriteMode<'self>,
526-
poison: PoisonOnFail,
524+
priv data: &'self mut T,
525+
priv token: sync::RWLockWriteMode<'self>,
526+
priv poison: PoisonOnFail,
527527
}
528528

529529
/// The "read permission" token used for RWArc.write_downgrade().
530530
pub struct RWReadMode<'self, T> {
531-
data: &'self T,
532-
token: sync::RWLockReadMode<'self>,
531+
priv data: &'self T,
532+
priv token: sync::RWLockReadMode<'self>,
533533
}
534534

535535
impl<'self, T:Freeze + Send> RWWriteMode<'self, T> {

src/libextra/base64.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ pub enum CharacterSet {
2222
/// Contains configuration parameters for `to_base64`.
2323
pub struct Config {
2424
/// Character set to use
25-
char_set: CharacterSet,
25+
priv char_set: CharacterSet,
2626
/// True to pad output with `=` characters
27-
pad: bool,
27+
priv pad: bool,
2828
/// `Some(len)` to wrap lines at `len`, `None` to disable line wrapping
29-
line_length: Option<uint>
29+
priv line_length: Option<uint>
3030
}
3131

3232
/// Configuration for RFC 4648 standard base64 encoding
@@ -318,7 +318,7 @@ mod test {
318318
use std::vec;
319319
320320
do 1000.times {
321-
let times = task_rng().gen_integer_range(1u, 100);
321+
let times = task_rng().gen_range(1u, 100);
322322
let v = vec::from_fn(times, |_| random::<u8>());
323323
assert_eq!(v.to_base64(STANDARD).from_base64().unwrap(), v);
324324
}

src/libextra/bitv.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,9 +226,9 @@ enum Op {Union, Intersect, Assign, Difference}
226226
#[deriving(Clone)]
227227
pub struct Bitv {
228228
/// Internal representation of the bit vector (small or large)
229-
rep: BitvVariant,
229+
priv rep: BitvVariant,
230230
/// The number of valid bits in the internal representation
231-
nbits: uint
231+
priv nbits: uint
232232
}
233233

234234
fn die() -> ! {

src/libextra/crypto/cryptoutil.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ pub mod test {
365365
digest.reset();
366366

367367
while count < total_size {
368-
let next: uint = rng.gen_integer_range(0, 2 * blocksize + 1);
368+
let next: uint = rng.gen_range(0, 2 * blocksize + 1);
369369
let remaining = total_size - count;
370370
let size = if next > remaining { remaining } else { next };
371371
digest.input(buffer.slice_to(size));

src/libextra/ebml.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ impl Doc {
5050
}
5151

5252
pub struct TaggedDoc {
53-
tag: uint,
53+
priv tag: uint,
5454
doc: Doc,
5555
}
5656

src/libextra/fileinput.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ struct FileInput_ {
155155
// "self.fi" -> "self." and renaming FileInput_. Documentation above
156156
// will likely have to be updated to use `let mut in = ...`.
157157
pub struct FileInput {
158-
fi: @mut FileInput_
158+
priv fi: @mut FileInput_
159159
}
160160

161161
impl FileInput {

src/libextra/flate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ mod tests {
113113
let mut r = rand::rng();
114114
let mut words = ~[];
115115
do 20.times {
116-
let range = r.gen_integer_range(1u, 10);
116+
let range = r.gen_range(1u, 10);
117117
words.push(r.gen_vec::<u8>(range));
118118
}
119119
do 20.times {

0 commit comments

Comments
 (0)