Commit Graph

72 Commits

Author SHA1 Message Date
Steve Klabnik 290da6f016 Remove the 30 minute intro
Fixes #24569.
2015-04-18 17:55:31 -04:00
Aaron Turon a9fd41e1f9 Fallout: move from scoped to spawn 2015-04-14 08:15:45 -07:00
Manish Goregaokar 6295406d9f Rollup merge of #24139 - xfq:patch-1, r=steveklabnik
Use HTTPS where possible to avoid plaintext HTTP connections.
2015-04-08 01:19:37 +05:30
bors b41f2df4ca Auto merge of #23277 - aochagavia:intro, r=steveklabnik
cc @steveklabnik
2015-04-07 11:34:38 +00:00
Xue Fuqiao 600101bdfd Update intro.md
Use HTTPS where possible to avoid plaintext HTTP connections.
2015-04-07 13:35:26 +08:00
Steve Klabnik 81801f2171 Re-word explanation on closures in intro
Fixes #23571
2015-03-22 15:40:46 -04:00
Paul ADENOT 7dbcf08211 Fix 404 to crates.io's doc on integrating with a native toolchain
This looks like the most logical target to give to this link, or at least what I would expect as someone that want to integrate with a native library.

r? @steveklabnik
2015-03-16 19:56:14 +01:00
Adolfo Ochagavía 5a82a8116b Remove unnecessary Arc usage in introduction 2015-03-11 13:41:31 +01:00
Jake Goulding b426a242e3 Make concurrent examples actually run concurrently
If we end the `scoped` call with a semicolon, the `JoinGuard` will be
dropped and not returned from the `map`. The thread will start up and
we immediately block, making for a very expensive sequential loop.
2015-03-08 16:12:07 -04:00
Jake Goulding a6ebd26208 Update example that uses deprecated Thread::scoped 2015-03-08 16:12:07 -04:00
Manish Goregaokar 44f8ac0b4d Rollup merge of #22947 - ic:master, r=steveklabnik
Changed guaranteed for \"quaranteed\", and
Made failing/working examples look alike.

r? @steveklabnik
2015-03-05 12:39:06 +05:30
Eric Platon dde4e5885e Made failing/working examples look alike.
The failing concurrency example was doing something different from the
working example. This commit changes just enough of the failing example
to (1) still fail with the same error, (2) tries to do the same as the
working example (increment a vector value and print it).

r? @steveklabnik
2015-03-04 13:11:57 +09:00
Alexander Campbell fdc45e361c Change quaranteed -> guaranteed in README.md 2015-02-28 11:33:48 -06:00
Alexander Campbell d084f7031c Change slithtly -> slightly in README.md 2015-02-28 11:32:13 -06:00
FuGangqiang 69bfb6f717 change to iterate over &vet 2015-02-28 09:59:52 +08:00
FuGangqiang 05bdfe8e2e remove the call `.iter()` 2015-02-27 21:57:02 +08:00
Jessy Diamond Exum 6154c88ddc Update intro.md to fix thread spawning example Closes #22419
Fixed example threaded code in intro doc never printing results. Threads were created with Thread::spawn instead of Thread::scoped.
2015-02-22 11:45:31 -08:00
Niko Matsakis 8c34b26606 Update docs by dropping suffixes except where they served to instruct. 2015-02-18 09:09:14 -05:00
Duane Edwards 9c686dc54d Correct typo for 'underyling' 2015-02-13 08:45:52 +10:00
Tobias Bucher b4a43f3864 Kill more `isize`s 2015-01-31 17:40:40 +01:00
Aaron Turon 537889aa78 Fix type inference problems in tests and docs 2015-01-21 11:16:00 -08:00
Aaron Turon a506d4cbfe Fallout from stabilization. 2015-01-21 08:11:07 -08:00
Andrew Barchuk 5f1ba93ad2 Replace obsolete constructions in into examples
Replace deprecated integer suffixes. Remove integer type notations
altogether where possible. Replace uses of deprecated `range()`
function with range notation.
2015-01-17 10:49:49 -05:00
Andrew Barchuk f77208972a Remove Thread::detach() call from intro example
The mentioned method are no longer part of Thread. Spawned threads are
detached by default as of now.
2015-01-17 10:49:49 -05:00
Andrew Barchuk 9ed27df180 Fix intro concurrency examples compilation warns
* Use range notation instead of deprecated `range()`

* Remove deprecated `u` integer suffixes used in ranges

* Replace deprecated `i` integer suffixes with `is` for vector numbers

`Thread::spawn()` still gives "use of unstable item" warning which I
hadn't found a way to fix.
2015-01-17 10:49:49 -05:00
Alex Crichton 46a490f42b rollup merge of #21075: iKevinY/intro-changes
- Make punctuation/formatting consistent with the changes made to *The Rust Programming Language* in #20782.
- Use title casing for "Safety and Speed" section.
- Reword some phrases to improve clarity.
2015-01-15 14:11:41 -08:00
Kevin Yap 31ac1fb93d Various changes to Rust Introduction
- Make punctuation/formatting consistent with the changes made to "The
  Rust Programming Language" in #20782.
- Use title casing for "Safety and Speed" section.
- Reword some phrases to improve clarity.
2015-01-12 19:25:17 -08:00
Steve Klabnik e485d297ea Improve example in the intro.
Thank you @bluss for the suggested implementation.

Fixes #20844
2015-01-12 15:14:17 -05:00
Duncan Regan c871773f32 Updates fixed-size suffix
Compiler gives the following warning:
`warning: the `u` suffix on integers is deprecated; use `us` or one of the fixed-sized suffixes`
And also the errror:
`error: mismatched types: expected `u64`, found `usize` (expected u64, found usize)`

Changing the suffix to `u64` results in a successful `cargo run` outputting the desired `Versions compared successfully!`
2015-01-10 16:19:11 -05:00
Steve Klabnik 16a6ebd1f6 "The Rust Programming Language"
This pulls all of our long-form documentation into a single document,
nicknamed "the book" and formally titled "The Rust Programming
Language."

A few things motivated this change:

* People knew of The Guide, but not the individual Guides. This merges
  them together, helping discoverability.
* You can get all of Rust's longform documentation in one place, which
  is nice.
* We now have rustbook in-tree, which can generate this kind of
  documentation. While its style is basic, the general idea is much
  better: a table of contents on the left-hand side.
* Rather than a almost 10,000-line guide.md, there are now smaller files
  per section.
2015-01-08 12:02:11 -05:00
Alex Crichton 5b1a285b73 rollup merge of #20693: EchoAce/intro-oboe
Issue #20686, proposed by nstoddard.
2015-01-07 17:17:27 -08:00
FakeKane da83e4d98a oboe removed 2015-01-07 09:09:37 -05:00
Aaron Turon caca9b2e71 Fallout from stabilization 2015-01-06 14:57:52 -08:00
Alex Crichton 76e5ed655c std: Return Result from RWLock/Mutex methods
All of the current std::sync primitives have poisoning enable which means that
when a task fails inside of a write-access lock then all future attempts to
acquire the lock will fail. This strategy ensures that stale data whose
invariants are possibly not upheld are never viewed by other tasks to help
propagate unexpected panics (bugs in a program) among tasks.

Currently there is no way to test whether a mutex or rwlock is poisoned. One
method would be to duplicate all the methods with a sister foo_catch function,
for example. This pattern is, however, against our [error guidelines][errors].
As a result, this commit exposes the fact that a task has failed internally
through the return value of a `Result`.

[errors]: https://github.com/rust-lang/rfcs/blob/master/text/0236-error-conventions.md#do-not-provide-both-result-and-fail-variants

All methods now return a `LockResult<T>` or a `TryLockResult<T>` which
communicates whether the lock was poisoned or not. In a `LockResult`, both the
`Ok` and `Err` variants contains the `MutexGuard<T>` that is being returned in
order to allow access to the data if poisoning is not desired. This also means
that the lock is *always* held upon returning from `.lock()`.

A new type, `PoisonError`, was added with one method `into_guard` which can
consume the assertion that a lock is poisoned to gain access to the underlying
data.

This is a breaking change because the signatures of these methods have changed,
often incompatible ways. One major difference is that the `wait` methods on a
condition variable now consume the guard and return it in as a `LockResult` to
indicate whether the lock was poisoned while waiting. Most code can be updated
by calling `.unwrap()` on the return value of `.lock()`.

[breaking-change]
2014-12-29 09:18:09 -08:00
Aaron Turon a27fbac868 Revise std::thread API to join by default
This commit is part of a series that introduces a `std::thread` API to
replace `std::task`.

In the new API, `spawn` returns a `JoinGuard`, which by default will
join the spawned thread when dropped. It can also be used to join
explicitly at any time, returning the thread's result. Alternatively,
the spawned thread can be explicitly detached (so no join takes place).

As part of this change, Rust processes now terminate when the main
thread exits, even if other detached threads are still running, moving
Rust closer to standard threading models. This new behavior may break code
that was relying on the previously implicit join-all.

In addition to the above, the new thread API also offers some built-in
support for building blocking abstractions in user space; see the module
doc for details.

Closes #18000

[breaking-change]
2014-12-18 23:31:52 -08:00
Brian Anderson 36f7f1e301 rollup merge of #19735: sethpollack/patch-1 2014-12-15 06:45:33 -08:00
Brian Anderson 42f4d636fa rollup merge of #19714: steveklabnik/gh16219
These should be properly annotated instead.

Fixes #16219.
2014-12-15 06:44:21 -08:00
Niko Matsakis 112faabf94 Update guide/intro to take into account the removal of `proc`.
cc @steveklabnick
2014-12-14 04:21:57 -05:00
Seth Pollack 7676d0164f Update intro.md 2014-12-11 11:21:48 -05:00
Steve Klabnik 3c9d8983be Fix up some {ignore} and {notrust}s
These should be properly annotated instead.

Fixes #16219.
2014-12-10 15:14:18 -05:00
Alex Crichton 1a61fe4280 Test fixes and rebase conflicts from the rollup 2014-12-09 10:26:04 -08:00
Alex Crichton fb587f1f9b rollup merge of #19614: steveklabnik/gh19599
Fixes #19599
2014-12-09 09:25:04 -08:00
Steve Klabnik 8ba5605233 remove usage of notrust from the docs
Fixes #19599
2014-12-07 04:18:56 -05:00
jbranchaud 2171c95553 Add missing semicolon to hello world program in intro. 2014-12-06 17:36:32 -06:00
Carol Nichols fc47dd9c0f Prepend should be append in the 30 minute intro
The examples are about adding to the end of the array, not the
beginning.
2014-11-07 14:59:42 -05:00
Rolf van de Krol 66b8cc8692 small fix to output of code sample in intro.md 2014-10-31 20:28:58 +01:00
Steve Klabnik 4a74af62c6 Improve code in the intro.
All these stars aren't needed anymore.
2014-10-23 09:36:34 -04:00
Neil Pankey 66939dfe64 [Docs] more intro typos 2014-10-18 17:40:57 -07:00
Neil Pankey e1389530cf [Docs] intro typo 2014-10-18 17:37:54 -07:00
Steve Klabnik 6c5bf9f2a4 Re-do the 30 minute intro
This was originally on my blog, so it's incredibly informal. Let's make
it better.
2014-10-03 11:22:44 -04:00