Skip to content

Commit ca46f9c

Browse files
committed
---
yaml --- r: 161082 b: refs/heads/try c: 0b6ec70 h: refs/heads/master v: v3
1 parent b518e3c commit ca46f9c

35 files changed

+319
-513
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 4eb72d268f337a8f117c86a2ac1b98336cab9e9d
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: c9f6d696420107f82304b992cf623b806995fe18
5-
refs/heads/try: cbdaf2ebc7d39588a5f6efee1cd9de0a273571a9
5+
refs/heads/try: 0b6ec701974096b68e666693b8a750fb6a5d65c6
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
88
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596

branches/try/configure

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1031,7 +1031,6 @@ do
10311031
make_dir $h/test/doc-guide-tasks
10321032
make_dir $h/test/doc-guide-plugin
10331033
make_dir $h/test/doc-guide-crates
1034-
make_dir $h/test/doc-guide-error-handling
10351034
make_dir $h/test/doc-rust
10361035
done
10371036

branches/try/mk/docs.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
######################################################################
2828
DOCS := index intro tutorial guide guide-ffi guide-macros guide-lifetimes \
2929
guide-tasks guide-container guide-pointers guide-testing \
30-
guide-plugin guide-crates complement-bugreport guide-error-handling \
30+
guide-plugin guide-crates complement-bugreport \
3131
complement-lang-faq complement-design-faq complement-project-faq \
3232
rustdoc guide-unsafe guide-strings reference
3333

branches/try/src/doc/guide-error-handling.md

Lines changed: 0 additions & 227 deletions
This file was deleted.

branches/try/src/doc/index.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ a guide that can help you out:
5959
* [References and Lifetimes](guide-lifetimes.html)
6060
* [Crates and modules](guide-crates.html)
6161
* [Tasks and Communication](guide-tasks.html)
62-
* [Error Handling](guide-error-handling.html)
6362
* [Foreign Function Interface](guide-ffi.html)
6463
* [Writing Unsafe and Low-Level Code](guide-unsafe.html)
6564
* [Macros](guide-macros.html)

branches/try/src/doc/po4a.conf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
[type: text] src/doc/guide-testing.md $lang:doc/l10n/$lang/guide-testing.md
2121
[type: text] src/doc/guide-unsafe.md $lang:doc/l10n/$lang/guide-unsafe.md
2222
[type: text] src/doc/guide-crates.md $lang:doc/l10n/$lang/guide-crates.md
23-
[type: text] src/doc/guide-error-handling.md $lang:doc/l10n/$lang/guide-error-handling.md
2423
[type: text] src/doc/guide.md $lang:doc/l10n/$lang/guide.md
2524
[type: text] src/doc/index.md $lang:doc/l10n/$lang/index.md
2625
[type: text] src/doc/intro.md $lang:doc/l10n/$lang/intro.md

branches/try/src/doc/reference.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3557,14 +3557,17 @@ The machine types are the following:
35573557

35583558
#### Machine-dependent integer types
35593559

3560-
The `uint` type is an unsigned integer type with the same number of bits as the
3561-
platform's pointer type. It can represent every memory address in the process.
3562-
3563-
The `int` type is a signed integer type with the same number of bits as the
3564-
platform's pointer type. The theoretical upper bound on object and array size
3565-
is the maximum `int` value. This ensures that `int` can be used to calculate
3566-
differences between pointers into an object or array and can address every byte
3567-
within an object along with one byte past the end.
3560+
The Rust type `uint` [^rustuint] is an
3561+
unsigned integer type with target-machine-dependent size. Its size, in
3562+
bits, is equal to the number of bits required to hold any memory address on
3563+
the target machine.
3564+
3565+
The Rust type `int` [^rustint] is a two's complement signed integer type with
3566+
target-machine-dependent size. Its size, in bits, is equal to the size of the
3567+
rust type `uint` on the same target machine.
3568+
3569+
[^rustuint]: A Rust `uint` is analogous to a C99 `uintptr_t`.
3570+
[^rustint]: A Rust `int` is analogous to a C99 `intptr_t`.
35683571

35693572
### Textual types
35703573

branches/try/src/libcore/result.rs

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,52 @@
227227
//! ```
228228
//!
229229
//! `try!` is imported by the prelude, and is available everywhere.
230+
//!
231+
//! # `Result` and `Option`
232+
//!
233+
//! The `Result` and [`Option`](../option/index.html) types are
234+
//! similar and complementary: they are often employed to indicate a
235+
//! lack of a return value; and they are trivially converted between
236+
//! each other, so `Result`s are often handled by first converting to
237+
//! `Option` with the [`ok`](type.Result.html#method.ok) and
238+
//! [`err`](type.Result.html#method.ok) methods.
239+
//!
240+
//! Whereas `Option` only indicates the lack of a value, `Result` is
241+
//! specifically for error reporting, and carries with it an error
242+
//! value. Sometimes `Option` is used for indicating errors, but this
243+
//! is only for simple cases and is generally discouraged. Even when
244+
//! there is no useful error value to return, prefer `Result<T, ()>`.
245+
//!
246+
//! Converting to an `Option` with `ok()` to handle an error:
247+
//!
248+
//! ```
249+
//! use std::io::Timer;
250+
//! let mut t = Timer::new().ok().expect("failed to create timer!");
251+
//! ```
252+
//!
253+
//! # `Result` vs. `panic!`
254+
//!
255+
//! `Result` is for recoverable errors; `panic!` is for unrecoverable
256+
//! errors. Callers should always be able to avoid panics if they
257+
//! take the proper precautions, for example, calling `is_some()`
258+
//! on an `Option` type before calling `unwrap`.
259+
//!
260+
//! The suitability of `panic!` as an error handling mechanism is
261+
//! limited by Rust's lack of any way to "catch" and resume execution
262+
//! from a thrown exception. Therefore using panics for error
263+
//! handling requires encapsulating code that may panic in a task.
264+
//! Calling the `panic!` macro, or invoking `panic!` indirectly should be
265+
//! avoided as an error reporting strategy. Panics is only for
266+
//! unrecoverable errors and a panicking task is typically the sign of
267+
//! a bug.
268+
//!
269+
//! A module that instead returns `Results` is alerting the caller
270+
//! that failure is possible, and providing precise control over how
271+
//! it is handled.
272+
//!
273+
//! Furthermore, panics may not be recoverable at all, depending on
274+
//! the context. The caller of `panic!` should assume that execution
275+
//! will not resume after the panic, that a panic is catastrophic.
230276
231277
#![stable]
232278

0 commit comments

Comments
 (0)