1
Fork 0

auto merge of #14164 : alexcrichton/rust/rollup, r=alexcrichton

This commit is contained in:
bors 2014-05-12 21:45:13 -07:00
commit 967366e988
81 changed files with 276 additions and 215 deletions

View file

@ -97,7 +97,7 @@ Set lint forbidden
Set internal debugging options. Use "-Z help" to print available options. Set internal debugging options. Use "-Z help" to print available options.
.TP .TP
\fB\-C\fR FLAG[=VAL], \fB\-\-codegen\fR FLAG[=VAL] \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 available flags. See CODEGEN OPTIONS below
.TP .TP
\fB\-v\fR, \fB\-\-version\fR \fB\-v\fR, \fB\-\-version\fR
@ -119,7 +119,7 @@ is invoked.
.TP .TP
\fBtarget-cpu\fR=help \fBtarget-cpu\fR=help
Selects a target processor. If the value is 'help', then a list of available Selects a target processor. If the value is 'help', then a list of available
cpus is printed. CPUs is printed.
.TP .TP
\fBtarget-feature\fR='+feature1 -feature2' \fBtarget-feature\fR='+feature1 -feature2'
A space-separated list of features to enable or disable for the target. A 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. appended at the end of the normal pass manager.
.TP .TP
\fBllvm-args\fR='-arg1 -arg2' \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 .TP
\fBsave-temps\fR \fBsave-temps\fR
If specified, the compiler will save more files (.bc, .o, .no-opt.bc) generated If specified, the compiler will save more files (.bc, .o, .no-opt.bc) generated

View file

@ -13,7 +13,7 @@
###################################################################### ######################################################################
# The version number # The version number
CFG_RELEASE_NUM=0.11 CFG_RELEASE_NUM=0.11.0
CFG_RELEASE_LABEL=-pre CFG_RELEASE_LABEL=-pre
ifndef CFG_ENABLE_NIGHTLY ifndef CFG_ENABLE_NIGHTLY

View file

@ -53,12 +53,12 @@ To generate .pot and .po files, do something like:
~~~~ ~~~~
po4a --copyright-holder="The Rust Project Developers" \ po4a --copyright-holder="The Rust Project Developers" \
--package-name="Rust" \ --package-name="Rust" \
--package-version="0.11-pre" \ --package-version="0.11.0-pre" \
-M UTF-8 -L UTF-8 \ -M UTF-8 -L UTF-8 \
src/doc/po4a.conf 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 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 you are not familiar with gettext-based translation, please read the online

View file

@ -5,7 +5,7 @@
# #
msgid "" msgid ""
msgstr "" 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" "POT-Creation-Date: 2014-02-03 08:13+0900\n"
"PO-Revision-Date: 2014-01-13 12:01+0900\n" "PO-Revision-Date: 2014-01-13 12:01+0900\n"
"Last-Translator: Automatically generated\n" "Last-Translator: Automatically generated\n"

View file

@ -5,7 +5,7 @@
# #
msgid "" msgid ""
msgstr "" 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" "POT-Creation-Date: 2014-02-03 08:13+0900\n"
"PO-Revision-Date: 2014-01-13 12:01+0900\n" "PO-Revision-Date: 2014-01-13 12:01+0900\n"
"Last-Translator: Automatically generated\n" "Last-Translator: Automatically generated\n"

View file

@ -5,7 +5,7 @@
# #
msgid "" msgid ""
msgstr "" 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" "POT-Creation-Date: 2014-02-03 08:13+0900\n"
"PO-Revision-Date: 2014-01-13 12:01+0900\n" "PO-Revision-Date: 2014-01-13 12:01+0900\n"
"Last-Translator: Automatically generated\n" "Last-Translator: Automatically generated\n"

View file

@ -5,7 +5,7 @@
# #
msgid "" msgid ""
msgstr "" 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" "POT-Creation-Date: 2014-02-03 08:13+0900\n"
"PO-Revision-Date: 2014-02-03 08:13+0900\n" "PO-Revision-Date: 2014-02-03 08:13+0900\n"
"Last-Translator: Automatically generated\n" "Last-Translator: Automatically generated\n"

View file

@ -5,7 +5,7 @@
# #
msgid "" msgid ""
msgstr "" 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" "POT-Creation-Date: 2014-02-03 08:13+0900\n"
"PO-Revision-Date: 2014-01-13 12:01+0900\n" "PO-Revision-Date: 2014-01-13 12:01+0900\n"
"Last-Translator: Automatically generated\n" "Last-Translator: Automatically generated\n"

View file

@ -5,7 +5,7 @@
# #
msgid "" msgid ""
msgstr "" 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" "POT-Creation-Date: 2014-02-03 08:13+0900\n"
"PO-Revision-Date: 2014-01-13 12:01+0900\n" "PO-Revision-Date: 2014-01-13 12:01+0900\n"
"Last-Translator: Automatically generated\n" "Last-Translator: Automatically generated\n"

View file

@ -5,7 +5,7 @@
# #
msgid "" msgid ""
msgstr "" 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" "POT-Creation-Date: 2014-02-03 08:13+0900\n"
"PO-Revision-Date: 2014-01-13 12:01+0900\n" "PO-Revision-Date: 2014-01-13 12:01+0900\n"
"Last-Translator: Automatically generated\n" "Last-Translator: Automatically generated\n"

View file

@ -5,7 +5,7 @@
# #
msgid "" msgid ""
msgstr "" 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" "POT-Creation-Date: 2014-02-03 08:13+0900\n"
"PO-Revision-Date: 2014-01-13 12:01+0900\n" "PO-Revision-Date: 2014-01-13 12:01+0900\n"
"Last-Translator: Automatically generated\n" "Last-Translator: Automatically generated\n"

View file

@ -5,7 +5,7 @@
# #
msgid "" msgid ""
msgstr "" 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" "POT-Creation-Date: 2014-02-03 08:13+0900\n"
"PO-Revision-Date: 2014-01-13 12:01+0900\n" "PO-Revision-Date: 2014-01-13 12:01+0900\n"
"Last-Translator: Automatically generated\n" "Last-Translator: Automatically generated\n"

View file

@ -5,7 +5,7 @@
# #
msgid "" msgid ""
msgstr "" 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" "POT-Creation-Date: 2014-02-03 08:13+0900\n"
"PO-Revision-Date: 2014-01-13 12:01+0900\n" "PO-Revision-Date: 2014-01-13 12:01+0900\n"
"Last-Translator: Automatically generated\n" "Last-Translator: Automatically generated\n"

View file

@ -5,7 +5,7 @@
# #
msgid "" msgid ""
msgstr "" 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" "POT-Creation-Date: 2014-02-03 08:13+0900\n"
"PO-Revision-Date: 2014-02-03 08:13+0900\n" "PO-Revision-Date: 2014-02-03 08:13+0900\n"
"Last-Translator: Automatically generated\n" "Last-Translator: Automatically generated\n"

View file

@ -5,7 +5,7 @@
# #
msgid "" msgid ""
msgstr "" 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" "POT-Creation-Date: 2014-02-03 08:13+0900\n"
"PO-Revision-Date: 2014-01-13 12:01+0900\n" "PO-Revision-Date: 2014-01-13 12:01+0900\n"
"Last-Translator: Automatically generated\n" "Last-Translator: Automatically generated\n"

View file

@ -5,7 +5,7 @@
# #
msgid "" msgid ""
msgstr "" 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" "POT-Creation-Date: 2014-02-03 08:13+0900\n"
"PO-Revision-Date: 2014-01-13 12:01+0900\n" "PO-Revision-Date: 2014-01-13 12:01+0900\n"
"Last-Translator: Automatically generated\n" "Last-Translator: Automatically generated\n"

View file

@ -5,7 +5,7 @@
# #
msgid "" msgid ""
msgstr "" 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" "POT-Creation-Date: 2014-02-03 08:13+0900\n"
"PO-Revision-Date: 2014-01-14 21:02+0900\n" "PO-Revision-Date: 2014-01-14 21:02+0900\n"
"Last-Translator: Automatically generated\n" "Last-Translator: Automatically generated\n"

View file

@ -5,7 +5,7 @@
# #
msgid "" msgid ""
msgstr "" 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" "POT-Creation-Date: 2014-02-03 08:13+0900\n"
"PO-Revision-Date: 2014-01-13 12:01+0900\n" "PO-Revision-Date: 2014-01-13 12:01+0900\n"
"Last-Translator: Automatically generated\n" "Last-Translator: Automatically generated\n"

View file

@ -208,7 +208,7 @@ The keywords are the following strings:
~~~~ {.notrust .keyword} ~~~~ {.notrust .keyword}
as as
box break box break
crate continue crate
else enum extern else enum extern
false fn for false fn for
if impl in if impl in
@ -2924,9 +2924,7 @@ while i < 10 {
### Infinite loops ### Infinite loops
The keyword `loop` in Rust appears both in _loop expressions_ and in _continue expressions_. A `loop` expression denotes an infinite loop.
A loop expression denotes an infinite loop;
see [Continue expressions](#continue-expressions) for continue expressions.
~~~~ {.notrust .ebnf .gram} ~~~~ {.notrust .ebnf .gram}
loop_expr : [ lifetime ':' ] "loop" '{' block '}'; loop_expr : [ lifetime ':' ] "loop" '{' block '}';
@ -2934,8 +2932,8 @@ loop_expr : [ lifetime ':' ] "loop" '{' block '}';
A `loop` expression may optionally have a _label_. A `loop` expression may optionally have a _label_.
If a label is present, 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. 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). See [Break expressions](#break-expressions) and [Continue expressions](#continue-expressions).
### Break expressions ### Break expressions
@ -2953,21 +2951,21 @@ but must enclose it.
### Continue expressions ### Continue expressions
~~~~ {.notrust .ebnf .gram} ~~~~ {.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, 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*. returning control to the loop *head*.
In the case of a `while` loop, In the case of a `while` loop,
the head is the conditional expression controlling the 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. 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, which need not be the innermost label enclosing the `break` expression,
but must enclose it. 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 ### 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 in mind, the compiler follows these rules when determining what format of
dependencies will be used: dependencies will be used:
1. If a dynamic library is being produced, then it is required for all upstream 1. If a static library is being produced, all upstream dependencies are
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
required to be available in `rlib` formats. This requirement stems from the 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 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 library, and in this case warnings will be printed about all unlinked native
dynamic dependencies. 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 format the upstream dependencies are available in. It is simply required that
all upstream dependencies be available for reading metadata from. 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 dependencies. It wouldn't be very efficient for all `rlib` files to contain a
copy of `libstd.rlib`! copy of `libstd.rlib`!
4. If an executable is being produced, then things get a little interesting. As 3. If an executable is being produced and the `-C prefer-dynamic` flag is not
with the above limitations in dynamic and static libraries, it is required specified, then dependencies are first attempted to be found in the `rlib`
for all upstream dependencies to be in the same format. The next question is format. If some dependencies are not available in an rlib format, then
whether to prefer a dynamic or a static format. The compiler currently favors dynamic linking is attempted (see below).
static linking over dynamic linking, but this can be inverted with the `-C
prefer-dynamic` flag to the compiler.
What this means is that first the compiler will attempt to find all upstream 4. If a dynamic library or an executable that is being dynamically linked is
dependencies as `rlib` files, and if successful, it will create a statically being produced, then the compiler will attempt to reconcile the available
linked executable. If an upstream dependency is missing as an `rlib` file, dependencies in either the rlib or dylib format to create a final product.
then the compiler will force all dependencies to be dynamic and will generate
errors if dynamic versions could not be found. 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 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 all compilation needs, and the other options are just available if more

View file

@ -2155,7 +2155,7 @@ unless they contain references.
* `Share` - Types that are *threadsafe* * `Share` - Types that are *threadsafe*
These are types that are safe to be used across several threads with access to 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. * `'static` - Non-borrowed types.
These are types that do not contain any data whose lifetime is bound to These are types that do not contain any data whose lifetime is bound to

View file

@ -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 # file at the top-level directory of this distribution and at
# http://rust-lang.org/COPYRIGHT. # http://rust-lang.org/COPYRIGHT.
# #

View file

@ -1,3 +1,5 @@
#!/usr/bin/env python
#
# Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT # Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
# file at the top-level directory of this distribution and at # file at the top-level directory of this distribution and at
# http://rust-lang.org/COPYRIGHT. # http://rust-lang.org/COPYRIGHT.

View file

@ -217,7 +217,7 @@
1 font-lock-preprocessor-face) 1 font-lock-preprocessor-face)
;; Syntax extension invocations like `foo!`, highlight including the ! ;; 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) 1 font-lock-preprocessor-face)
;; Field names like `foo:`, highlight excluding the : ;; Field names like `foo:`, highlight excluding the :

View file

@ -1,3 +1,5 @@
#!/usr/bin/env python
#
# Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT # Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
# file at the top-level directory of this distribution and at # file at the top-level directory of this distribution and at
# http://rust-lang.org/COPYRIGHT. # http://rust-lang.org/COPYRIGHT.

View file

@ -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 # file at the top-level directory of this distribution and at
# http://rust-lang.org/COPYRIGHT. # http://rust-lang.org/COPYRIGHT.
# #

View file

@ -7,7 +7,7 @@
<!ENTITY rustIdent "[a-zA-Z_][a-zA-Z_0-9]*"> <!ENTITY rustIdent "[a-zA-Z_][a-zA-Z_0-9]*">
<!ENTITY rustIntSuf "([iu](8|16|32|64)?)?"> <!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> <highlighting>
<list name="fn"> <list name="fn">
<item> fn </item> <item> fn </item>

View file

@ -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 # file at the top-level directory of this distribution and at
# http://rust-lang.org/COPYRIGHT. # http://rust-lang.org/COPYRIGHT.
# #

View file

@ -15,7 +15,7 @@
//! of individual objects while the arena itself is still alive. The benefit //! of individual objects while the arena itself is still alive. The benefit
//! of an arena is very fast allocation; just a pointer bump. //! 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 = "rlib"]
#![crate_type = "dylib"] #![crate_type = "dylib"]
#![license = "MIT/ASL2"] #![license = "MIT/ASL2"]

View file

@ -12,7 +12,7 @@
* Collection types. * Collection types.
*/ */
#![crate_id = "collections#0.11-pre"] #![crate_id = "collections#0.11.0-pre"]
#![crate_type = "rlib"] #![crate_type = "rlib"]
#![crate_type = "dylib"] #![crate_type = "dylib"]
#![license = "MIT/ASL2"] #![license = "MIT/ASL2"]

View file

@ -10,7 +10,7 @@
//! The Rust core library //! The Rust core library
#![crate_id = "core#0.11-pre"] #![crate_id = "core#0.11.0-pre"]
#![license = "MIT/ASL2"] #![license = "MIT/ASL2"]
#![crate_type = "rlib"] #![crate_type = "rlib"]
#![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", #![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",

View file

@ -30,20 +30,23 @@
//! of a value and take action, always accounting for the `None` case. //! of a value and take action, always accounting for the `None` case.
//! //!
//! ``` //! ```
//! # // FIXME This is not the greatest first example //! fn divide(numerator: f64, denominator: f64) -> Option<f64> {
//! // cow_says contains the word "moo" //! if denominator == 0.0 {
//! let cow_says = Some("moo"); //! None
//! // dog_says does not contain a value //! } else {
//! let dog_says: Option<&str> = None; //! 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 //! // Pattern match to retrieve the value
//! match (cow_says, dog_says) { //! match result {
//! (Some(cow_words), Some(dog_words)) => { //! // The division was valid
//! println!("Cow says {} and dog says {}!", cow_words, dog_words); //! Some(x) => println!("Result: {}", x),
//! } //! // The division was invalid
//! (Some(cow_words), None) => println!("Cow says {}", cow_words), //! None => println!("Cannot divide by 0")
//! (None, Some(dog_words)) => println!("Dog says {}", dog_words),
//! (None, None) => println!("Cow and dog are suspiciously silent")
//! } //! }
//! ``` //! ```
//! //!

View file

@ -505,7 +505,7 @@ pub trait ImmutableVector<'a, T> {
fn bsearch(&self, f: |&T| -> Ordering) -> Option<uint>; 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 * and adjusts the slice in place so that it no longer contains
* that element. O(1). * that element. O(1).
* *
@ -523,7 +523,7 @@ pub trait ImmutableVector<'a, T> {
fn shift_ref(&mut self) -> Option<&'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 * and adjusts the slice in place so that it no longer contains
* that element. O(1). * 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> { fn shift_ref(&mut self) -> Option<&'a T> {
if self.len() == 0 { return None; }
unsafe { unsafe {
let s: &mut Slice<T> = transmute(self); 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> { fn pop_ref(&mut self) -> Option<&'a T> {
if self.len() == 0 { return None; }
unsafe { unsafe {
let s: &mut Slice<T> = transmute(self); 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> { fn mut_shift_ref(&mut self) -> Option<&'a mut T> {
if self.len() == 0 { return None; }
unsafe { unsafe {
let s: &mut Slice<T> = transmute(self); let s: &mut Slice<T> = transmute(self);
// FIXME #13933: this `&` -> `&mut` cast is a little match raw::shift_ptr(s) {
// dubious // FIXME #13933: this `&` -> `&mut` cast is a little
Some(&mut *(raw::shift_ptr(s) as *mut _)) // dubious
Some(p) => Some(&mut *(p as *mut _)),
None => None,
}
} }
} }
fn mut_pop_ref(&mut self) -> Option<&'a mut T> { fn mut_pop_ref(&mut self) -> Option<&'a mut T> {
if self.len() == 0 { return None; }
unsafe { unsafe {
let s: &mut Slice<T> = transmute(self); let s: &mut Slice<T> = transmute(self);
// FIXME #13933: this `&` -> `&mut` cast is a little match raw::pop_ptr(s) {
// dubious // FIXME #13933: this `&` -> `&mut` cast is a little
Some(&mut *(raw::pop_ptr(s) as *mut _)) // dubious
Some(p) => Some(&mut *(p as *mut _)),
None => None,
}
} }
} }
@ -1165,6 +1173,7 @@ pub mod raw {
use iter::Iterator; use iter::Iterator;
use ptr::RawPtr; use ptr::RawPtr;
use raw::Slice; use raw::Slice;
use option::{None, Option, Some};
/** /**
* Form a slice from a pointer and length (as a number of units, * 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 * Returns a pointer to first element in slice and adjusts
* slice so it no longer contains that element. Fails if * slice so it no longer contains that element. Returns None
* slice is empty. O(1). * if the slice is empty. O(1).
*/ */
pub unsafe fn shift_ptr<T>(slice: &mut Slice<T>) -> *T { #[inline]
if slice.len == 0 { fail!("shift on empty slice"); } pub unsafe fn shift_ptr<T>(slice: &mut Slice<T>) -> Option<*T> {
if slice.len == 0 { return None; }
let head: *T = slice.data; let head: *T = slice.data;
slice.data = slice.data.offset(1); slice.data = slice.data.offset(1);
slice.len -= 1; slice.len -= 1;
head Some(head)
} }
/** /**
* Returns a pointer to last element in slice and adjusts * Returns a pointer to last element in slice and adjusts
* slice so it no longer contains that element. Fails if * slice so it no longer contains that element. Returns None
* slice is empty. O(1). * if the slice is empty. O(1).
*/ */
pub unsafe fn pop_ptr<T>(slice: &mut Slice<T>) -> *T { #[inline]
if slice.len == 0 { fail!("pop on empty slice"); } 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); let tail: *T = slice.data.offset((slice.len - 1) as int);
slice.len -= 1; slice.len -= 1;
tail Some(tail)
} }
} }

View file

@ -14,7 +14,7 @@ Simple compression
*/ */
#![crate_id = "flate#0.11-pre"] #![crate_id = "flate#0.11.0-pre"]
#![crate_type = "rlib"] #![crate_type = "rlib"]
#![crate_type = "dylib"] #![crate_type = "dylib"]
#![license = "MIT/ASL2"] #![license = "MIT/ASL2"]

View file

@ -14,7 +14,7 @@
//! Parsing does not happen at runtime: structures of `std::fmt::rt` are //! Parsing does not happen at runtime: structures of `std::fmt::rt` are
//! generated instead. //! generated instead.
#![crate_id = "fmt_macros#0.11-pre"] #![crate_id = "fmt_macros#0.11.0-pre"]
#![license = "MIT/ASL2"] #![license = "MIT/ASL2"]
#![crate_type = "rlib"] #![crate_type = "rlib"]
#![crate_type = "dylib"] #![crate_type = "dylib"]

View file

@ -39,7 +39,7 @@ fn main() {
*/ */
#![crate_id = "fourcc#0.11-pre"] #![crate_id = "fourcc#0.11.0-pre"]
#![crate_type = "rlib"] #![crate_type = "rlib"]
#![crate_type = "dylib"] #![crate_type = "dylib"]
#![license = "MIT/ASL2"] #![license = "MIT/ASL2"]

View file

@ -76,7 +76,7 @@
//! } //! }
//! ~~~ //! ~~~
#![crate_id = "getopts#0.11-pre"] #![crate_id = "getopts#0.11.0-pre"]
#![crate_type = "rlib"] #![crate_type = "rlib"]
#![crate_type = "dylib"] #![crate_type = "dylib"]
#![license = "MIT/ASL2"] #![license = "MIT/ASL2"]

View file

@ -23,7 +23,7 @@
* `glob`/`fnmatch` functions. * `glob`/`fnmatch` functions.
*/ */
#![crate_id = "glob#0.11-pre"] #![crate_id = "glob#0.11.0-pre"]
#![crate_type = "rlib"] #![crate_type = "rlib"]
#![crate_type = "dylib"] #![crate_type = "dylib"]
#![license = "MIT/ASL2"] #![license = "MIT/ASL2"]

View file

@ -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 = "rlib"]
#![crate_type = "dylib"] #![crate_type = "dylib"]
#![license = "MIT/ASL2"] #![license = "MIT/ASL2"]

View file

@ -197,7 +197,7 @@
//! pool.shutdown(); //! pool.shutdown();
//! ``` //! ```
#![crate_id = "green#0.11-pre"] #![crate_id = "green#0.11.0-pre"]
#![license = "MIT/ASL2"] #![license = "MIT/ASL2"]
#![crate_type = "rlib"] #![crate_type = "rlib"]
#![crate_type = "dylib"] #![crate_type = "dylib"]

View file

@ -36,7 +36,7 @@ fn main() {
*/ */
#![crate_id = "hexfloat#0.11-pre"] #![crate_id = "hexfloat#0.11.0-pre"]
#![crate_type = "rlib"] #![crate_type = "rlib"]
#![crate_type = "dylib"] #![crate_type = "dylib"]
#![license = "MIT/ASL2"] #![license = "MIT/ASL2"]

View file

@ -9,7 +9,7 @@
// except according to those terms. // except according to those terms.
#![feature(globs)] #![feature(globs)]
#![crate_id = "libc#0.11-pre"] #![crate_id = "libc#0.11.0-pre"]
#![experimental] #![experimental]
#![no_std] // we don't need std, and we can't have std, since it doesn't exist #![no_std] // we don't need std, and we can't have std, since it doesn't exist
// yet. std depends on us. // yet. std depends on us.

View file

@ -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"] #![license = "MIT/ASL2"]
#![crate_type = "rlib"] #![crate_type = "rlib"]
#![crate_type = "dylib"] #![crate_type = "dylib"]

View file

@ -166,6 +166,14 @@ impl rtio::RtioFileStream for FileDesc {
libc::ftruncate(self.fd(), offset as libc::off_t) 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 { impl rtio::RtioPipe for FileDesc {
@ -317,6 +325,10 @@ impl rtio::RtioFileStream for CFile {
fn truncate(&mut self, offset: i64) -> Result<(), IoError> { fn truncate(&mut self, offset: i64) -> Result<(), IoError> {
self.flush().and_then(|()| self.fd.truncate(offset)) 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 { 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 { fn mkstat(stat: &libc::stat) -> io::FileStat {
let path = unsafe { CString::new(path.with_ref(|p| p), false) };
// FileStat times are in milliseconds // FileStat times are in milliseconds
fn mktime(secs: u64, nsecs: u64) -> u64 { secs * 1000 + nsecs / 1000000 } 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 } fn gen(_stat: &libc::stat) -> u64 { 0 }
io::FileStat { io::FileStat {
path: Path::new(path),
size: stat.st_size as u64, size: stat.st_size as u64,
kind: kind, kind: kind,
perm: unsafe { perm: unsafe {
@ -508,7 +517,7 @@ fn mkstat(stat: &libc::stat, path: &CString) -> io::FileStat {
pub fn stat(p: &CString) -> IoResult<io::FileStat> { pub fn stat(p: &CString) -> IoResult<io::FileStat> {
let mut stat: libc::stat = unsafe { mem::uninit() }; let mut stat: libc::stat = unsafe { mem::uninit() };
match retry(|| unsafe { libc::stat(p.with_ref(|p| p), &mut stat) }) { 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()), _ => Err(super::last_error()),
} }
} }
@ -516,7 +525,7 @@ pub fn stat(p: &CString) -> IoResult<io::FileStat> {
pub fn lstat(p: &CString) -> IoResult<io::FileStat> { pub fn lstat(p: &CString) -> IoResult<io::FileStat> {
let mut stat: libc::stat = unsafe { mem::uninit() }; let mut stat: libc::stat = unsafe { mem::uninit() };
match retry(|| unsafe { libc::lstat(p.with_ref(|p| p), &mut stat) }) { 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()), _ => Err(super::last_error()),
} }
} }

View file

@ -197,6 +197,14 @@ impl rtio::RtioFileStream for FileDesc {
let _ = self.seek(orig_pos as i64, io::SeekSet); let _ = self.seek(orig_pos as i64, io::SeekSet);
return ret; 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 { 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 { fn mkstat(stat: &libc::stat) -> io::FileStat {
let path = unsafe { CString::new(path.with_ref(|p| p), false) };
let kind = match (stat.st_mode as c_int) & libc::S_IFMT { let kind = match (stat.st_mode as c_int) & libc::S_IFMT {
libc::S_IFREG => io::TypeFile, libc::S_IFREG => io::TypeFile,
libc::S_IFDIR => io::TypeDirectory, libc::S_IFDIR => io::TypeDirectory,
@ -483,7 +490,6 @@ fn mkstat(stat: &libc::stat, path: &CString) -> io::FileStat {
}; };
io::FileStat { io::FileStat {
path: Path::new(path),
size: stat.st_size as u64, size: stat.st_size as u64,
kind: kind, kind: kind,
perm: unsafe { perm: unsafe {
@ -511,7 +517,7 @@ pub fn stat(p: &CString) -> IoResult<io::FileStat> {
let mut stat: libc::stat = unsafe { mem::uninit() }; let mut stat: libc::stat = unsafe { mem::uninit() };
as_utf16_p(p.as_str().unwrap(), |up| { as_utf16_p(p.as_str().unwrap(), |up| {
match unsafe { libc::wstat(up, &mut stat) } { match unsafe { libc::wstat(up, &mut stat) } {
0 => Ok(mkstat(&stat, p)), 0 => Ok(mkstat(&stat)),
_ => Err(super::last_error()), _ => Err(super::last_error()),
} }
}) })

View file

@ -41,7 +41,7 @@
//! } //! }
//! ``` //! ```
#![crate_id = "native#0.11-pre"] #![crate_id = "native#0.11.0-pre"]
#![license = "MIT/ASL2"] #![license = "MIT/ASL2"]
#![crate_type = "rlib"] #![crate_type = "rlib"]
#![crate_type = "dylib"] #![crate_type = "dylib"]

View file

@ -10,7 +10,7 @@
#![feature(macro_rules)] #![feature(macro_rules)]
#![crate_id = "num#0.11-pre"] #![crate_id = "num#0.11.0-pre"]
#![crate_type = "rlib"] #![crate_type = "rlib"]
#![crate_type = "dylib"] #![crate_type = "dylib"]
#![license = "MIT/ASL2"] #![license = "MIT/ASL2"]

View file

@ -69,7 +69,7 @@ println!("{:?}", tuple_ptr)
``` ```
*/ */
#![crate_id = "rand#0.11-pre"] #![crate_id = "rand#0.11.0-pre"]
#![license = "MIT/ASL2"] #![license = "MIT/ASL2"]
#![crate_type = "dylib"] #![crate_type = "dylib"]
#![crate_type = "rlib"] #![crate_type = "rlib"]

View file

@ -352,7 +352,7 @@
//! characters in the search text and `m` is the number of instructions in a //! characters in the search text and `m` is the number of instructions in a
//! compiled expression. //! compiled expression.
#![crate_id = "regex#0.11-pre"] #![crate_id = "regex#0.11.0-pre"]
#![crate_type = "rlib"] #![crate_type = "rlib"]
#![crate_type = "dylib"] #![crate_type = "dylib"]
#![experimental] #![experimental]

View file

@ -11,7 +11,7 @@
//! This crate provides the `regex!` macro. Its use is documented in the //! This crate provides the `regex!` macro. Its use is documented in the
//! `regex` crate. //! `regex` crate.
#![crate_id = "regex_macros#0.11-pre"] #![crate_id = "regex_macros#0.11.0-pre"]
#![crate_type = "dylib"] #![crate_type = "dylib"]
#![experimental] #![experimental]
#![license = "MIT/ASL2"] #![license = "MIT/ASL2"]

View file

@ -193,7 +193,7 @@ pub fn phase_2_configure_and_expand(sess: &Session,
krate = time(time_passes, "expansion", krate, |krate| { krate = time(time_passes, "expansion", krate, |krate| {
// Windows dlls do not have rpaths, so they don't know how to find their // 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 // dependent dlls. Note that this uses cfg!(windows) as opposed to
// targ_cfg because syntax extensions are always loaded for the host // targ_cfg because syntax extensions are always loaded for the host
// compiler, not for the target. // compiler, not for the target.

View file

@ -22,7 +22,7 @@ use syntax::parse::token::InternedString;
use syntax::parse::token; use syntax::parse::token;
use syntax::util::small_vector::SmallVector; 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) pub fn maybe_inject_crates_ref(sess: &Session, krate: ast::Crate)
-> ast::Crate { -> ast::Crate {

View file

@ -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"] #![comment = "The Rust compiler"]
#![license = "MIT/ASL2"] #![license = "MIT/ASL2"]
#![crate_type = "dylib"] #![crate_type = "dylib"]

View file

@ -1775,6 +1775,7 @@ impl<'a> fmt::Show for Sidebar<'a> {
try!(block(fmt.buf, "enum", "Enums", it, cx)); try!(block(fmt.buf, "enum", "Enums", it, cx));
try!(block(fmt.buf, "trait", "Traits", it, cx)); try!(block(fmt.buf, "trait", "Traits", it, cx));
try!(block(fmt.buf, "fn", "Functions", it, cx)); try!(block(fmt.buf, "fn", "Functions", it, cx));
try!(block(fmt.buf, "macro", "Macros", it, cx));
Ok(()) Ok(())
} }
} }

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#![crate_id = "rustdoc#0.11-pre"] #![crate_id = "rustdoc#0.11.0-pre"]
#![desc = "rustdoc, the Rust documentation extractor"] #![desc = "rustdoc, the Rust documentation extractor"]
#![license = "MIT/ASL2"] #![license = "MIT/ASL2"]
#![crate_type = "dylib"] #![crate_type = "dylib"]

View file

@ -14,6 +14,7 @@ use std::cmp;
use std::strbuf::StrBuf; use std::strbuf::StrBuf;
use std::uint; use std::uint;
use syntax::ast; use syntax::ast;
use syntax::ast_util;
use clean; use clean;
use clean::Item; use clean::Item;
@ -206,7 +207,7 @@ impl<'a> fold::DocFolder for ImplStripper<'a> {
match imp.trait_ { match imp.trait_ {
Some(clean::ResolvedPath{ did, .. }) => { Some(clean::ResolvedPath{ did, .. }) => {
let ImplStripper(s) = *self; let ImplStripper(s) = *self;
if !s.contains(&did.node) { if ast_util::is_local(did) && !s.contains(&did.node) {
return None; return None;
} }
} }

View file

@ -70,6 +70,12 @@ impl FsRequest {
}).map(|req| req.mkstat()) }).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) pub fn write(loop_: &Loop, fd: c_int, buf: &[u8], offset: i64)
-> Result<(), UvError> -> Result<(), UvError>
{ {
@ -262,8 +268,6 @@ impl FsRequest {
} }
pub fn mkstat(&self) -> FileStat { 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(); let stat = self.get_stat();
fn to_msec(stat: uvll::uv_timespec_t) -> u64 { fn to_msec(stat: uvll::uv_timespec_t) -> u64 {
// Be sure to cast to u64 first to prevent overflowing if the tv_sec // Be sure to cast to u64 first to prevent overflowing if the tv_sec
@ -279,7 +283,6 @@ impl FsRequest {
_ => io::TypeUnknown, _ => io::TypeUnknown,
}; };
FileStat { FileStat {
path: path,
size: stat.st_size as u64, size: stat.st_size as u64,
kind: kind, kind: kind,
perm: unsafe { perm: unsafe {
@ -463,6 +466,11 @@ impl rtio::RtioFileStream for FileWatcher {
let r = FsRequest::truncate(&self.loop_, self.fd, offset); let r = FsRequest::truncate(&self.loop_, self.fd, offset);
r.map_err(uv_error_to_io_error) 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)] #[cfg(test)]
@ -537,6 +545,10 @@ mod test {
assert!(result.is_ok()); assert!(result.is_ok());
assert_eq!(result.unwrap().size, 5); 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) {} fn free<T>(_: T) {}
free(file); free(file);

View 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"] #![license = "MIT/ASL2"]
#![crate_type = "rlib"] #![crate_type = "rlib"]
#![crate_type = "dylib"] #![crate_type = "dylib"]

View file

@ -28,7 +28,7 @@
//! An example version number with all five components is //! An example version number with all five components is
//! `0.8.1-rc.3.0+20130922.linux`. //! `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 = "rlib"]
#![crate_type = "dylib"] #![crate_type = "dylib"]
#![license = "MIT/ASL2"] #![license = "MIT/ASL2"]

View file

@ -14,7 +14,7 @@
Core encoding and decoding interfaces. Core encoding and decoding interfaces.
*/ */
#![crate_id = "serialize#0.11-pre"] #![crate_id = "serialize#0.11.0-pre"]
#![crate_type = "rlib"] #![crate_type = "rlib"]
#![crate_type = "dylib"] #![crate_type = "dylib"]
#![license = "MIT/ASL2"] #![license = "MIT/ASL2"]

View file

@ -214,6 +214,11 @@ impl File {
pub fn eof(&self) -> bool { pub fn eof(&self) -> bool {
self.last_nread == 0 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. /// Unlink a file from the underlying filesystem.
@ -887,9 +892,12 @@ mod test {
let tmpdir = tmpdir(); let tmpdir = tmpdir();
let filename = &tmpdir.join("file_stat_correct_on_is_file.txt"); 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"; let msg = "hw";
fs.write(msg.as_bytes()).unwrap(); 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)); let stat_res_fn = check!(stat(filename));
assert_eq!(stat_res_fn.kind, io::TypeFile); assert_eq!(stat_res_fn.kind, io::TypeFile);
@ -1228,12 +1236,12 @@ mod test {
check!(file.fsync()); check!(file.fsync());
// Do some simple things with truncation // Do some simple things with truncation
assert_eq!(check!(stat(&path)).size, 3); assert_eq!(check!(file.stat()).size, 3);
check!(file.truncate(10)); 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.write(bytes!("bar")));
check!(file.fsync()); 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()), assert_eq!(check!(File::open(&path).read_to_end()),
(Vec::from_slice(bytes!("foobar", 0, 0, 0, 0)))); (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 // Ensure that the intermediate zeroes are all filled in (we're seeked
// past the end of the file). // past the end of the file).
check!(file.truncate(2)); 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.write(bytes!("wut")));
check!(file.fsync()); 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()), assert_eq!(check!(File::open(&path).read_to_end()),
(Vec::from_slice(bytes!("fo", 0, 0, 0, 0, "wut")))); (Vec::from_slice(bytes!("fo", 0, 0, 0, 0, "wut"))));
drop(file); drop(file);

View file

@ -228,7 +228,6 @@ use ops::{BitOr, BitAnd, Sub};
use option::{Option, Some, None}; use option::{Option, Some, None};
use os; use os;
use owned::Box; use owned::Box;
use path::Path;
use result::{Ok, Err, Result}; use result::{Ok, Err, Result};
use slice::{Vector, MutableVector, ImmutableVector}; use slice::{Vector, MutableVector, ImmutableVector};
use str::{StrSlice, StrAllocating}; use str::{StrSlice, StrAllocating};
@ -1510,14 +1509,11 @@ pub enum FileType {
/// Err(e) => fail!("couldn't read foo.txt: {}", e), /// Err(e) => fail!("couldn't read foo.txt: {}", e),
/// }; /// };
/// ///
/// println!("path: {}", info.path.display());
/// println!("byte size: {}", info.size); /// println!("byte size: {}", info.size);
/// # } /// # }
/// ``` /// ```
#[deriving(Hash)] #[deriving(Hash)]
pub struct FileStat { pub struct FileStat {
/// The path that this stat structure is describing
pub path: Path,
/// The size of the file, in bytes /// The size of the file, in bytes
pub size: u64, pub size: u64,
/// The kind of file this path points to (directory, file, pipe, etc.) /// The kind of file this path points to (directory, file, pipe, etc.)

View file

@ -140,6 +140,7 @@ pub struct ProcessConfig<'a> {
} }
/// The output of a finished process. /// The output of a finished process.
#[deriving(Eq, TotalEq, Clone)]
pub struct ProcessOutput { pub struct ProcessOutput {
/// The status (exit code) of the process. /// The status (exit code) of the process.
pub status: ProcessExit, pub status: ProcessExit,

View file

@ -96,7 +96,7 @@
//! all the standard macros, such as `assert!`, `fail!`, `println!`, //! all the standard macros, such as `assert!`, `fail!`, `println!`,
//! and `format!`, also available to all Rust code. //! 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"] #![comment = "The Rust standard library"]
#![license = "MIT/ASL2"] #![license = "MIT/ASL2"]
#![crate_type = "rlib"] #![crate_type = "rlib"]

View file

@ -30,20 +30,23 @@
//! of a value and take action, always accounting for the `None` case. //! of a value and take action, always accounting for the `None` case.
//! //!
//! ``` //! ```
//! # // FIXME This is not the greatest first example //! fn divide(numerator: f64, denominator: f64) -> Option<f64> {
//! // cow_says contains the word "moo" //! if denominator == 0.0 {
//! let cow_says = Some("moo"); //! None
//! // dog_says does not contain a value //! } else {
//! let dog_says: Option<&str> = None; //! 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 //! // Pattern match to retrieve the value
//! match (cow_says, dog_says) { //! match result {
//! (Some(cow_words), Some(dog_words)) => { //! // The division was valid
//! println!("Cow says {} and dog says {}!", cow_words, dog_words); //! Some(x) => println!("Result: {}", x),
//! } //! // The division was invalid
//! (Some(cow_words), None) => println!("Cow says {}", cow_words), //! None => println!("Cannot divide by 0")
//! (None, Some(dog_words)) => println!("Dog says {}", dog_words),
//! (None, None) => println!("Cow and dog are suspiciously silent")
//! } //! }
//! ``` //! ```
//! //!

View file

@ -95,13 +95,12 @@ pub fn getcwd() -> Path {
#[cfg(windows)] #[cfg(windows)]
pub mod win32 { pub mod win32 {
use iter::Iterator;
use libc::types::os::arch::extra::DWORD; use libc::types::os::arch::extra::DWORD;
use libc; use libc;
use option::{None, Option, Expect}; use option::{None, Option, Expect};
use option; use option;
use os::TMPBUF_SZ; use os::TMPBUF_SZ;
use slice::{MutableVector, ImmutableVector, OwnedVector}; use slice::{MutableVector, ImmutableVector};
use str::{StrSlice, StrAllocating}; use str::{StrSlice, StrAllocating};
use str; use str;
use vec::Vec; use vec::Vec;
@ -142,7 +141,7 @@ pub mod win32 {
} }
pub fn as_utf16_p<T>(s: &str, f: |*u16| -> T) -> T { 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. // Null terminate before passing on.
t.push(0u16); t.push(0u16);
f(t.as_ptr()) f(t.as_ptr())

View file

@ -269,6 +269,7 @@ pub trait RtioFileStream {
fn fsync(&mut self) -> IoResult<()>; fn fsync(&mut self) -> IoResult<()>;
fn datasync(&mut self) -> IoResult<()>; fn datasync(&mut self) -> IoResult<()>;
fn truncate(&mut self, offset: i64) -> IoResult<()>; fn truncate(&mut self, offset: i64) -> IoResult<()>;
fn fstat(&mut self) -> IoResult<FileStat>;
} }
pub trait RtioProcess { pub trait RtioProcess {

View file

@ -12,7 +12,7 @@
* Concurrency-enabled mechanisms and primitives. * Concurrency-enabled mechanisms and primitives.
*/ */
#![crate_id = "sync#0.11-pre"] #![crate_id = "sync#0.11.0-pre"]
#![crate_type = "rlib"] #![crate_type = "rlib"]
#![crate_type = "dylib"] #![crate_type = "dylib"]
#![license = "MIT/ASL2"] #![license = "MIT/ASL2"]

View file

@ -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"] #![license = "MIT/ASL2"]
#![crate_type = "dylib"] #![crate_type = "dylib"]
#![crate_type = "rlib"] #![crate_type = "rlib"]

View file

@ -125,7 +125,11 @@ enum ItemOrViewItem {
IoviViewItem(ViewItem) 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 The important thing is to make sure that lookahead doesn't balk
at INTERPOLATED tokens */ at INTERPOLATED tokens */
macro_rules! maybe_whole_expr ( macro_rules! maybe_whole_expr (
@ -135,7 +139,7 @@ macro_rules! maybe_whole_expr (
INTERPOLATED(token::NtPath(ref pt)) => Some((**pt).clone()), INTERPOLATED(token::NtPath(ref pt)) => Some((**pt).clone()),
_ => None, _ => None,
}; };
let ret = match ($p).token { let found = match ($p).token {
INTERPOLATED(token::NtExpr(e)) => { INTERPOLATED(token::NtExpr(e)) => {
Some(e) Some(e)
} }
@ -145,7 +149,7 @@ macro_rules! maybe_whole_expr (
} }
_ => None _ => None
}; };
match ret { match found {
Some(e) => { Some(e) => {
$p.bump(); $p.bump();
return e; return e;
@ -156,16 +160,17 @@ macro_rules! maybe_whole_expr (
) )
) )
// As above, but for things other than expressions
macro_rules! maybe_whole ( macro_rules! maybe_whole (
($p:expr, $constructor:ident) => ( ($p:expr, $constructor:ident) => (
{ {
let __found__ = match ($p).token { let found = match ($p).token {
INTERPOLATED(token::$constructor(_)) => { INTERPOLATED(token::$constructor(_)) => {
Some(($p).bump_and_get()) Some(($p).bump_and_get())
} }
_ => None _ => None
}; };
match __found__ { match found {
Some(INTERPOLATED(token::$constructor(x))) => { Some(INTERPOLATED(token::$constructor(x))) => {
return x.clone() return x.clone()
} }
@ -175,13 +180,13 @@ macro_rules! maybe_whole (
); );
(no_clone $p:expr, $constructor:ident) => ( (no_clone $p:expr, $constructor:ident) => (
{ {
let __found__ = match ($p).token { let found = match ($p).token {
INTERPOLATED(token::$constructor(_)) => { INTERPOLATED(token::$constructor(_)) => {
Some(($p).bump_and_get()) Some(($p).bump_and_get())
} }
_ => None _ => None
}; };
match __found__ { match found {
Some(INTERPOLATED(token::$constructor(x))) => { Some(INTERPOLATED(token::$constructor(x))) => {
return x return x
} }
@ -191,13 +196,13 @@ macro_rules! maybe_whole (
); );
(deref $p:expr, $constructor:ident) => ( (deref $p:expr, $constructor:ident) => (
{ {
let __found__ = match ($p).token { let found = match ($p).token {
INTERPOLATED(token::$constructor(_)) => { INTERPOLATED(token::$constructor(_)) => {
Some(($p).bump_and_get()) Some(($p).bump_and_get())
} }
_ => None _ => None
}; };
match __found__ { match found {
Some(INTERPOLATED(token::$constructor(x))) => { Some(INTERPOLATED(token::$constructor(x))) => {
return (*x).clone() return (*x).clone()
} }
@ -207,13 +212,13 @@ macro_rules! maybe_whole (
); );
(Some $p:expr, $constructor:ident) => ( (Some $p:expr, $constructor:ident) => (
{ {
let __found__ = match ($p).token { let found = match ($p).token {
INTERPOLATED(token::$constructor(_)) => { INTERPOLATED(token::$constructor(_)) => {
Some(($p).bump_and_get()) Some(($p).bump_and_get())
} }
_ => None _ => None
}; };
match __found__ { match found {
Some(INTERPOLATED(token::$constructor(x))) => { Some(INTERPOLATED(token::$constructor(x))) => {
return Some(x.clone()), return Some(x.clone()),
} }
@ -223,13 +228,13 @@ macro_rules! maybe_whole (
); );
(iovi $p:expr, $constructor:ident) => ( (iovi $p:expr, $constructor:ident) => (
{ {
let __found__ = match ($p).token { let found = match ($p).token {
INTERPOLATED(token::$constructor(_)) => { INTERPOLATED(token::$constructor(_)) => {
Some(($p).bump_and_get()) Some(($p).bump_and_get())
} }
_ => None _ => None
}; };
match __found__ { match found {
Some(INTERPOLATED(token::$constructor(x))) => { Some(INTERPOLATED(token::$constructor(x))) => {
return IoviItem(x.clone()) return IoviItem(x.clone())
} }
@ -239,13 +244,13 @@ macro_rules! maybe_whole (
); );
(pair_empty $p:expr, $constructor:ident) => ( (pair_empty $p:expr, $constructor:ident) => (
{ {
let __found__ = match ($p).token { let found = match ($p).token {
INTERPOLATED(token::$constructor(_)) => { INTERPOLATED(token::$constructor(_)) => {
Some(($p).bump_and_get()) Some(($p).bump_and_get())
} }
_ => None _ => None
}; };
match __found__ { match found {
Some(INTERPOLATED(token::$constructor(x))) => { Some(INTERPOLATED(token::$constructor(x))) => {
return (Vec::new(), x) return (Vec::new(), x)
} }

View file

@ -10,7 +10,7 @@
//! Simple ANSI color library //! Simple ANSI color library
#![crate_id = "term#0.11-pre"] #![crate_id = "term#0.11.0-pre"]
#![comment = "Simple ANSI color library"] #![comment = "Simple ANSI color library"]
#![license = "MIT/ASL2"] #![license = "MIT/ASL2"]
#![crate_type = "rlib"] #![crate_type = "rlib"]

View file

@ -23,7 +23,7 @@
// running tests while providing a base that other test frameworks may // running tests while providing a base that other test frameworks may
// build off of. // 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"] #![comment = "Rust internal test library only used by rustc"]
#![license = "MIT/ASL2"] #![license = "MIT/ASL2"]
#![crate_type = "rlib"] #![crate_type = "rlib"]

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#![crate_id = "time#0.11-pre"] #![crate_id = "time#0.11.0-pre"]
#![crate_type = "rlib"] #![crate_type = "rlib"]
#![crate_type = "dylib"] #![crate_type = "dylib"]
#![license = "MIT/ASL2"] #![license = "MIT/ASL2"]

View file

@ -10,7 +10,7 @@
//! Types/fns concerning URLs (see RFC 3986) //! 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 = "rlib"]
#![crate_type = "dylib"] #![crate_type = "dylib"]
#![license = "MIT/ASL2"] #![license = "MIT/ASL2"]

View file

@ -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 = "rlib"]
#![crate_type = "dylib"] #![crate_type = "dylib"]
#![license = "MIT/ASL2"] #![license = "MIT/ASL2"]

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#![crate_id = "workcache#0.11-pre"] #![crate_id = "workcache#0.11.0-pre"]
#![crate_type = "rlib"] #![crate_type = "rlib"]
#![crate_type = "dylib"] #![crate_type = "dylib"]
#![license = "MIT/ASL2"] #![license = "MIT/ASL2"]

View file

@ -10,5 +10,5 @@
// no-prefer-dynamic // no-prefer-dynamic
#![crate_id = "collections#0.11-pre"] #![crate_id = "collections#0.11.0-pre"]
#![crate_type = "dylib"] #![crate_type = "dylib"]

View file

@ -10,5 +10,5 @@
// no-prefer-dynamic // no-prefer-dynamic
#![crate_id = "collections#0.11-pre"] #![crate_id = "collections#0.11.0-pre"]
#![crate_type = "rlib"] #![crate_type = "rlib"]

View file

@ -70,33 +70,30 @@ struct Planet {
fn advance(bodies: &mut [Planet, ..N_BODIES], dt: f64, steps: int) { fn advance(bodies: &mut [Planet, ..N_BODIES], dt: f64, steps: int) {
for _ in range(0, steps) { for _ in range(0, steps) {
{ let mut b_slice = bodies.as_mut_slice();
let mut b_slice = bodies.as_mut_slice(); loop {
loop { let bi = match b_slice.mut_shift_ref() {
let bi = match b_slice.mut_shift_ref() { Some(bi) => bi,
Some(bi) => bi, None => break
None => break };
}; for bj in b_slice.mut_iter() {
for bj in b_slice.mut_iter() { let dx = bi.x - bj.x;
let dx = bi.x - bj.x; let dy = bi.y - bj.y;
let dy = bi.y - bj.y; let dz = bi.z - bj.z;
let dz = bi.z - bj.z;
let d2 = dx * dx + dy * dy + dz * dz; let d2 = dx * dx + dy * dy + dz * dz;
let mag = dt / (d2 * d2.sqrt()); let mag = dt / (d2 * d2.sqrt());
bi.vx -= dx * bj.mass * mag; let massj_mag = bj.mass * mag;
bi.vy -= dy * bj.mass * mag; bi.vx -= dx * massj_mag;
bi.vz -= dz * bj.mass * mag; bi.vy -= dy * massj_mag;
bi.vz -= dz * massj_mag;
bj.vx += dx * bi.mass * mag; let massi_mag = bi.mass * mag;
bj.vy += dy * bi.mass * mag; bj.vx += dx * massi_mag;
bj.vz += dz * bi.mass * mag; bj.vy += dy * massi_mag;
} bj.vz += dz * massi_mag;
} }
}
for bi in bodies.mut_iter() {
bi.x += dt * bi.vx; bi.x += dt * bi.vx;
bi.y += dt * bi.vy; bi.y += dt * bi.vy;
bi.z += dt * bi.vz; bi.z += dt * bi.vz;

View file

@ -1,7 +1,7 @@
-include ../tools.mk -include ../tools.mk
all: 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-name crate.rs` = "foo" ]
[ `$(RUSTC) --crate-file-name crate.rs` = "foo" ] [ `$(RUSTC) --crate-file-name crate.rs` = "foo" ]
[ `$(RUSTC) --crate-file-name --crate-type=lib --test crate.rs` = "foo" ] [ `$(RUSTC) --crate-file-name --crate-type=lib --test crate.rs` = "foo" ]

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // 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 // 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 // only needs the crate attributes (which are guaranteed to be at the top) be

View file

@ -15,7 +15,7 @@
#![no_std] #![no_std]
extern crate std; extern crate std;
extern crate zed = "std"; extern crate zed = "std";
extern crate bar = "std#0.11-pre"; extern crate bar = "std#0.11.0-pre";
use std::str; use std::str;