auto merge of #14164 : alexcrichton/rust/rollup, r=alexcrichton
This commit is contained in:
commit
967366e988
@ -97,7 +97,7 @@ Set lint forbidden
|
||||
Set internal debugging options. Use "-Z help" to print available options.
|
||||
.TP
|
||||
\fB\-C\fR FLAG[=VAL], \fB\-\-codegen\fR FLAG[=VAL]
|
||||
Set a codegen-related flag to the value specifie.d Use "-C help" to print
|
||||
Set a codegen-related flag to the value specified. Use "-C help" to print
|
||||
available flags. See CODEGEN OPTIONS below
|
||||
.TP
|
||||
\fB\-v\fR, \fB\-\-version\fR
|
||||
@ -119,7 +119,7 @@ is invoked.
|
||||
.TP
|
||||
\fBtarget-cpu\fR=help
|
||||
Selects a target processor. If the value is 'help', then a list of available
|
||||
cpus is printed.
|
||||
CPUs is printed.
|
||||
.TP
|
||||
\fBtarget-feature\fR='+feature1 -feature2'
|
||||
A space-separated list of features to enable or disable for the target. A
|
||||
@ -132,7 +132,7 @@ cause rustc to print all known passes and exit. The passes specified are
|
||||
appended at the end of the normal pass manager.
|
||||
.TP
|
||||
\fBllvm-args\fR='-arg1 -arg2'
|
||||
A space-separted list of argument to pass through to LLVM.
|
||||
A space-separated list of arguments to pass through to LLVM.
|
||||
.TP
|
||||
\fBsave-temps\fR
|
||||
If specified, the compiler will save more files (.bc, .o, .no-opt.bc) generated
|
||||
|
@ -13,7 +13,7 @@
|
||||
######################################################################
|
||||
|
||||
# The version number
|
||||
CFG_RELEASE_NUM=0.11
|
||||
CFG_RELEASE_NUM=0.11.0
|
||||
CFG_RELEASE_LABEL=-pre
|
||||
|
||||
ifndef CFG_ENABLE_NIGHTLY
|
||||
|
@ -53,12 +53,12 @@ To generate .pot and .po files, do something like:
|
||||
~~~~
|
||||
po4a --copyright-holder="The Rust Project Developers" \
|
||||
--package-name="Rust" \
|
||||
--package-version="0.11-pre" \
|
||||
--package-version="0.11.0-pre" \
|
||||
-M UTF-8 -L UTF-8 \
|
||||
src/doc/po4a.conf
|
||||
~~~~
|
||||
|
||||
(the version number must be changed if it is not 0.11-pre now.)
|
||||
(the version number must be changed if it is not 0.11.0-pre now.)
|
||||
|
||||
Now you can translate documents with .po files, commonly used with gettext. If
|
||||
you are not familiar with gettext-based translation, please read the online
|
||||
|
@ -5,7 +5,7 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Rust 0.11-pre\n"
|
||||
"Project-Id-Version: Rust 0.11.0-pre\n"
|
||||
"POT-Creation-Date: 2014-02-03 08:13+0900\n"
|
||||
"PO-Revision-Date: 2014-01-13 12:01+0900\n"
|
||||
"Last-Translator: Automatically generated\n"
|
||||
|
@ -5,7 +5,7 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Rust 0.11-pre\n"
|
||||
"Project-Id-Version: Rust 0.11.0-pre\n"
|
||||
"POT-Creation-Date: 2014-02-03 08:13+0900\n"
|
||||
"PO-Revision-Date: 2014-01-13 12:01+0900\n"
|
||||
"Last-Translator: Automatically generated\n"
|
||||
|
@ -5,7 +5,7 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Rust 0.11-pre\n"
|
||||
"Project-Id-Version: Rust 0.11.0-pre\n"
|
||||
"POT-Creation-Date: 2014-02-03 08:13+0900\n"
|
||||
"PO-Revision-Date: 2014-01-13 12:01+0900\n"
|
||||
"Last-Translator: Automatically generated\n"
|
||||
|
@ -5,7 +5,7 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Rust 0.11-pre\n"
|
||||
"Project-Id-Version: Rust 0.11.0-pre\n"
|
||||
"POT-Creation-Date: 2014-02-03 08:13+0900\n"
|
||||
"PO-Revision-Date: 2014-02-03 08:13+0900\n"
|
||||
"Last-Translator: Automatically generated\n"
|
||||
|
@ -5,7 +5,7 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Rust 0.11-pre\n"
|
||||
"Project-Id-Version: Rust 0.11.0-pre\n"
|
||||
"POT-Creation-Date: 2014-02-03 08:13+0900\n"
|
||||
"PO-Revision-Date: 2014-01-13 12:01+0900\n"
|
||||
"Last-Translator: Automatically generated\n"
|
||||
|
@ -5,7 +5,7 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Rust 0.11-pre\n"
|
||||
"Project-Id-Version: Rust 0.11.0-pre\n"
|
||||
"POT-Creation-Date: 2014-02-03 08:13+0900\n"
|
||||
"PO-Revision-Date: 2014-01-13 12:01+0900\n"
|
||||
"Last-Translator: Automatically generated\n"
|
||||
|
@ -5,7 +5,7 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Rust 0.11-pre\n"
|
||||
"Project-Id-Version: Rust 0.11.0-pre\n"
|
||||
"POT-Creation-Date: 2014-02-03 08:13+0900\n"
|
||||
"PO-Revision-Date: 2014-01-13 12:01+0900\n"
|
||||
"Last-Translator: Automatically generated\n"
|
||||
|
@ -5,7 +5,7 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Rust 0.11-pre\n"
|
||||
"Project-Id-Version: Rust 0.11.0-pre\n"
|
||||
"POT-Creation-Date: 2014-02-03 08:13+0900\n"
|
||||
"PO-Revision-Date: 2014-01-13 12:01+0900\n"
|
||||
"Last-Translator: Automatically generated\n"
|
||||
|
@ -5,7 +5,7 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Rust 0.11-pre\n"
|
||||
"Project-Id-Version: Rust 0.11.0-pre\n"
|
||||
"POT-Creation-Date: 2014-02-03 08:13+0900\n"
|
||||
"PO-Revision-Date: 2014-01-13 12:01+0900\n"
|
||||
"Last-Translator: Automatically generated\n"
|
||||
|
@ -5,7 +5,7 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Rust 0.11-pre\n"
|
||||
"Project-Id-Version: Rust 0.11.0-pre\n"
|
||||
"POT-Creation-Date: 2014-02-03 08:13+0900\n"
|
||||
"PO-Revision-Date: 2014-01-13 12:01+0900\n"
|
||||
"Last-Translator: Automatically generated\n"
|
||||
|
@ -5,7 +5,7 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Rust 0.11-pre\n"
|
||||
"Project-Id-Version: Rust 0.11.0-pre\n"
|
||||
"POT-Creation-Date: 2014-02-03 08:13+0900\n"
|
||||
"PO-Revision-Date: 2014-02-03 08:13+0900\n"
|
||||
"Last-Translator: Automatically generated\n"
|
||||
|
@ -5,7 +5,7 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Rust 0.11-pre\n"
|
||||
"Project-Id-Version: Rust 0.11.0-pre\n"
|
||||
"POT-Creation-Date: 2014-02-03 08:13+0900\n"
|
||||
"PO-Revision-Date: 2014-01-13 12:01+0900\n"
|
||||
"Last-Translator: Automatically generated\n"
|
||||
|
@ -5,7 +5,7 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Rust 0.11-pre\n"
|
||||
"Project-Id-Version: Rust 0.11.0-pre\n"
|
||||
"POT-Creation-Date: 2014-02-03 08:13+0900\n"
|
||||
"PO-Revision-Date: 2014-01-13 12:01+0900\n"
|
||||
"Last-Translator: Automatically generated\n"
|
||||
|
@ -5,7 +5,7 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Rust 0.11-pre\n"
|
||||
"Project-Id-Version: Rust 0.11.0-pre\n"
|
||||
"POT-Creation-Date: 2014-02-03 08:13+0900\n"
|
||||
"PO-Revision-Date: 2014-01-14 21:02+0900\n"
|
||||
"Last-Translator: Automatically generated\n"
|
||||
|
@ -5,7 +5,7 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Rust 0.11-pre\n"
|
||||
"Project-Id-Version: Rust 0.11.0-pre\n"
|
||||
"POT-Creation-Date: 2014-02-03 08:13+0900\n"
|
||||
"PO-Revision-Date: 2014-01-13 12:01+0900\n"
|
||||
"Last-Translator: Automatically generated\n"
|
||||
|
@ -208,7 +208,7 @@ The keywords are the following strings:
|
||||
~~~~ {.notrust .keyword}
|
||||
as
|
||||
box break
|
||||
crate
|
||||
continue crate
|
||||
else enum extern
|
||||
false fn for
|
||||
if impl in
|
||||
@ -2924,9 +2924,7 @@ while i < 10 {
|
||||
|
||||
### Infinite loops
|
||||
|
||||
The keyword `loop` in Rust appears both in _loop expressions_ and in _continue expressions_.
|
||||
A loop expression denotes an infinite loop;
|
||||
see [Continue expressions](#continue-expressions) for continue expressions.
|
||||
A `loop` expression denotes an infinite loop.
|
||||
|
||||
~~~~ {.notrust .ebnf .gram}
|
||||
loop_expr : [ lifetime ':' ] "loop" '{' block '}';
|
||||
@ -2934,8 +2932,8 @@ loop_expr : [ lifetime ':' ] "loop" '{' block '}';
|
||||
|
||||
A `loop` expression may optionally have a _label_.
|
||||
If a label is present,
|
||||
then labeled `break` and `loop` expressions nested within this loop may exit out of this loop or return control to its head.
|
||||
See [Break expressions](#break-expressions).
|
||||
then labeled `break` and `continue` expressions nested within this loop may exit out of this loop or return control to its head.
|
||||
See [Break expressions](#break-expressions) and [Continue expressions](#continue-expressions).
|
||||
|
||||
### Break expressions
|
||||
|
||||
@ -2953,21 +2951,21 @@ but must enclose it.
|
||||
### Continue expressions
|
||||
|
||||
~~~~ {.notrust .ebnf .gram}
|
||||
continue_expr : "loop" [ lifetime ];
|
||||
continue_expr : "continue" [ lifetime ];
|
||||
~~~~
|
||||
|
||||
A continue expression, written `loop`, also has an optional `label`.
|
||||
A `continue` expression has an optional `label`.
|
||||
If the label is absent,
|
||||
then executing a `loop` expression immediately terminates the current iteration of the innermost loop enclosing it,
|
||||
then executing a `continue` expression immediately terminates the current iteration of the innermost loop enclosing it,
|
||||
returning control to the loop *head*.
|
||||
In the case of a `while` loop,
|
||||
the head is the conditional expression controlling the loop.
|
||||
In the case of a `for` loop, the head is the call-expression controlling the loop.
|
||||
If the label is present, then `loop foo` returns control to the head of the loop with label `foo`,
|
||||
If the label is present, then `continue foo` returns control to the head of the loop with label `foo`,
|
||||
which need not be the innermost label enclosing the `break` expression,
|
||||
but must enclose it.
|
||||
|
||||
A `loop` expression is only permitted in the body of a loop.
|
||||
A `continue` expression is only permitted in the body of a loop.
|
||||
|
||||
### For expressions
|
||||
|
||||
@ -4008,26 +4006,15 @@ compiler must at some point make a choice between these two formats. With this
|
||||
in mind, the compiler follows these rules when determining what format of
|
||||
dependencies will be used:
|
||||
|
||||
1. If a dynamic library is being produced, then it is required for all upstream
|
||||
Rust dependencies to also be dynamic. This is a limitation of the current
|
||||
implementation of the linkage model. The reason behind this limitation is to
|
||||
prevent multiple copies of the same upstream library from showing up, and in
|
||||
the future it is planned to support a mixture of dynamic and static linking.
|
||||
|
||||
When producing a dynamic library, the compiler will generate an error if an
|
||||
upstream dependency could not be found, and also if an upstream dependency
|
||||
could only be found in an `rlib` format. Remember that `staticlib` formats
|
||||
are always ignored by `rustc` for crate-linking purposes.
|
||||
|
||||
2. If a static library is being produced, all upstream dependencies are
|
||||
1. If a static library is being produced, all upstream dependencies are
|
||||
required to be available in `rlib` formats. This requirement stems from the
|
||||
same reasons that a dynamic library must have all dynamic dependencies.
|
||||
reason that a dynamic library cannot be converted into a static format.
|
||||
|
||||
Note that it is impossible to link in native dynamic dependencies to a static
|
||||
library, and in this case warnings will be printed about all unlinked native
|
||||
dynamic dependencies.
|
||||
|
||||
3. If an `rlib` file is being produced, then there are no restrictions on what
|
||||
2. If an `rlib` file is being produced, then there are no restrictions on what
|
||||
format the upstream dependencies are available in. It is simply required that
|
||||
all upstream dependencies be available for reading metadata from.
|
||||
|
||||
@ -4035,18 +4022,29 @@ dependencies will be used:
|
||||
dependencies. It wouldn't be very efficient for all `rlib` files to contain a
|
||||
copy of `libstd.rlib`!
|
||||
|
||||
4. If an executable is being produced, then things get a little interesting. As
|
||||
with the above limitations in dynamic and static libraries, it is required
|
||||
for all upstream dependencies to be in the same format. The next question is
|
||||
whether to prefer a dynamic or a static format. The compiler currently favors
|
||||
static linking over dynamic linking, but this can be inverted with the `-C
|
||||
prefer-dynamic` flag to the compiler.
|
||||
3. If an executable is being produced and the `-C prefer-dynamic` flag is not
|
||||
specified, then dependencies are first attempted to be found in the `rlib`
|
||||
format. If some dependencies are not available in an rlib format, then
|
||||
dynamic linking is attempted (see below).
|
||||
|
||||
What this means is that first the compiler will attempt to find all upstream
|
||||
dependencies as `rlib` files, and if successful, it will create a statically
|
||||
linked executable. If an upstream dependency is missing as an `rlib` file,
|
||||
then the compiler will force all dependencies to be dynamic and will generate
|
||||
errors if dynamic versions could not be found.
|
||||
4. If a dynamic library or an executable that is being dynamically linked is
|
||||
being produced, then the compiler will attempt to reconcile the available
|
||||
dependencies in either the rlib or dylib format to create a final product.
|
||||
|
||||
A major goal of the compiler is to ensure that a library never appears more
|
||||
than once in any artifact. For example, if dynamic libraries B and C were
|
||||
each statically linked to library A, then a crate could not link to B and C
|
||||
together because there would be two copies of A. The compiler allows mixing
|
||||
the rlib and dylib formats, but this restriction must be satisfied.
|
||||
|
||||
The compiler currently implements no method of hinting what format a library
|
||||
should be linked with. When dynamically linking, the compiler will attempt to
|
||||
maximize dynamic dependencies while still allowing some dependencies to be
|
||||
linked in via an rlib.
|
||||
|
||||
For most situations, having all libraries available as a dylib is recommended
|
||||
if dynamically linking. For other situations, the compiler will emit a
|
||||
warning if it is unable to determine which formats to link each library with.
|
||||
|
||||
In general, `--crate-type=bin` or `--crate-type=lib` should be sufficient for
|
||||
all compilation needs, and the other options are just available if more
|
||||
|
@ -2155,7 +2155,7 @@ unless they contain references.
|
||||
|
||||
* `Share` - Types that are *threadsafe*
|
||||
These are types that are safe to be used across several threads with access to
|
||||
a `&T` pointer. `MutexArc` is an example of a *sharable* type with internal mutable data.
|
||||
a `&T` pointer. `Mutex<T>` is an example of a *sharable* type with internal mutable data.
|
||||
|
||||
* `'static` - Non-borrowed types.
|
||||
These are types that do not contain any data whose lifetime is bound to
|
||||
|
@ -1,4 +1,6 @@
|
||||
# Copyright 2013 The Rust Project Developers. See the COPYRIGHT
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
|
||||
# file at the top-level directory of this distribution and at
|
||||
# http://rust-lang.org/COPYRIGHT.
|
||||
#
|
||||
|
@ -1,3 +1,5 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
|
||||
# file at the top-level directory of this distribution and at
|
||||
# http://rust-lang.org/COPYRIGHT.
|
||||
|
@ -217,7 +217,7 @@
|
||||
1 font-lock-preprocessor-face)
|
||||
|
||||
;; Syntax extension invocations like `foo!`, highlight including the !
|
||||
(,(concat (rust-re-grab (concat rust-re-ident "!")) "[({[:space:]]")
|
||||
(,(concat (rust-re-grab (concat rust-re-ident "!")) "[({[:space:][]")
|
||||
1 font-lock-preprocessor-face)
|
||||
|
||||
;; Field names like `foo:`, highlight excluding the :
|
||||
|
@ -1,3 +1,5 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
|
||||
# file at the top-level directory of this distribution and at
|
||||
# http://rust-lang.org/COPYRIGHT.
|
||||
|
@ -1,4 +1,6 @@
|
||||
# Copyright 2011-2013 The Rust Project Developers. See the COPYRIGHT
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# Copyright 2011-2014 The Rust Project Developers. See the COPYRIGHT
|
||||
# file at the top-level directory of this distribution and at
|
||||
# http://rust-lang.org/COPYRIGHT.
|
||||
#
|
||||
|
@ -7,7 +7,7 @@
|
||||
<!ENTITY rustIdent "[a-zA-Z_][a-zA-Z_0-9]*">
|
||||
<!ENTITY rustIntSuf "([iu](8|16|32|64)?)?">
|
||||
]>
|
||||
<language name="Rust" version="0.11-pre" kateversion="2.4" section="Sources" extensions="*.rs" mimetype="text/x-rust" priority="15">
|
||||
<language name="Rust" version="0.11.0-pre" kateversion="2.4" section="Sources" extensions="*.rs" mimetype="text/x-rust" priority="15">
|
||||
<highlighting>
|
||||
<list name="fn">
|
||||
<item> fn </item>
|
||||
|
@ -1,4 +1,6 @@
|
||||
# Copyright 2011-2013 The Rust Project Developers. See the COPYRIGHT
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# Copyright 2011-2014 The Rust Project Developers. See the COPYRIGHT
|
||||
# file at the top-level directory of this distribution and at
|
||||
# http://rust-lang.org/COPYRIGHT.
|
||||
#
|
||||
|
@ -15,7 +15,7 @@
|
||||
//! of individual objects while the arena itself is still alive. The benefit
|
||||
//! of an arena is very fast allocation; just a pointer bump.
|
||||
|
||||
#![crate_id = "arena#0.11-pre"]
|
||||
#![crate_id = "arena#0.11.0-pre"]
|
||||
#![crate_type = "rlib"]
|
||||
#![crate_type = "dylib"]
|
||||
#![license = "MIT/ASL2"]
|
||||
|
@ -12,7 +12,7 @@
|
||||
* Collection types.
|
||||
*/
|
||||
|
||||
#![crate_id = "collections#0.11-pre"]
|
||||
#![crate_id = "collections#0.11.0-pre"]
|
||||
#![crate_type = "rlib"]
|
||||
#![crate_type = "dylib"]
|
||||
#![license = "MIT/ASL2"]
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
//! The Rust core library
|
||||
|
||||
#![crate_id = "core#0.11-pre"]
|
||||
#![crate_id = "core#0.11.0-pre"]
|
||||
#![license = "MIT/ASL2"]
|
||||
#![crate_type = "rlib"]
|
||||
#![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
|
||||
|
@ -30,20 +30,23 @@
|
||||
//! of a value and take action, always accounting for the `None` case.
|
||||
//!
|
||||
//! ```
|
||||
//! # // FIXME This is not the greatest first example
|
||||
//! // cow_says contains the word "moo"
|
||||
//! let cow_says = Some("moo");
|
||||
//! // dog_says does not contain a value
|
||||
//! let dog_says: Option<&str> = None;
|
||||
//! fn divide(numerator: f64, denominator: f64) -> Option<f64> {
|
||||
//! if denominator == 0.0 {
|
||||
//! None
|
||||
//! } else {
|
||||
//! Some(numerator / denominator)
|
||||
//! }
|
||||
//! }
|
||||
//!
|
||||
//! // The return value of the function is an option
|
||||
//! let result = divide(2.0, 3.0);
|
||||
//!
|
||||
//! // Pattern match to retrieve the value
|
||||
//! match (cow_says, dog_says) {
|
||||
//! (Some(cow_words), Some(dog_words)) => {
|
||||
//! println!("Cow says {} and dog says {}!", cow_words, dog_words);
|
||||
//! }
|
||||
//! (Some(cow_words), None) => println!("Cow says {}", cow_words),
|
||||
//! (None, Some(dog_words)) => println!("Dog says {}", dog_words),
|
||||
//! (None, None) => println!("Cow and dog are suspiciously silent")
|
||||
//! match result {
|
||||
//! // The division was valid
|
||||
//! Some(x) => println!("Result: {}", x),
|
||||
//! // The division was invalid
|
||||
//! None => println!("Cannot divide by 0")
|
||||
//! }
|
||||
//! ```
|
||||
//!
|
||||
|
@ -505,7 +505,7 @@ pub trait ImmutableVector<'a, T> {
|
||||
fn bsearch(&self, f: |&T| -> Ordering) -> Option<uint>;
|
||||
|
||||
/**
|
||||
* Returns a mutable reference to the first element in this slice
|
||||
* Returns an immutable reference to the first element in this slice
|
||||
* and adjusts the slice in place so that it no longer contains
|
||||
* that element. O(1).
|
||||
*
|
||||
@ -523,7 +523,7 @@ pub trait ImmutableVector<'a, T> {
|
||||
fn shift_ref(&mut self) -> Option<&'a T>;
|
||||
|
||||
/**
|
||||
* Returns a mutable reference to the last element in this slice
|
||||
* Returns an immutable reference to the last element in this slice
|
||||
* and adjusts the slice in place so that it no longer contains
|
||||
* that element. O(1).
|
||||
*
|
||||
@ -693,18 +693,22 @@ impl<'a,T> ImmutableVector<'a, T> for &'a [T] {
|
||||
}
|
||||
|
||||
fn shift_ref(&mut self) -> Option<&'a T> {
|
||||
if self.len() == 0 { return None; }
|
||||
unsafe {
|
||||
let s: &mut Slice<T> = transmute(self);
|
||||
Some(&*raw::shift_ptr(s))
|
||||
match raw::shift_ptr(s) {
|
||||
Some(p) => Some(&*p),
|
||||
None => None
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn pop_ref(&mut self) -> Option<&'a T> {
|
||||
if self.len() == 0 { return None; }
|
||||
unsafe {
|
||||
let s: &mut Slice<T> = transmute(self);
|
||||
Some(&*raw::pop_ptr(s))
|
||||
match raw::pop_ptr(s) {
|
||||
Some(p) => Some(&*p),
|
||||
None => None
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1059,22 +1063,26 @@ impl<'a,T> MutableVector<'a, T> for &'a mut [T] {
|
||||
}
|
||||
|
||||
fn mut_shift_ref(&mut self) -> Option<&'a mut T> {
|
||||
if self.len() == 0 { return None; }
|
||||
unsafe {
|
||||
let s: &mut Slice<T> = transmute(self);
|
||||
// FIXME #13933: this `&` -> `&mut` cast is a little
|
||||
// dubious
|
||||
Some(&mut *(raw::shift_ptr(s) as *mut _))
|
||||
match raw::shift_ptr(s) {
|
||||
// FIXME #13933: this `&` -> `&mut` cast is a little
|
||||
// dubious
|
||||
Some(p) => Some(&mut *(p as *mut _)),
|
||||
None => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn mut_pop_ref(&mut self) -> Option<&'a mut T> {
|
||||
if self.len() == 0 { return None; }
|
||||
unsafe {
|
||||
let s: &mut Slice<T> = transmute(self);
|
||||
// FIXME #13933: this `&` -> `&mut` cast is a little
|
||||
// dubious
|
||||
Some(&mut *(raw::pop_ptr(s) as *mut _))
|
||||
match raw::pop_ptr(s) {
|
||||
// FIXME #13933: this `&` -> `&mut` cast is a little
|
||||
// dubious
|
||||
Some(p) => Some(&mut *(p as *mut _)),
|
||||
None => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1165,6 +1173,7 @@ pub mod raw {
|
||||
use iter::Iterator;
|
||||
use ptr::RawPtr;
|
||||
use raw::Slice;
|
||||
use option::{None, Option, Some};
|
||||
|
||||
/**
|
||||
* Form a slice from a pointer and length (as a number of units,
|
||||
@ -1198,27 +1207,29 @@ pub mod raw {
|
||||
|
||||
/**
|
||||
* Returns a pointer to first element in slice and adjusts
|
||||
* slice so it no longer contains that element. Fails if
|
||||
* slice is empty. O(1).
|
||||
* slice so it no longer contains that element. Returns None
|
||||
* if the slice is empty. O(1).
|
||||
*/
|
||||
pub unsafe fn shift_ptr<T>(slice: &mut Slice<T>) -> *T {
|
||||
if slice.len == 0 { fail!("shift on empty slice"); }
|
||||
#[inline]
|
||||
pub unsafe fn shift_ptr<T>(slice: &mut Slice<T>) -> Option<*T> {
|
||||
if slice.len == 0 { return None; }
|
||||
let head: *T = slice.data;
|
||||
slice.data = slice.data.offset(1);
|
||||
slice.len -= 1;
|
||||
head
|
||||
Some(head)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a pointer to last element in slice and adjusts
|
||||
* slice so it no longer contains that element. Fails if
|
||||
* slice is empty. O(1).
|
||||
* slice so it no longer contains that element. Returns None
|
||||
* if the slice is empty. O(1).
|
||||
*/
|
||||
pub unsafe fn pop_ptr<T>(slice: &mut Slice<T>) -> *T {
|
||||
if slice.len == 0 { fail!("pop on empty slice"); }
|
||||
#[inline]
|
||||
pub unsafe fn pop_ptr<T>(slice: &mut Slice<T>) -> Option<*T> {
|
||||
if slice.len == 0 { return None; }
|
||||
let tail: *T = slice.data.offset((slice.len - 1) as int);
|
||||
slice.len -= 1;
|
||||
tail
|
||||
Some(tail)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,7 @@ Simple compression
|
||||
|
||||
*/
|
||||
|
||||
#![crate_id = "flate#0.11-pre"]
|
||||
#![crate_id = "flate#0.11.0-pre"]
|
||||
#![crate_type = "rlib"]
|
||||
#![crate_type = "dylib"]
|
||||
#![license = "MIT/ASL2"]
|
||||
|
@ -14,7 +14,7 @@
|
||||
//! Parsing does not happen at runtime: structures of `std::fmt::rt` are
|
||||
//! generated instead.
|
||||
|
||||
#![crate_id = "fmt_macros#0.11-pre"]
|
||||
#![crate_id = "fmt_macros#0.11.0-pre"]
|
||||
#![license = "MIT/ASL2"]
|
||||
#![crate_type = "rlib"]
|
||||
#![crate_type = "dylib"]
|
||||
|
@ -39,7 +39,7 @@ fn main() {
|
||||
|
||||
*/
|
||||
|
||||
#![crate_id = "fourcc#0.11-pre"]
|
||||
#![crate_id = "fourcc#0.11.0-pre"]
|
||||
#![crate_type = "rlib"]
|
||||
#![crate_type = "dylib"]
|
||||
#![license = "MIT/ASL2"]
|
||||
|
@ -76,7 +76,7 @@
|
||||
//! }
|
||||
//! ~~~
|
||||
|
||||
#![crate_id = "getopts#0.11-pre"]
|
||||
#![crate_id = "getopts#0.11.0-pre"]
|
||||
#![crate_type = "rlib"]
|
||||
#![crate_type = "dylib"]
|
||||
#![license = "MIT/ASL2"]
|
||||
|
@ -23,7 +23,7 @@
|
||||
* `glob`/`fnmatch` functions.
|
||||
*/
|
||||
|
||||
#![crate_id = "glob#0.11-pre"]
|
||||
#![crate_id = "glob#0.11.0-pre"]
|
||||
#![crate_type = "rlib"]
|
||||
#![crate_type = "dylib"]
|
||||
#![license = "MIT/ASL2"]
|
||||
|
@ -266,7 +266,7 @@ pub fn main() {
|
||||
|
||||
*/
|
||||
|
||||
#![crate_id = "graphviz#0.11-pre"]
|
||||
#![crate_id = "graphviz#0.11.0-pre"]
|
||||
#![crate_type = "rlib"]
|
||||
#![crate_type = "dylib"]
|
||||
#![license = "MIT/ASL2"]
|
||||
|
@ -197,7 +197,7 @@
|
||||
//! pool.shutdown();
|
||||
//! ```
|
||||
|
||||
#![crate_id = "green#0.11-pre"]
|
||||
#![crate_id = "green#0.11.0-pre"]
|
||||
#![license = "MIT/ASL2"]
|
||||
#![crate_type = "rlib"]
|
||||
#![crate_type = "dylib"]
|
||||
|
@ -36,7 +36,7 @@ fn main() {
|
||||
|
||||
*/
|
||||
|
||||
#![crate_id = "hexfloat#0.11-pre"]
|
||||
#![crate_id = "hexfloat#0.11.0-pre"]
|
||||
#![crate_type = "rlib"]
|
||||
#![crate_type = "dylib"]
|
||||
#![license = "MIT/ASL2"]
|
||||
|
@ -9,7 +9,7 @@
|
||||
// except according to those terms.
|
||||
|
||||
#![feature(globs)]
|
||||
#![crate_id = "libc#0.11-pre"]
|
||||
#![crate_id = "libc#0.11.0-pre"]
|
||||
#![experimental]
|
||||
#![no_std] // we don't need std, and we can't have std, since it doesn't exist
|
||||
// yet. std depends on us.
|
||||
|
@ -105,7 +105,7 @@ if logging is disabled, none of the components of the log will be executed.
|
||||
|
||||
*/
|
||||
|
||||
#![crate_id = "log#0.11-pre"]
|
||||
#![crate_id = "log#0.11.0-pre"]
|
||||
#![license = "MIT/ASL2"]
|
||||
#![crate_type = "rlib"]
|
||||
#![crate_type = "dylib"]
|
||||
|
@ -166,6 +166,14 @@ impl rtio::RtioFileStream for FileDesc {
|
||||
libc::ftruncate(self.fd(), offset as libc::off_t)
|
||||
}))
|
||||
}
|
||||
|
||||
fn fstat(&mut self) -> IoResult<io::FileStat> {
|
||||
let mut stat: libc::stat = unsafe { mem::uninit() };
|
||||
match retry(|| unsafe { libc::fstat(self.fd(), &mut stat) }) {
|
||||
0 => Ok(mkstat(&stat)),
|
||||
_ => Err(super::last_error()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl rtio::RtioPipe for FileDesc {
|
||||
@ -317,6 +325,10 @@ impl rtio::RtioFileStream for CFile {
|
||||
fn truncate(&mut self, offset: i64) -> Result<(), IoError> {
|
||||
self.flush().and_then(|()| self.fd.truncate(offset))
|
||||
}
|
||||
|
||||
fn fstat(&mut self) -> IoResult<io::FileStat> {
|
||||
self.flush().and_then(|()| self.fd.fstat())
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for CFile {
|
||||
@ -455,9 +467,7 @@ pub fn link(src: &CString, dst: &CString) -> IoResult<()> {
|
||||
}))
|
||||
}
|
||||
|
||||
fn mkstat(stat: &libc::stat, path: &CString) -> io::FileStat {
|
||||
let path = unsafe { CString::new(path.with_ref(|p| p), false) };
|
||||
|
||||
fn mkstat(stat: &libc::stat) -> io::FileStat {
|
||||
// FileStat times are in milliseconds
|
||||
fn mktime(secs: u64, nsecs: u64) -> u64 { secs * 1000 + nsecs / 1000000 }
|
||||
|
||||
@ -481,7 +491,6 @@ fn mkstat(stat: &libc::stat, path: &CString) -> io::FileStat {
|
||||
fn gen(_stat: &libc::stat) -> u64 { 0 }
|
||||
|
||||
io::FileStat {
|
||||
path: Path::new(path),
|
||||
size: stat.st_size as u64,
|
||||
kind: kind,
|
||||
perm: unsafe {
|
||||
@ -508,7 +517,7 @@ fn mkstat(stat: &libc::stat, path: &CString) -> io::FileStat {
|
||||
pub fn stat(p: &CString) -> IoResult<io::FileStat> {
|
||||
let mut stat: libc::stat = unsafe { mem::uninit() };
|
||||
match retry(|| unsafe { libc::stat(p.with_ref(|p| p), &mut stat) }) {
|
||||
0 => Ok(mkstat(&stat, p)),
|
||||
0 => Ok(mkstat(&stat)),
|
||||
_ => Err(super::last_error()),
|
||||
}
|
||||
}
|
||||
@ -516,7 +525,7 @@ pub fn stat(p: &CString) -> IoResult<io::FileStat> {
|
||||
pub fn lstat(p: &CString) -> IoResult<io::FileStat> {
|
||||
let mut stat: libc::stat = unsafe { mem::uninit() };
|
||||
match retry(|| unsafe { libc::lstat(p.with_ref(|p| p), &mut stat) }) {
|
||||
0 => Ok(mkstat(&stat, p)),
|
||||
0 => Ok(mkstat(&stat)),
|
||||
_ => Err(super::last_error()),
|
||||
}
|
||||
}
|
||||
|
@ -197,6 +197,14 @@ impl rtio::RtioFileStream for FileDesc {
|
||||
let _ = self.seek(orig_pos as i64, io::SeekSet);
|
||||
return ret;
|
||||
}
|
||||
|
||||
fn fstat(&mut self) -> IoResult<io::FileStat> {
|
||||
let mut stat: libc::stat = unsafe { mem::uninit() };
|
||||
match unsafe { libc::fstat(self.fd(), &mut stat) } {
|
||||
0 => Ok(mkstat(&stat)),
|
||||
_ => Err(super::last_error()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl rtio::RtioPipe for FileDesc {
|
||||
@ -471,8 +479,7 @@ pub fn link(src: &CString, dst: &CString) -> IoResult<()> {
|
||||
}))
|
||||
}
|
||||
|
||||
fn mkstat(stat: &libc::stat, path: &CString) -> io::FileStat {
|
||||
let path = unsafe { CString::new(path.with_ref(|p| p), false) };
|
||||
fn mkstat(stat: &libc::stat) -> io::FileStat {
|
||||
let kind = match (stat.st_mode as c_int) & libc::S_IFMT {
|
||||
libc::S_IFREG => io::TypeFile,
|
||||
libc::S_IFDIR => io::TypeDirectory,
|
||||
@ -483,7 +490,6 @@ fn mkstat(stat: &libc::stat, path: &CString) -> io::FileStat {
|
||||
};
|
||||
|
||||
io::FileStat {
|
||||
path: Path::new(path),
|
||||
size: stat.st_size as u64,
|
||||
kind: kind,
|
||||
perm: unsafe {
|
||||
@ -511,7 +517,7 @@ pub fn stat(p: &CString) -> IoResult<io::FileStat> {
|
||||
let mut stat: libc::stat = unsafe { mem::uninit() };
|
||||
as_utf16_p(p.as_str().unwrap(), |up| {
|
||||
match unsafe { libc::wstat(up, &mut stat) } {
|
||||
0 => Ok(mkstat(&stat, p)),
|
||||
0 => Ok(mkstat(&stat)),
|
||||
_ => Err(super::last_error()),
|
||||
}
|
||||
})
|
||||
|
@ -41,7 +41,7 @@
|
||||
//! }
|
||||
//! ```
|
||||
|
||||
#![crate_id = "native#0.11-pre"]
|
||||
#![crate_id = "native#0.11.0-pre"]
|
||||
#![license = "MIT/ASL2"]
|
||||
#![crate_type = "rlib"]
|
||||
#![crate_type = "dylib"]
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
#![feature(macro_rules)]
|
||||
|
||||
#![crate_id = "num#0.11-pre"]
|
||||
#![crate_id = "num#0.11.0-pre"]
|
||||
#![crate_type = "rlib"]
|
||||
#![crate_type = "dylib"]
|
||||
#![license = "MIT/ASL2"]
|
||||
|
@ -69,7 +69,7 @@ println!("{:?}", tuple_ptr)
|
||||
```
|
||||
*/
|
||||
|
||||
#![crate_id = "rand#0.11-pre"]
|
||||
#![crate_id = "rand#0.11.0-pre"]
|
||||
#![license = "MIT/ASL2"]
|
||||
#![crate_type = "dylib"]
|
||||
#![crate_type = "rlib"]
|
||||
|
@ -352,7 +352,7 @@
|
||||
//! characters in the search text and `m` is the number of instructions in a
|
||||
//! compiled expression.
|
||||
|
||||
#![crate_id = "regex#0.11-pre"]
|
||||
#![crate_id = "regex#0.11.0-pre"]
|
||||
#![crate_type = "rlib"]
|
||||
#![crate_type = "dylib"]
|
||||
#![experimental]
|
||||
|
@ -11,7 +11,7 @@
|
||||
//! This crate provides the `regex!` macro. Its use is documented in the
|
||||
//! `regex` crate.
|
||||
|
||||
#![crate_id = "regex_macros#0.11-pre"]
|
||||
#![crate_id = "regex_macros#0.11.0-pre"]
|
||||
#![crate_type = "dylib"]
|
||||
#![experimental]
|
||||
#![license = "MIT/ASL2"]
|
||||
|
@ -193,7 +193,7 @@ pub fn phase_2_configure_and_expand(sess: &Session,
|
||||
|
||||
krate = time(time_passes, "expansion", krate, |krate| {
|
||||
// Windows dlls do not have rpaths, so they don't know how to find their
|
||||
// dependencies. It's up to use to tell the system where to find all the
|
||||
// dependencies. It's up to us to tell the system where to find all the
|
||||
// dependent dlls. Note that this uses cfg!(windows) as opposed to
|
||||
// targ_cfg because syntax extensions are always loaded for the host
|
||||
// compiler, not for the target.
|
||||
|
@ -22,7 +22,7 @@ use syntax::parse::token::InternedString;
|
||||
use syntax::parse::token;
|
||||
use syntax::util::small_vector::SmallVector;
|
||||
|
||||
pub static VERSION: &'static str = "0.11-pre";
|
||||
pub static VERSION: &'static str = "0.11.0-pre";
|
||||
|
||||
pub fn maybe_inject_crates_ref(sess: &Session, krate: ast::Crate)
|
||||
-> ast::Crate {
|
||||
|
@ -18,7 +18,7 @@ This API is completely unstable and subject to change.
|
||||
|
||||
*/
|
||||
|
||||
#![crate_id = "rustc#0.11-pre"]
|
||||
#![crate_id = "rustc#0.11.0-pre"]
|
||||
#![comment = "The Rust compiler"]
|
||||
#![license = "MIT/ASL2"]
|
||||
#![crate_type = "dylib"]
|
||||
|
@ -1775,6 +1775,7 @@ impl<'a> fmt::Show for Sidebar<'a> {
|
||||
try!(block(fmt.buf, "enum", "Enums", it, cx));
|
||||
try!(block(fmt.buf, "trait", "Traits", it, cx));
|
||||
try!(block(fmt.buf, "fn", "Functions", it, cx));
|
||||
try!(block(fmt.buf, "macro", "Macros", it, cx));
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,7 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![crate_id = "rustdoc#0.11-pre"]
|
||||
#![crate_id = "rustdoc#0.11.0-pre"]
|
||||
#![desc = "rustdoc, the Rust documentation extractor"]
|
||||
#![license = "MIT/ASL2"]
|
||||
#![crate_type = "dylib"]
|
||||
|
@ -14,6 +14,7 @@ use std::cmp;
|
||||
use std::strbuf::StrBuf;
|
||||
use std::uint;
|
||||
use syntax::ast;
|
||||
use syntax::ast_util;
|
||||
|
||||
use clean;
|
||||
use clean::Item;
|
||||
@ -206,7 +207,7 @@ impl<'a> fold::DocFolder for ImplStripper<'a> {
|
||||
match imp.trait_ {
|
||||
Some(clean::ResolvedPath{ did, .. }) => {
|
||||
let ImplStripper(s) = *self;
|
||||
if !s.contains(&did.node) {
|
||||
if ast_util::is_local(did) && !s.contains(&did.node) {
|
||||
return None;
|
||||
}
|
||||
}
|
||||
|
@ -70,6 +70,12 @@ impl FsRequest {
|
||||
}).map(|req| req.mkstat())
|
||||
}
|
||||
|
||||
pub fn fstat(loop_: &Loop, fd: c_int) -> Result<FileStat, UvError> {
|
||||
execute(|req, cb| unsafe {
|
||||
uvll::uv_fs_fstat(loop_.handle, req, fd, cb)
|
||||
}).map(|req| req.mkstat())
|
||||
}
|
||||
|
||||
pub fn write(loop_: &Loop, fd: c_int, buf: &[u8], offset: i64)
|
||||
-> Result<(), UvError>
|
||||
{
|
||||
@ -262,8 +268,6 @@ impl FsRequest {
|
||||
}
|
||||
|
||||
pub fn mkstat(&self) -> FileStat {
|
||||
let path = unsafe { uvll::get_path_from_fs_req(self.req) };
|
||||
let path = unsafe { Path::new(CString::new(path, false)) };
|
||||
let stat = self.get_stat();
|
||||
fn to_msec(stat: uvll::uv_timespec_t) -> u64 {
|
||||
// Be sure to cast to u64 first to prevent overflowing if the tv_sec
|
||||
@ -279,7 +283,6 @@ impl FsRequest {
|
||||
_ => io::TypeUnknown,
|
||||
};
|
||||
FileStat {
|
||||
path: path,
|
||||
size: stat.st_size as u64,
|
||||
kind: kind,
|
||||
perm: unsafe {
|
||||
@ -463,6 +466,11 @@ impl rtio::RtioFileStream for FileWatcher {
|
||||
let r = FsRequest::truncate(&self.loop_, self.fd, offset);
|
||||
r.map_err(uv_error_to_io_error)
|
||||
}
|
||||
|
||||
fn fstat(&mut self) -> Result<FileStat, IoError> {
|
||||
let _m = self.fire_homing_missile();
|
||||
FsRequest::fstat(&self.loop_, self.fd).map_err(uv_error_to_io_error)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
@ -537,6 +545,10 @@ mod test {
|
||||
assert!(result.is_ok());
|
||||
assert_eq!(result.unwrap().size, 5);
|
||||
|
||||
let result = FsRequest::fstat(l(), file.fd);
|
||||
assert!(result.is_ok());
|
||||
assert_eq!(result.unwrap().size, 5);
|
||||
|
||||
fn free<T>(_: T) {}
|
||||
free(file);
|
||||
|
||||
|
@ -34,7 +34,7 @@ via `close` and `delete` methods.
|
||||
|
||||
*/
|
||||
|
||||
#![crate_id = "rustuv#0.11-pre"]
|
||||
#![crate_id = "rustuv#0.11.0-pre"]
|
||||
#![license = "MIT/ASL2"]
|
||||
#![crate_type = "rlib"]
|
||||
#![crate_type = "dylib"]
|
||||
|
@ -28,7 +28,7 @@
|
||||
//! An example version number with all five components is
|
||||
//! `0.8.1-rc.3.0+20130922.linux`.
|
||||
|
||||
#![crate_id = "semver#0.11-pre"]
|
||||
#![crate_id = "semver#0.11.0-pre"]
|
||||
#![crate_type = "rlib"]
|
||||
#![crate_type = "dylib"]
|
||||
#![license = "MIT/ASL2"]
|
||||
|
@ -14,7 +14,7 @@
|
||||
Core encoding and decoding interfaces.
|
||||
*/
|
||||
|
||||
#![crate_id = "serialize#0.11-pre"]
|
||||
#![crate_id = "serialize#0.11.0-pre"]
|
||||
#![crate_type = "rlib"]
|
||||
#![crate_type = "dylib"]
|
||||
#![license = "MIT/ASL2"]
|
||||
|
@ -214,6 +214,11 @@ impl File {
|
||||
pub fn eof(&self) -> bool {
|
||||
self.last_nread == 0
|
||||
}
|
||||
|
||||
/// Queries information about the underlying file.
|
||||
pub fn stat(&mut self) -> IoResult<FileStat> {
|
||||
self.fd.fstat()
|
||||
}
|
||||
}
|
||||
|
||||
/// Unlink a file from the underlying filesystem.
|
||||
@ -887,9 +892,12 @@ mod test {
|
||||
let tmpdir = tmpdir();
|
||||
let filename = &tmpdir.join("file_stat_correct_on_is_file.txt");
|
||||
{
|
||||
let mut fs = File::open_mode(filename, Open, ReadWrite);
|
||||
let mut fs = check!(File::open_mode(filename, Open, ReadWrite));
|
||||
let msg = "hw";
|
||||
fs.write(msg.as_bytes()).unwrap();
|
||||
|
||||
let fstat_res = check!(fs.stat());
|
||||
assert_eq!(fstat_res.kind, io::TypeFile);
|
||||
}
|
||||
let stat_res_fn = check!(stat(filename));
|
||||
assert_eq!(stat_res_fn.kind, io::TypeFile);
|
||||
@ -1228,12 +1236,12 @@ mod test {
|
||||
check!(file.fsync());
|
||||
|
||||
// Do some simple things with truncation
|
||||
assert_eq!(check!(stat(&path)).size, 3);
|
||||
assert_eq!(check!(file.stat()).size, 3);
|
||||
check!(file.truncate(10));
|
||||
assert_eq!(check!(stat(&path)).size, 10);
|
||||
assert_eq!(check!(file.stat()).size, 10);
|
||||
check!(file.write(bytes!("bar")));
|
||||
check!(file.fsync());
|
||||
assert_eq!(check!(stat(&path)).size, 10);
|
||||
assert_eq!(check!(file.stat()).size, 10);
|
||||
assert_eq!(check!(File::open(&path).read_to_end()),
|
||||
(Vec::from_slice(bytes!("foobar", 0, 0, 0, 0))));
|
||||
|
||||
@ -1241,10 +1249,10 @@ mod test {
|
||||
// Ensure that the intermediate zeroes are all filled in (we're seeked
|
||||
// past the end of the file).
|
||||
check!(file.truncate(2));
|
||||
assert_eq!(check!(stat(&path)).size, 2);
|
||||
assert_eq!(check!(file.stat()).size, 2);
|
||||
check!(file.write(bytes!("wut")));
|
||||
check!(file.fsync());
|
||||
assert_eq!(check!(stat(&path)).size, 9);
|
||||
assert_eq!(check!(file.stat()).size, 9);
|
||||
assert_eq!(check!(File::open(&path).read_to_end()),
|
||||
(Vec::from_slice(bytes!("fo", 0, 0, 0, 0, "wut"))));
|
||||
drop(file);
|
||||
|
@ -228,7 +228,6 @@ use ops::{BitOr, BitAnd, Sub};
|
||||
use option::{Option, Some, None};
|
||||
use os;
|
||||
use owned::Box;
|
||||
use path::Path;
|
||||
use result::{Ok, Err, Result};
|
||||
use slice::{Vector, MutableVector, ImmutableVector};
|
||||
use str::{StrSlice, StrAllocating};
|
||||
@ -1510,14 +1509,11 @@ pub enum FileType {
|
||||
/// Err(e) => fail!("couldn't read foo.txt: {}", e),
|
||||
/// };
|
||||
///
|
||||
/// println!("path: {}", info.path.display());
|
||||
/// println!("byte size: {}", info.size);
|
||||
/// # }
|
||||
/// ```
|
||||
#[deriving(Hash)]
|
||||
pub struct FileStat {
|
||||
/// The path that this stat structure is describing
|
||||
pub path: Path,
|
||||
/// The size of the file, in bytes
|
||||
pub size: u64,
|
||||
/// The kind of file this path points to (directory, file, pipe, etc.)
|
||||
|
@ -140,6 +140,7 @@ pub struct ProcessConfig<'a> {
|
||||
}
|
||||
|
||||
/// The output of a finished process.
|
||||
#[deriving(Eq, TotalEq, Clone)]
|
||||
pub struct ProcessOutput {
|
||||
/// The status (exit code) of the process.
|
||||
pub status: ProcessExit,
|
||||
|
@ -96,7 +96,7 @@
|
||||
//! all the standard macros, such as `assert!`, `fail!`, `println!`,
|
||||
//! and `format!`, also available to all Rust code.
|
||||
|
||||
#![crate_id = "std#0.11-pre"]
|
||||
#![crate_id = "std#0.11.0-pre"]
|
||||
#![comment = "The Rust standard library"]
|
||||
#![license = "MIT/ASL2"]
|
||||
#![crate_type = "rlib"]
|
||||
|
@ -30,20 +30,23 @@
|
||||
//! of a value and take action, always accounting for the `None` case.
|
||||
//!
|
||||
//! ```
|
||||
//! # // FIXME This is not the greatest first example
|
||||
//! // cow_says contains the word "moo"
|
||||
//! let cow_says = Some("moo");
|
||||
//! // dog_says does not contain a value
|
||||
//! let dog_says: Option<&str> = None;
|
||||
//! fn divide(numerator: f64, denominator: f64) -> Option<f64> {
|
||||
//! if denominator == 0.0 {
|
||||
//! None
|
||||
//! } else {
|
||||
//! Some(numerator / denominator)
|
||||
//! }
|
||||
//! }
|
||||
//!
|
||||
//! // The return value of the function is an option
|
||||
//! let result = divide(2.0, 3.0);
|
||||
//!
|
||||
//! // Pattern match to retrieve the value
|
||||
//! match (cow_says, dog_says) {
|
||||
//! (Some(cow_words), Some(dog_words)) => {
|
||||
//! println!("Cow says {} and dog says {}!", cow_words, dog_words);
|
||||
//! }
|
||||
//! (Some(cow_words), None) => println!("Cow says {}", cow_words),
|
||||
//! (None, Some(dog_words)) => println!("Dog says {}", dog_words),
|
||||
//! (None, None) => println!("Cow and dog are suspiciously silent")
|
||||
//! match result {
|
||||
//! // The division was valid
|
||||
//! Some(x) => println!("Result: {}", x),
|
||||
//! // The division was invalid
|
||||
//! None => println!("Cannot divide by 0")
|
||||
//! }
|
||||
//! ```
|
||||
//!
|
||||
|
@ -95,13 +95,12 @@ pub fn getcwd() -> Path {
|
||||
|
||||
#[cfg(windows)]
|
||||
pub mod win32 {
|
||||
use iter::Iterator;
|
||||
use libc::types::os::arch::extra::DWORD;
|
||||
use libc;
|
||||
use option::{None, Option, Expect};
|
||||
use option;
|
||||
use os::TMPBUF_SZ;
|
||||
use slice::{MutableVector, ImmutableVector, OwnedVector};
|
||||
use slice::{MutableVector, ImmutableVector};
|
||||
use str::{StrSlice, StrAllocating};
|
||||
use str;
|
||||
use vec::Vec;
|
||||
@ -142,7 +141,7 @@ pub mod win32 {
|
||||
}
|
||||
|
||||
pub fn as_utf16_p<T>(s: &str, f: |*u16| -> T) -> T {
|
||||
let mut t = s.to_utf16().move_iter().collect::<Vec<u16>>();
|
||||
let mut t = s.to_utf16();
|
||||
// Null terminate before passing on.
|
||||
t.push(0u16);
|
||||
f(t.as_ptr())
|
||||
|
@ -269,6 +269,7 @@ pub trait RtioFileStream {
|
||||
fn fsync(&mut self) -> IoResult<()>;
|
||||
fn datasync(&mut self) -> IoResult<()>;
|
||||
fn truncate(&mut self, offset: i64) -> IoResult<()>;
|
||||
fn fstat(&mut self) -> IoResult<FileStat>;
|
||||
}
|
||||
|
||||
pub trait RtioProcess {
|
||||
|
@ -12,7 +12,7 @@
|
||||
* Concurrency-enabled mechanisms and primitives.
|
||||
*/
|
||||
|
||||
#![crate_id = "sync#0.11-pre"]
|
||||
#![crate_id = "sync#0.11.0-pre"]
|
||||
#![crate_type = "rlib"]
|
||||
#![crate_type = "dylib"]
|
||||
#![license = "MIT/ASL2"]
|
||||
|
@ -18,7 +18,7 @@ This API is completely unstable and subject to change.
|
||||
|
||||
*/
|
||||
|
||||
#![crate_id = "syntax#0.11-pre"]
|
||||
#![crate_id = "syntax#0.11.0-pre"]
|
||||
#![license = "MIT/ASL2"]
|
||||
#![crate_type = "dylib"]
|
||||
#![crate_type = "rlib"]
|
||||
|
@ -125,7 +125,11 @@ enum ItemOrViewItem {
|
||||
IoviViewItem(ViewItem)
|
||||
}
|
||||
|
||||
/* The expr situation is not as complex as I thought it would be.
|
||||
|
||||
// Possibly accept an `INTERPOLATED` expression (a pre-parsed expression
|
||||
// dropped into the token stream, which happens while parsing the
|
||||
// result of macro expansion)
|
||||
/* Placement of these is not as complex as I feared it would be.
|
||||
The important thing is to make sure that lookahead doesn't balk
|
||||
at INTERPOLATED tokens */
|
||||
macro_rules! maybe_whole_expr (
|
||||
@ -135,7 +139,7 @@ macro_rules! maybe_whole_expr (
|
||||
INTERPOLATED(token::NtPath(ref pt)) => Some((**pt).clone()),
|
||||
_ => None,
|
||||
};
|
||||
let ret = match ($p).token {
|
||||
let found = match ($p).token {
|
||||
INTERPOLATED(token::NtExpr(e)) => {
|
||||
Some(e)
|
||||
}
|
||||
@ -145,7 +149,7 @@ macro_rules! maybe_whole_expr (
|
||||
}
|
||||
_ => None
|
||||
};
|
||||
match ret {
|
||||
match found {
|
||||
Some(e) => {
|
||||
$p.bump();
|
||||
return e;
|
||||
@ -156,16 +160,17 @@ macro_rules! maybe_whole_expr (
|
||||
)
|
||||
)
|
||||
|
||||
// As above, but for things other than expressions
|
||||
macro_rules! maybe_whole (
|
||||
($p:expr, $constructor:ident) => (
|
||||
{
|
||||
let __found__ = match ($p).token {
|
||||
let found = match ($p).token {
|
||||
INTERPOLATED(token::$constructor(_)) => {
|
||||
Some(($p).bump_and_get())
|
||||
}
|
||||
_ => None
|
||||
};
|
||||
match __found__ {
|
||||
match found {
|
||||
Some(INTERPOLATED(token::$constructor(x))) => {
|
||||
return x.clone()
|
||||
}
|
||||
@ -175,13 +180,13 @@ macro_rules! maybe_whole (
|
||||
);
|
||||
(no_clone $p:expr, $constructor:ident) => (
|
||||
{
|
||||
let __found__ = match ($p).token {
|
||||
let found = match ($p).token {
|
||||
INTERPOLATED(token::$constructor(_)) => {
|
||||
Some(($p).bump_and_get())
|
||||
}
|
||||
_ => None
|
||||
};
|
||||
match __found__ {
|
||||
match found {
|
||||
Some(INTERPOLATED(token::$constructor(x))) => {
|
||||
return x
|
||||
}
|
||||
@ -191,13 +196,13 @@ macro_rules! maybe_whole (
|
||||
);
|
||||
(deref $p:expr, $constructor:ident) => (
|
||||
{
|
||||
let __found__ = match ($p).token {
|
||||
let found = match ($p).token {
|
||||
INTERPOLATED(token::$constructor(_)) => {
|
||||
Some(($p).bump_and_get())
|
||||
}
|
||||
_ => None
|
||||
};
|
||||
match __found__ {
|
||||
match found {
|
||||
Some(INTERPOLATED(token::$constructor(x))) => {
|
||||
return (*x).clone()
|
||||
}
|
||||
@ -207,13 +212,13 @@ macro_rules! maybe_whole (
|
||||
);
|
||||
(Some $p:expr, $constructor:ident) => (
|
||||
{
|
||||
let __found__ = match ($p).token {
|
||||
let found = match ($p).token {
|
||||
INTERPOLATED(token::$constructor(_)) => {
|
||||
Some(($p).bump_and_get())
|
||||
}
|
||||
_ => None
|
||||
};
|
||||
match __found__ {
|
||||
match found {
|
||||
Some(INTERPOLATED(token::$constructor(x))) => {
|
||||
return Some(x.clone()),
|
||||
}
|
||||
@ -223,13 +228,13 @@ macro_rules! maybe_whole (
|
||||
);
|
||||
(iovi $p:expr, $constructor:ident) => (
|
||||
{
|
||||
let __found__ = match ($p).token {
|
||||
let found = match ($p).token {
|
||||
INTERPOLATED(token::$constructor(_)) => {
|
||||
Some(($p).bump_and_get())
|
||||
}
|
||||
_ => None
|
||||
};
|
||||
match __found__ {
|
||||
match found {
|
||||
Some(INTERPOLATED(token::$constructor(x))) => {
|
||||
return IoviItem(x.clone())
|
||||
}
|
||||
@ -239,13 +244,13 @@ macro_rules! maybe_whole (
|
||||
);
|
||||
(pair_empty $p:expr, $constructor:ident) => (
|
||||
{
|
||||
let __found__ = match ($p).token {
|
||||
let found = match ($p).token {
|
||||
INTERPOLATED(token::$constructor(_)) => {
|
||||
Some(($p).bump_and_get())
|
||||
}
|
||||
_ => None
|
||||
};
|
||||
match __found__ {
|
||||
match found {
|
||||
Some(INTERPOLATED(token::$constructor(x))) => {
|
||||
return (Vec::new(), x)
|
||||
}
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
//! Simple ANSI color library
|
||||
|
||||
#![crate_id = "term#0.11-pre"]
|
||||
#![crate_id = "term#0.11.0-pre"]
|
||||
#![comment = "Simple ANSI color library"]
|
||||
#![license = "MIT/ASL2"]
|
||||
#![crate_type = "rlib"]
|
||||
|
@ -23,7 +23,7 @@
|
||||
// running tests while providing a base that other test frameworks may
|
||||
// build off of.
|
||||
|
||||
#![crate_id = "test#0.11-pre"]
|
||||
#![crate_id = "test#0.11.0-pre"]
|
||||
#![comment = "Rust internal test library only used by rustc"]
|
||||
#![license = "MIT/ASL2"]
|
||||
#![crate_type = "rlib"]
|
||||
|
@ -8,7 +8,7 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![crate_id = "time#0.11-pre"]
|
||||
#![crate_id = "time#0.11.0-pre"]
|
||||
#![crate_type = "rlib"]
|
||||
#![crate_type = "dylib"]
|
||||
#![license = "MIT/ASL2"]
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
//! Types/fns concerning URLs (see RFC 3986)
|
||||
|
||||
#![crate_id = "url#0.11-pre"]
|
||||
#![crate_id = "url#0.11.0-pre"]
|
||||
#![crate_type = "rlib"]
|
||||
#![crate_type = "dylib"]
|
||||
#![license = "MIT/ASL2"]
|
||||
|
@ -54,7 +54,7 @@ Examples of string representations:
|
||||
|
||||
*/
|
||||
|
||||
#![crate_id = "uuid#0.11-pre"]
|
||||
#![crate_id = "uuid#0.11.0-pre"]
|
||||
#![crate_type = "rlib"]
|
||||
#![crate_type = "dylib"]
|
||||
#![license = "MIT/ASL2"]
|
||||
|
@ -8,7 +8,7 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![crate_id = "workcache#0.11-pre"]
|
||||
#![crate_id = "workcache#0.11.0-pre"]
|
||||
#![crate_type = "rlib"]
|
||||
#![crate_type = "dylib"]
|
||||
#![license = "MIT/ASL2"]
|
||||
|
@ -10,5 +10,5 @@
|
||||
|
||||
// no-prefer-dynamic
|
||||
|
||||
#![crate_id = "collections#0.11-pre"]
|
||||
#![crate_id = "collections#0.11.0-pre"]
|
||||
#![crate_type = "dylib"]
|
||||
|
@ -10,5 +10,5 @@
|
||||
|
||||
// no-prefer-dynamic
|
||||
|
||||
#![crate_id = "collections#0.11-pre"]
|
||||
#![crate_id = "collections#0.11.0-pre"]
|
||||
#![crate_type = "rlib"]
|
||||
|
@ -70,33 +70,30 @@ struct Planet {
|
||||
|
||||
fn advance(bodies: &mut [Planet, ..N_BODIES], dt: f64, steps: int) {
|
||||
for _ in range(0, steps) {
|
||||
{
|
||||
let mut b_slice = bodies.as_mut_slice();
|
||||
loop {
|
||||
let bi = match b_slice.mut_shift_ref() {
|
||||
Some(bi) => bi,
|
||||
None => break
|
||||
};
|
||||
for bj in b_slice.mut_iter() {
|
||||
let dx = bi.x - bj.x;
|
||||
let dy = bi.y - bj.y;
|
||||
let dz = bi.z - bj.z;
|
||||
let mut b_slice = bodies.as_mut_slice();
|
||||
loop {
|
||||
let bi = match b_slice.mut_shift_ref() {
|
||||
Some(bi) => bi,
|
||||
None => break
|
||||
};
|
||||
for bj in b_slice.mut_iter() {
|
||||
let dx = bi.x - bj.x;
|
||||
let dy = bi.y - bj.y;
|
||||
let dz = bi.z - bj.z;
|
||||
|
||||
let d2 = dx * dx + dy * dy + dz * dz;
|
||||
let mag = dt / (d2 * d2.sqrt());
|
||||
let d2 = dx * dx + dy * dy + dz * dz;
|
||||
let mag = dt / (d2 * d2.sqrt());
|
||||
|
||||
bi.vx -= dx * bj.mass * mag;
|
||||
bi.vy -= dy * bj.mass * mag;
|
||||
bi.vz -= dz * bj.mass * mag;
|
||||
let massj_mag = bj.mass * mag;
|
||||
bi.vx -= dx * massj_mag;
|
||||
bi.vy -= dy * massj_mag;
|
||||
bi.vz -= dz * massj_mag;
|
||||
|
||||
bj.vx += dx * bi.mass * mag;
|
||||
bj.vy += dy * bi.mass * mag;
|
||||
bj.vz += dz * bi.mass * mag;
|
||||
}
|
||||
let massi_mag = bi.mass * mag;
|
||||
bj.vx += dx * massi_mag;
|
||||
bj.vy += dy * massi_mag;
|
||||
bj.vz += dz * massi_mag;
|
||||
}
|
||||
}
|
||||
|
||||
for bi in bodies.mut_iter() {
|
||||
bi.x += dt * bi.vx;
|
||||
bi.y += dt * bi.vy;
|
||||
bi.z += dt * bi.vz;
|
||||
|
@ -1,7 +1,7 @@
|
||||
-include ../tools.mk
|
||||
|
||||
all:
|
||||
[ `$(RUSTC) --crate-id crate.rs` = "foo#0.11-pre" ]
|
||||
[ `$(RUSTC) --crate-id crate.rs` = "foo#0.11.0-pre" ]
|
||||
[ `$(RUSTC) --crate-name crate.rs` = "foo" ]
|
||||
[ `$(RUSTC) --crate-file-name crate.rs` = "foo" ]
|
||||
[ `$(RUSTC) --crate-file-name --crate-type=lib --test crate.rs` = "foo" ]
|
||||
|
@ -8,7 +8,7 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![crate_id = "foo#0.11-pre"]
|
||||
#![crate_id = "foo#0.11.0-pre"]
|
||||
|
||||
// Querying about the crate metadata should *not* parse the entire crate, it
|
||||
// only needs the crate attributes (which are guaranteed to be at the top) be
|
||||
|
@ -15,7 +15,7 @@
|
||||
#![no_std]
|
||||
extern crate std;
|
||||
extern crate zed = "std";
|
||||
extern crate bar = "std#0.11-pre";
|
||||
extern crate bar = "std#0.11.0-pre";
|
||||
|
||||
|
||||
use std::str;
|
||||
|
Loading…
x
Reference in New Issue
Block a user