Commit Graph

26697 Commits

Author SHA1 Message Date
Jag Talon
82747ed93e tutorial: clearer explanation of freezing.
- "Lending an immutable pointer" might be confusing. It was not discussed why borrowed pointers are immutable in the first place.
- Make it clear that the borrowed pointers are immutable even if the variable was declared with `mut`.
- Make it clear that we cannot even assign anything to the variable while its value is being borrowed.

tutorial: change "--" to an em-dash.

tutorial: change instances of "--" to em-dash.
2014-02-25 12:32:09 -05:00
bors
043c972179 auto merge of #12454 : omasanori/rust/semver-eq, r=alexcrichton
Closes #12438
2014-02-24 20:07:01 -08:00
OGINO Masanori
b0a495f0ae Exclude build metadata from equality checking.
Build metadata is already excluded from precedence checking in line with
the spec. For consistency and providing strict total ordering for
Version, build metadata should also be ignored in Eq impl.

Closes #12438

Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
2014-02-25 11:37:38 +09:00
bors
4bc7672335 auto merge of #12465 : huonw/rust/notidy, r=brson
tidy has some limitations (e.g. the "checked in binaries" check doesn't
and can't actually check git), and so it's useful to run tests without
running tidy occasionally.
2014-02-24 17:51:59 -08:00
bors
994b48cf52 auto merge of #12453 : alexcrichton/rust/move-json, r=brson
This also inverts the dependency between libserialize and libcollections.

cc #8784
2014-02-24 15:57:13 -08:00
bors
b48bc9ec93 auto merge of #12445 : huonw/rust/less-unsafe, r=alexcrichton
Commits for details. Highlights:

- `flate` returns `CVec<u8>` to save reallocating a whole new `&[u8]`
- a lot of `transmute`s removed outright or replaced with `as` (etc.)
2014-02-24 14:37:01 -08:00
bors
68a4f7d9ba auto merge of #12523 : alexcrichton/rust/ignore-some-windows-tests, r=pnkfelix
These two tests are notoriously flaky on the windows bots right now, so I'm
ignoring them until I can investigate them some more. The truncate_works test
has been flaky for quite some time, but it has gotten much worse recently. The
test_exists test has been flaky since the recent std::run rewrite landed.
Finally, the "unix pipe" test failure is a recent discovery on the try bots. I
haven't seen this failing much, but better safe than sorry!

cc #12516
2014-02-24 12:42:02 -08:00
Alex Crichton
13a8fcd3e9 windows: Fix the test_exists unit test
Turns out the `timeout` command was exiting immediately because it didn't like
its output piped. Instead use `ping` repeatedly to get a process that will sleep
for awhile.

cc #12516
2014-02-24 12:33:06 -08:00
Alex Crichton
c0e767b00b Correctly ignore some tests on windows
These two tests are notoriously flaky on the windows bots right now, so I'm
ignoring them until I can investigate them some more. The truncate_works test
has been flaky for quite some time, but it has gotten much worse recently. The
test_exists test has been flaky since the recent std::run rewrite landed.
Finally, the "unix pipe" test failure is a recent discovery on the try bots. I
haven't seen this failing much, but better safe than sorry!

cc #12516
2014-02-24 12:33:06 -08:00
Alex Crichton
6485917d7c Move extra::json to libserialize
This also inverts the dependency between libserialize and libcollections.

cc #8784
2014-02-24 09:51:39 -08:00
bors
672097753a auto merge of #12412 : alexcrichton/rust/deriving-show, r=huonw
This commit removes deriving(ToStr) in favor of deriving(Show), migrating all impls of ToStr to fmt::Show.

Most of the details can be found in the first commit message.

Closes #12477
2014-02-24 04:11:53 -08:00
Alex Crichton
8761f79485 Remove deriving(ToStr)
This has been superseded by deriving(Show).

cc #9806
2014-02-24 00:15:17 -08:00
bors
a5342d5970 auto merge of #12380 : alexcrichton/rust/run-rewrite, r=brson
The std::run module is a relic from a standard library long since past, and
there's not much use to having two modules to execute processes with where one
is slightly more convenient. This commit merges the two modules, moving lots of
functionality from std::run into std::io::process and then deleting
std::run.

New things you can find in std::io::process are:

* Process::new() now only takes prog/args
* Process::configure() takes a ProcessConfig
* Process::status() is the same as run::process_status
* Process::output() is the same as run::process_output
* I/O for spawned tasks is now defaulted to captured in pipes instead of ignored
* Process::kill() was added (plus an associated green/native implementation)
* Process::wait_with_output() is the same as the old finish_with_output()
* destroy() is now signal_exit()
* force_destroy() is now signal_kill()

Closes #2625
Closes #10016
2014-02-23 22:06:50 -08:00
Alex Crichton
a9bd447400 Roll std::run into std::io::process
The std::run module is a relic from a standard library long since past, and
there's not much use to having two modules to execute processes with where one
is slightly more convenient. This commit merges the two modules, moving lots of
functionality from std::run into std::io::process and then deleting
std::run.

New things you can find in std::io::process are:

* Process::new() now only takes prog/args
* Process::configure() takes a ProcessConfig
* Process::status() is the same as run::process_status
* Process::output() is the same as run::process_output
* I/O for spawned tasks is now defaulted to captured in pipes instead of ignored
* Process::kill() was added (plus an associated green/native implementation)
* Process::wait_with_output() is the same as the old finish_with_output()
* destroy() is now signal_exit()
* force_destroy() is now signal_kill()

Closes #2625
Closes #10016
2014-02-23 21:51:17 -08:00
Alex Crichton
b78b749810 Remove all ToStr impls, add Show impls
This commit changes the ToStr trait to:

    impl<T: fmt::Show> ToStr for T {
        fn to_str(&self) -> ~str { format!("{}", *self) }
    }

The ToStr trait has been on the chopping block for quite awhile now, and this is
the final nail in its coffin. The trait and the corresponding method are not
being removed as part of this commit, but rather any implementations of the
`ToStr` trait are being forbidden because of the generic impl. The new way to
get the `to_str()` method to work is to implement `fmt::Show`.

Formatting into a `&mut Writer` (as `format!` does) is much more efficient than
`ToStr` when building up large strings. The `ToStr` trait forces many
intermediate allocations to be made while the `fmt::Show` trait allows
incremental buildup in the same heap allocated buffer. Additionally, the
`fmt::Show` trait is much more extensible in terms of interoperation with other
`Writer` instances and in more situations. By design the `ToStr` trait requires
at least one allocation whereas the `fmt::Show` trait does not require any
allocations.

Closes #8242
Closes #9806
2014-02-23 20:51:56 -08:00
bors
3c2650b4d5 auto merge of #12328 : nick29581/rust/abi, r=alexcrichton 2014-02-23 19:26:53 -08:00
bors
7cc6b5e0a3 auto merge of #12510 : huonw/rust/fix-compiler-docs, r=alexcrichton
This includes blocks made by indentation, so they need to be changed to
explicitly have ```notrust ... ``` fences..
2014-02-23 18:06:54 -08:00
Huon Wilson
b48833d6db Update rustc/syntax docs now that rustdoc lexes all non-notrust code blocks.
This includes blocks made by indentation, so they need to be changed to
explicitly have ```notrust ... ``` fences..
2014-02-24 12:35:57 +11:00
bors
76b262f693 auto merge of #12509 : brson/rust/rollup, r=brson
Rollup of https://github.com/mozilla/rust/pull/12506, https://github.com/mozilla/rust/pull/12500, https://github.com/mozilla/rust/pull/12480, https://github.com/mozilla/rust/pull/12478, https://github.com/mozilla/rust/pull/12461.
2014-02-23 16:52:04 -08:00
Nick Cameron
317a253b22 All uses of extern fn should mean extern "C" fn. Closes #9309. 2014-02-24 13:24:57 +13:00
Brian Anderson
d08952cfa5 Merge remote-tracking branch 'huonw/inline-helpers' 2014-02-23 15:44:20 -08:00
Brian Anderson
eb33955741 Merge remote-tracking branch 'brson/ratcher' 2014-02-23 15:43:28 -08:00
Brian Anderson
e034a43a8b Merge remote-tracking branch 'brson/iodoc' 2014-02-23 15:43:23 -08:00
Brian Anderson
feac422dd4 Merge remote-tracking branch 'tbu/pr_doc_smallfix' 2014-02-23 15:37:52 -08:00
Brian Anderson
0368886dbf Merge remote-tracking branch 'kud1ing/patch-1' 2014-02-23 15:37:13 -08:00
bors
329fcd48e5 auto merge of #12338 : edwardw/rust/hygienic-break-continue, r=cmr
Makes labelled loops hygiene by performing renaming of the labels defined in e.g. `'x: loop { ... }` and then used in break and continue statements within loop body so that they act hygienically when used with macros.
    
Closes #12262.
2014-02-23 15:37:05 -08:00
bors
cbed3321f5 auto merge of #12484 : TheHydroImpulse/rust/fix_js, r=huonw 2014-02-23 14:22:04 -08:00
kud1ing
778d032364 Tutorial: fix typo 2014-02-23 22:23:10 +01:00
bors
ba037475ee auto merge of #12492 : huonw/rust/snapshots, r=alexcrichton
Replaces IterBytes with the new Hash, removing all trace of the old implementation.
2014-02-23 13:07:01 -08:00
Huon Wilson
efaf4db24c Transition to new Hash, removing IterBytes and std::to_bytes. 2014-02-24 07:44:10 +11:00
Tobias Bucher
e9bb571aff Fix C function FFI example in the Rust cheatsheet 2014-02-23 20:55:02 +01:00
Huon Wilson
9e8d5aa29e arena,std,serialize: remove some unnecessary transmutes.
`as`-able transmutes, duplication and manual slice decomposition are
silly.
2014-02-24 01:15:39 +11:00
Huon Wilson
4cc723dc22 native: be more const correct with the FFI calls.
These calls are mutating their argument and so it's bad behaviour to be
pretending that the values are immutable to rustc.
2014-02-24 01:15:39 +11:00
Huon Wilson
8b246fda78 green,native,rustuv: Replace many pointer transmute's with as or referencing.
These can all be written in a more controlled manner than with the
transmute hammer, leading to (hopefully) safer code.
2014-02-24 01:15:39 +11:00
Huon Wilson
06e3e63c90 flate: return CVec<u8> rather than copying into a new vector.
This trades an O(n) allocation + memcpy for a O(1) proc allocation (for
the destructor). Most users only need &[u8] anyway (all of the users in
the main repo), and so this offers large gains.
2014-02-24 01:15:39 +11:00
Huon Wilson
768b96e8b1 green: remove ancient register-saving code.
@alexcrichton said he thought this was useless (and it's old logic: it's
been there since before the runtime was written into Rust).
2014-02-24 00:57:35 +11:00
Edward Wang
386db05df8 Make break and continue hygienic
Makes labelled loops hygiene by performing renaming of the labels
defined in e.g. `'x: loop { ... }` and then used in break and continue
statements within loop body so that they act hygienically when used with
macros.

Closes #12262.
2014-02-23 21:20:37 +08:00
Huon Wilson
5444da54fd Register snapshots. 2014-02-23 22:50:17 +11:00
bors
8786405047 auto merge of #12416 : alexcrichton/rust/highlight, r=huonw
This adds simple syntax highlighting based off libsyntax's lexer to be sure to
stay up to date with rust's grammar. Some of the highlighting is a bit ad-hoc,
but it definitely seems to get the job done!

This currently doesn't highlight rustdoc-rendered function signatures and
structs that are emitted to each page because the colors already signify what's
clickable and I think we'd have to figure out a different scheme before
colorizing them. This does, however, colorize all code examples and source code.

Closes #11393
2014-02-23 03:36:56 -08:00
bors
551da06157 auto merge of #12311 : brson/rust/unstable, r=alexcrichton
With the stability attributes we can put public-but unstable modules next to others, so this moves `intrinsics` and `raw` out of the `unstable` module (and marks both as `#[experimental]`).
2014-02-23 02:21:53 -08:00
Brian Anderson
db111846b5 std: Move unstable::stack to rt::stack 2014-02-23 01:47:08 -08:00
Brian Anderson
96b299e1f0 std: Remove unstable::lang
Put the lonely lang items here closer to the code they are calling.
2014-02-23 01:47:05 -08:00
Brian Anderson
3e57808a01 std: Move raw to std::raw
Issue #1457
2014-02-23 01:07:53 -08:00
Brian Anderson
4d10bdc5b9 std: Move intrinsics to std::intrinsics.
Issue #1457
2014-02-23 01:07:53 -08:00
bors
c250c16f81 auto merge of #12428 : alexcrichton/rust/move-hashmap, r=brson
These two containers are indeed collections, so there place is in
libcollections, not in libstd. There will always be a hash map as part of the
standard distribution of Rust, but by moving it out of the standard library it
makes libstd that much more portable to more platforms and environments.

This conveniently also removes the stuttering of 'std::hashmap::HashMap',
although 'collections::HashMap' is only one character shorter.
2014-02-23 01:06:57 -08:00
Alex Crichton
2a14e084cf Move std::{trie, hashmap} to libcollections
These two containers are indeed collections, so their place is in
libcollections, not in libstd. There will always be a hash map as part of the
standard distribution of Rust, but by moving it out of the standard library it
makes libstd that much more portable to more platforms and environments.

This conveniently also removes the stuttering of 'std::hashmap::HashMap',
although 'collections::HashMap' is only one character shorter.
2014-02-23 00:35:11 -08:00
Alex Crichton
ad9e26dab3 rustdoc: Add syntax highlighting
This adds simple syntax highlighting based off libsyntax's lexer to be sure to
stay up to date with rust's grammar. Some of the highlighting is a bit ad-hoc,
but it definitely seems to get the job done!

This currently doesn't highlight rustdoc-rendered function signatures and
structs that are emitted to each page because the colors already signify what's
clickable and I think we'd have to figure out a different scheme before
colorizing them. This does, however, colorize all code examples and source code.

Closes #11393
2014-02-23 00:16:23 -08:00
Brian Anderson
a8941c3e04 std: Remove some nonsense from old std::io docs
Most of this stuff is irrelevant implementation notes from last year.
This trims out the stuff that isn't appropriate for user-facing docs.
2014-02-22 23:05:11 -08:00
bors
edf351e9f7 auto merge of #12451 : edwardw/rust/ident-2-name, r=cmr
Closes #7743.
2014-02-22 22:01:54 -08:00
bors
9b9e2f80d5 auto merge of #12450 : FlaPer87/rust/issue-10682, r=alexcrichton
Fixes #10682
2014-02-22 20:21:54 -08:00