]> git.lizzy.rs Git - rust.git/log
rust.git
10 years agoauto merge of #12547 : jagtalon/rust/jag/rust/tutorial-freezing, r=pnkfelix
bors [Wed, 26 Feb 2014 07:31:35 +0000 (23:31 -0800)]
auto merge of #12547 : jagtalon/rust/jag/rust/tutorial-freezing, r=pnkfelix

- "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.

10 years agoauto merge of #12505 : alexcrichton/rust/fix-stack-overflow, r=brson
bors [Wed, 26 Feb 2014 03:21:32 +0000 (19:21 -0800)]
auto merge of #12505 : alexcrichton/rust/fix-stack-overflow, r=brson

The printing of the error message on stack overflow had two sometimes false
assumptions previously. The first is that a local task was always available (it
called Local::take) and the second is that it used `println!` instead of
manually writing.

The first assumption isn't necessarily true because while stack overflow will
likely only be detected in situations that a local task is available, it's not
guaranteed to always be in TLS. For example, during a `println!` call a task
may be blocking, causing it to be unavailable. By using Local::try_take(), we
can be resilient against these occurrences.

The second assumption could lead to odd behavior because the stdout logger can
be overwritten to run arbitrary code. Currently this should be possible, but the
utility is much diminished because a stack overflow translates to an abort()
instead of a failure.

10 years agoauto merge of #12548 : alexcrichton/rust/up-llvm, r=huonw,brson
bors [Wed, 26 Feb 2014 01:41:32 +0000 (17:41 -0800)]
auto merge of #12548 : alexcrichton/rust/up-llvm, r=huonw,brson

Upstream LLVM has changed slightly such that our PassWrapper.cpp no longer
comiles (travis errors). This updates the bundled LLVM to the latest nightly
which will hopefully fix the travis errors we're seeing.

10 years agostd: Tweak stack overflow printing for robustness
Alex Crichton [Thu, 20 Feb 2014 05:01:50 +0000 (21:01 -0800)]
std: Tweak stack overflow printing for robustness

The printing of the error message on stack overflow had two sometimes false
assumptions previously. The first is that a local task was always available (it
called Local::take) and the second is that it used println! instead of
manually writing.

The first assumption isn't necessarily true because while stack overflow will
likely only be detected in situations that a local task is available, it's not
guaranteed to always be in TLS. For example, during a println! call a task
may be blocking, causing it to be unavailable. By using Local::try_take(), we
can be resilient against these occurrences.

The second assumption could lead to odd behavior because the stdout logger can
be overwritten to run arbitrary code. Currently this should be possible, but the
utility is much diminished because a stack overflow translates to an abort()
instead of a failure.

10 years agoauto merge of #12539 : gmjosack/rust/master, r=alexcrichton
bors [Wed, 26 Feb 2014 00:26:30 +0000 (16:26 -0800)]
auto merge of #12539 : gmjosack/rust/master, r=alexcrichton

std::condition was removed in 454882dcb7fdb03867d695a88335e2d2c8f7561a
but there are still links to the guide. Removing them.

10 years agoauto merge of #12493 : eddyb/rust/saner-overloads, r=nikomatsakis
bors [Tue, 25 Feb 2014 21:01:42 +0000 (13:01 -0800)]
auto merge of #12493 : eddyb/rust/saner-overloads, r=nikomatsakis

Fixes #12402.

10 years agoauto merge of #12457 : alexcrichton/rust/fix-some-tests, r=brson
bors [Tue, 25 Feb 2014 19:41:36 +0000 (11:41 -0800)]
auto merge of #12457 : alexcrichton/rust/fix-some-tests, r=brson

This updates a number of ignore-test tests, and removes a few completely
outdated tests due to the feature being tested no longer being supported.

This brings a number of bench/shootout tests up to date so they're compiling
again. I make no claims to the performance of these benchmarks, it's just nice
to not have bitrotted code.

Closes #2604
Closes #9407

10 years agoauto merge of #12408 : alexcrichton/rust/manual-crate-map, r=brson
bors [Tue, 25 Feb 2014 18:26:37 +0000 (10:26 -0800)]
auto merge of #12408 : alexcrichton/rust/manual-crate-map, r=brson

Apparently weak linkage and dlopen aren't quite working out for applications
like servo on android. There appears to be a bug or two in how android loads
dynamic libraries and for some reason libservo.so isn't being found.

As a temporary solution, add an extern "C" function to libstd which can be
called if you have a handle to the crate map manually. When crawling the crate
map, we then check this manual symbol before falling back to the old solutions.

cc #11731

10 years agoUpdate LLVM
Alex Crichton [Tue, 25 Feb 2014 17:26:11 +0000 (09:26 -0800)]
Update LLVM

Upstream LLVM has changed slightly such that our PassWrapper.cpp no longer
comiles (travis errors). This updates the bundled LLVM to the latest nightly
which will hopefully fix the travis errors we're seeing.

10 years agotutorial: clearer explanation of freezing.
Jag Talon [Tue, 25 Feb 2014 06:17:31 +0000 (01:17 -0500)]
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.

10 years agoAdd a method of manually specifying the crate map
Alex Crichton [Wed, 19 Feb 2014 23:39:25 +0000 (15:39 -0800)]
Add a method of manually specifying the crate map

Apparently weak linkage and dlopen aren't quite working out for applications
like servo on android. There appears to be a bug or two in how android loads
dynamic libraries and for some reason libservo.so isn't being found.

As a temporary solution, add an extern "C" function to libstd which can be
called if you have a handle to the crate map manually. When crawling the crate
map, we then check this manual symbol before falling back to the old solutions.

cc #11731

10 years agotest: Clean out the test suite a bit
Alex Crichton [Fri, 21 Feb 2014 23:41:51 +0000 (15:41 -0800)]
test: Clean out the test suite a bit

This updates a number of ignore-test tests, and removes a few completely
outdated tests due to the feature being tested no longer being supported.

This brings a number of bench/shootout tests up to date so they're compiling
again. I make no claims to the performance of these benchmarks, it's just nice
to not have bitrotted code.

Closes #2604
Closes #9407

10 years agoauto merge of #12537 : kballard/rust/add-test-to-doc-index, r=alexcrichton
bors [Tue, 25 Feb 2014 17:11:39 +0000 (09:11 -0800)]
auto merge of #12537 : kballard/rust/add-test-to-doc-index, r=alexcrichton

10 years agoresolve: Don't use @RefCell in trait_map, nothing modifies its entries.
Eduard Burtescu [Mon, 24 Feb 2014 08:36:24 +0000 (10:36 +0200)]
resolve: Don't use @RefCell in trait_map, nothing modifies its entries.

10 years agoresolve: Remove all the operator overloads from trait_map.
Eduard Burtescu [Mon, 24 Feb 2014 08:35:00 +0000 (10:35 +0200)]
resolve: Remove all the operator overloads from trait_map.

10 years agoUse only the appropriate trait when looking up operator overloads.
Eduard Burtescu [Mon, 24 Feb 2014 08:33:50 +0000 (10:33 +0200)]
Use only the appropriate trait when looking up operator overloads.

10 years agotypeck: Remove old diagnostic that refers to `do`.
Eduard Burtescu [Mon, 24 Feb 2014 08:31:16 +0000 (10:31 +0200)]
typeck: Remove old diagnostic that refers to `do`.

10 years agoauto merge of #12530 : alexcrichton/rust/make-check-no-rpath, r=brson
bors [Tue, 25 Feb 2014 15:56:35 +0000 (07:56 -0800)]
auto merge of #12530 : alexcrichton/rust/make-check-no-rpath, r=brson

This involves passing through LD_LIBRARY_PATH through more places, specifically
in the compiletest, run-make, and doctest runners.

10 years agoauto merge of #12522 : erickt/rust/hash, r=alexcrichton
bors [Tue, 25 Feb 2014 14:41:36 +0000 (06:41 -0800)]
auto merge of #12522 : erickt/rust/hash, r=alexcrichton

This patch series does a couple things:

* replaces manual `Hash` implementations with `#[deriving(Hash)]`
* adds `Hash` back to `std::prelude`
* minor cleanup of whitespace and variable names.

10 years agoauto merge of #12525 : eddyb/rust/gate-default-type-param-usage, r=alexcrichton
bors [Tue, 25 Feb 2014 13:26:36 +0000 (05:26 -0800)]
auto merge of #12525 : eddyb/rust/gate-default-type-param-usage, r=alexcrichton

Also reverted `#[deriving(Hash)]` to implement `Hash` only for `SipState`, until we decide what to do about default type params.

10 years agoauto merge of #12473 : bjz/rust/remove-bool, r=alexcrichton
bors [Tue, 25 Feb 2014 10:16:39 +0000 (02:16 -0800)]
auto merge of #12473 : bjz/rust/remove-bool, r=alexcrichton

These were never used outside of the tests.

10 years agoRemove references to guide-conditions
Gary M. Josack [Tue, 25 Feb 2014 09:01:55 +0000 (01:01 -0800)]
Remove references to guide-conditions

std::condition was removed in 454882dcb7fdb03867d695a88335e2d2c8f7561a
but there are still links to the guide. Removing them.

10 years agoRemove std::bool::{Bool, all_values}
Brendan Zabarauskas [Sat, 22 Feb 2014 19:41:38 +0000 (06:41 +1100)]
Remove std::bool::{Bool, all_values}

These were never used outside of the tests

10 years agoAdd link to libtest in doc index
Kevin Ballard [Tue, 25 Feb 2014 07:11:23 +0000 (23:11 -0800)]
Add link to libtest in doc index

10 years agoauto merge of #12535 : alexcrichton/rust/rollup, r=alexcrichton
bors [Tue, 25 Feb 2014 06:17:02 +0000 (22:17 -0800)]
auto merge of #12535 : alexcrichton/rust/rollup, r=alexcrichton

Closes #12474 (rustc: Don't error on the rlib symlinks) r=brson
Closes #12475 (Use lines_any() when parsing output form "ar") r=brson
Closes #12476 (Remove some obsolete ignored tests) r=alexcrichton
Closes #12481 (Make .swap_remove return Option<T>) r=brson
Closes #12485 (Remove some non-essential trait re-exports from the prelude.) r=brson
Closes #12489 (Handle multibyte characters in source files better) r=alexcrichton
Closes #12494 (Mark by-value parameters that are passed on the stack as nocapture) r=nmatsakis
Closes #12497 (syntax: allow stmt/expr macro invocations to be delimited by {}) r=alexcrichton
Closes #12508 (Match binding is assignment) r=nmatsakis
Closes #12513 (Run the travis build as one large command) r=huonw
Closes #12515 (Update source code layout in src/) r=alexcrichton
Closes #12521 (Tutorial: Add std::num::sqrt to the example) r=cmr
Closes #12529 (test: single-variant enum can't be dereferenced) r=huonw

10 years agoTest fixes from rollup
Alex Crichton [Tue, 25 Feb 2014 05:53:46 +0000 (21:53 -0800)]
Test fixes from rollup

10 years agotest: single-variant enum can't be dereferenced
Flavio Percoco [Tue, 25 Feb 2014 00:25:53 +0000 (01:25 +0100)]
test: single-variant enum can't be dereferenced

Closes #9814

10 years agoTutorial: Add std::num::sqrt to the example.
Jag Talon [Mon, 24 Feb 2014 13:36:23 +0000 (08:36 -0500)]
Tutorial: Add std::num::sqrt to the example.

We should be using the package std::num::sqrt instead of the sqrt function that was defined to return 0.0

10 years agoUpdate source code layout in src/
George Papanikolaou [Mon, 24 Feb 2014 11:41:12 +0000 (13:41 +0200)]
Update source code layout in src/

with the new modules that moved from extra,
and with other undocumented folders.
also add a note about potential changes.

10 years agoRun the travis build as one large command
Alex Crichton [Mon, 24 Feb 2014 07:23:08 +0000 (23:23 -0800)]
Run the travis build as one large command

It appears that travis doesn't stop running script commands after the first one
fails (see https://github.com/travis-ci/travis-ci/issues/1066), so chain all our
commands together with && for now.

10 years agoMatch binding is assignment
Edward Wang [Sun, 23 Feb 2014 23:02:27 +0000 (07:02 +0800)]
Match binding is assignment

In its first pass, namely gather_loans, the borrow checker tracks the
initialization sites among other things it does. It does so for let
bindings with initializers but not for bindings in match arms, which are
effectively also assignments. This patch does that for borrow checker.

Closes #12452.

10 years agosyntax: allow stmt/expr macro invocations to be delimited by {}.
Huon Wilson [Sun, 23 Feb 2014 13:53:59 +0000 (00:53 +1100)]
syntax: allow stmt/expr macro invocations to be delimited by {}.

This makes using control-flow-y macros like `spawn! { ... }` more fluent
and natural.

cc #11892.

10 years agoMark by-value parameters that are passed on the stack as nocapture
Björn Steinbrink [Sun, 23 Feb 2014 11:25:11 +0000 (12:25 +0100)]
Mark by-value parameters that are passed on the stack as nocapture

The by-value argument is a copy that is only valid for the duration of
the function call, therefore keeping any pointer to it that outlives the
call is illegal.

10 years agosyntax: calculate positions of multibyte characters more correctly.
Huon Wilson [Sun, 23 Feb 2014 06:08:46 +0000 (17:08 +1100)]
syntax: calculate positions of multibyte characters more correctly.

They are still are not completely correct, since it does not handle
graphemes at all, just codepoints, but at least it handles the common
case correctly.

The calculation was previously very wrong (rather than just a little bit
wrong): it wasn't accounting for the fact that every character is 1
byte, and so multibyte characters were pretending to be zero width.

cc #8706

10 years agosyntax: record multibyte chars' positions absolutely, not relative to
Huon Wilson [Sun, 23 Feb 2014 05:40:04 +0000 (16:40 +1100)]
syntax: record multibyte chars' positions absolutely, not relative to
file.

Previously multibyte UTF-8 chars were being recorded as byte offsets
from the start of the file, and then later compared against global byte
positions, resulting in the compiler possibly thinking it had a byte
position pointing inside a multibyte character, if there were multibyte
characters in any non-crate files. (Although, sometimes the byte offsets
line up just right to not ICE, but that was a coincidence.)

Fixes #11136.
Fixes #11178.

10 years agoRemove std::num::ToStrRadix from the prelude
Brendan Zabarauskas [Sun, 23 Feb 2014 01:41:43 +0000 (12:41 +1100)]
Remove std::num::ToStrRadix from the prelude

10 years agoRemove std::from_str::FromStr from the prelude
Brendan Zabarauskas [Sun, 23 Feb 2014 01:29:42 +0000 (12:29 +1100)]
Remove std::from_str::FromStr from the prelude

10 years agoRemove std::default::Default from the prelude
Brendan Zabarauskas [Sun, 23 Feb 2014 01:07:11 +0000 (12:07 +1100)]
Remove std::default::Default from the prelude

10 years agostd: Add Vec.reserve for rounding-up reservation.
Huon Wilson [Sat, 22 Feb 2014 23:59:23 +0000 (10:59 +1100)]
std: Add Vec.reserve for rounding-up reservation.

`.reserve_exact` can cause pathological O(n^2) behaviour, so providing a
`.reserve` that ensures that capacity doubles (if you step 1, 2, ..., n)
is more efficient.

cc #11949

10 years agostd: make .swap_remove return Option<T>.
Huon Wilson [Sat, 22 Feb 2014 23:56:38 +0000 (10:56 +1100)]
std: make .swap_remove return Option<T>.

This is one of the last raw "indexing" method on vectors that returns
`T` instead of the Option.

10 years agoRemove some obsolete ignored tests
Florian Hahn [Sat, 22 Feb 2014 19:37:52 +0000 (20:37 +0100)]
Remove some obsolete ignored tests

* compile-fail/vec-add.rs is obsolete, there are no mutable
  vectors any more, #2711 is closed
* compile-fail/issue-1451.rs is obsolete, there are no more
  structural records, #1451 is closed
* compile-fail/issue-2074.rs is obsolete, an up to date test
  is in run-pass/nested-enum-same-names.rs, #2074 is closed
* compile-fail/omitted-arg-wrong-types.rs is obsolete, #2093
  is closed

10 years agoUse lines_any() when parsing output form "ar"
Alex Crichton [Sat, 22 Feb 2014 19:46:06 +0000 (11:46 -0800)]
Use lines_any() when parsing output form "ar"

On windows lines are delimited with \r\n while on unix they're delimited with
\n.

cc #12471

10 years agorustc: Don't error on the rlib symlinks
Alex Crichton [Sat, 22 Feb 2014 18:45:44 +0000 (10:45 -0800)]
rustc: Don't error on the rlib symlinks

This commit implements a layman's version of realpath() for metadata::loader to
use in order to not error on symlinks pointing to the same file.

Closes #12459

10 years agoauto merge of #12454 : omasanori/rust/semver-eq, r=alexcrichton
bors [Tue, 25 Feb 2014 04:07:01 +0000 (20:07 -0800)]
auto merge of #12454 : omasanori/rust/semver-eq, r=alexcrichton

Closes #12438

10 years agorustc: rename `hash` to the proper name `state`
Erick Tryzelaar [Mon, 24 Feb 2014 03:24:27 +0000 (19:24 -0800)]
rustc: rename `hash` to the proper name `state`

10 years agotest: Use `#[deriving(Hash)]` in a couple tests
Erick Tryzelaar [Mon, 24 Feb 2014 03:11:19 +0000 (19:11 -0800)]
test: Use `#[deriving(Hash)]` in a couple tests

10 years agoreplace manual Hash impls with `#[deriving(Hash)]`
Erick Tryzelaar [Mon, 24 Feb 2014 02:50:47 +0000 (18:50 -0800)]
replace manual Hash impls with `#[deriving(Hash)]`

10 years agostd: minor whitespace cleanup
Erick Tryzelaar [Mon, 24 Feb 2014 01:45:44 +0000 (17:45 -0800)]
std: minor whitespace cleanup

10 years agoExclude build metadata from equality checking.
OGINO Masanori [Fri, 21 Feb 2014 22:34:56 +0000 (07:34 +0900)]
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>
10 years agoauto merge of #12465 : huonw/rust/notidy, r=brson
bors [Tue, 25 Feb 2014 01:51:59 +0000 (17:51 -0800)]
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.

10 years agoauto merge of #12453 : alexcrichton/rust/move-json, r=brson
bors [Mon, 24 Feb 2014 23:57:13 +0000 (15:57 -0800)]
auto merge of #12453 : alexcrichton/rust/move-json, r=brson

This also inverts the dependency between libserialize and libcollections.

cc #8784

10 years agoauto merge of #12445 : huonw/rust/less-unsafe, r=alexcrichton
bors [Mon, 24 Feb 2014 22:37:01 +0000 (14:37 -0800)]
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.)

10 years agoGate default type parameter overrides.
Eduard Burtescu [Mon, 24 Feb 2014 20:45:31 +0000 (22:45 +0200)]
Gate default type parameter overrides.
Fixes #12423.

10 years agoauto merge of #12523 : alexcrichton/rust/ignore-some-windows-tests, r=pnkfelix
bors [Mon, 24 Feb 2014 20:42:02 +0000 (12:42 -0800)]
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

10 years agowindows: Fix the test_exists unit test
Alex Crichton [Mon, 24 Feb 2014 18:59:11 +0000 (10:59 -0800)]
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

10 years agoCorrectly ignore some tests on windows
Alex Crichton [Mon, 24 Feb 2014 17:15:05 +0000 (09:15 -0800)]
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

10 years agoMove extra::json to libserialize
Alex Crichton [Fri, 21 Feb 2014 22:18:39 +0000 (14:18 -0800)]
Move extra::json to libserialize

This also inverts the dependency between libserialize and libcollections.

cc #8784

10 years agoauto merge of #12412 : alexcrichton/rust/deriving-show, r=huonw
bors [Mon, 24 Feb 2014 12:11:53 +0000 (04:11 -0800)]
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

10 years agoRemove deriving(ToStr)
Alex Crichton [Thu, 20 Feb 2014 03:18:33 +0000 (19:18 -0800)]
Remove deriving(ToStr)

This has been superseded by deriving(Show).

cc #9806

10 years agoauto merge of #12380 : alexcrichton/rust/run-rewrite, r=brson
bors [Mon, 24 Feb 2014 06:06:50 +0000 (22:06 -0800)]
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

10 years agoRoll std::run into std::io::process
Alex Crichton [Tue, 18 Feb 2014 20:04:51 +0000 (12:04 -0800)]
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

10 years agoRemove all ToStr impls, add Show impls
Alex Crichton [Thu, 20 Feb 2014 02:56:33 +0000 (18:56 -0800)]
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

10 years agoauto merge of #12328 : nick29581/rust/abi, r=alexcrichton
bors [Mon, 24 Feb 2014 03:26:53 +0000 (19:26 -0800)]
auto merge of #12328 : nick29581/rust/abi, r=alexcrichton

10 years agoauto merge of #12510 : huonw/rust/fix-compiler-docs, r=alexcrichton
bors [Mon, 24 Feb 2014 02:06:54 +0000 (18:06 -0800)]
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..

10 years agoUpdate rustc/syntax docs now that rustdoc lexes all non-`notrust` code blocks.
Huon Wilson [Mon, 24 Feb 2014 01:29:45 +0000 (12:29 +1100)]
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..

10 years agoauto merge of #12509 : brson/rust/rollup, r=brson
bors [Mon, 24 Feb 2014 00:52:04 +0000 (16:52 -0800)]
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.

10 years agoAll uses of `extern fn` should mean `extern "C" fn`. Closes #9309.
Nick Cameron [Fri, 14 Feb 2014 04:23:01 +0000 (17:23 +1300)]
All uses of `extern fn` should mean `extern "C" fn`. Closes #9309.

10 years agoMerge remote-tracking branch 'huonw/inline-helpers'
Brian Anderson [Sun, 23 Feb 2014 23:44:20 +0000 (15:44 -0800)]
Merge remote-tracking branch 'huonw/inline-helpers'

10 years agoMerge remote-tracking branch 'brson/ratcher'
Brian Anderson [Sun, 23 Feb 2014 23:43:28 +0000 (15:43 -0800)]
Merge remote-tracking branch 'brson/ratcher'

10 years agoMerge remote-tracking branch 'brson/iodoc'
Brian Anderson [Sun, 23 Feb 2014 23:43:23 +0000 (15:43 -0800)]
Merge remote-tracking branch 'brson/iodoc'

10 years agoMerge remote-tracking branch 'tbu/pr_doc_smallfix'
Brian Anderson [Sun, 23 Feb 2014 23:37:52 +0000 (15:37 -0800)]
Merge remote-tracking branch 'tbu/pr_doc_smallfix'

10 years agoMerge remote-tracking branch 'kud1ing/patch-1'
Brian Anderson [Sun, 23 Feb 2014 23:37:13 +0000 (15:37 -0800)]
Merge remote-tracking branch 'kud1ing/patch-1'

10 years agoauto merge of #12338 : edwardw/rust/hygienic-break-continue, r=cmr
bors [Sun, 23 Feb 2014 23:37:05 +0000 (15:37 -0800)]
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.

10 years agoauto merge of #12484 : TheHydroImpulse/rust/fix_js, r=huonw
bors [Sun, 23 Feb 2014 22:22:04 +0000 (14:22 -0800)]
auto merge of #12484 : TheHydroImpulse/rust/fix_js, r=huonw

10 years agoTutorial: fix typo
kud1ing [Sun, 23 Feb 2014 21:23:10 +0000 (22:23 +0100)]
Tutorial: fix typo

10 years agoauto merge of #12492 : huonw/rust/snapshots, r=alexcrichton
bors [Sun, 23 Feb 2014 21:07:01 +0000 (13:07 -0800)]
auto merge of #12492 : huonw/rust/snapshots, r=alexcrichton

Replaces IterBytes with the new Hash, removing all trace of the old implementation.

10 years agoTransition to new `Hash`, removing IterBytes and std::to_bytes.
Huon Wilson [Sun, 23 Feb 2014 10:29:35 +0000 (21:29 +1100)]
Transition to new `Hash`, removing IterBytes and std::to_bytes.

10 years agoFix C function FFI example in the Rust cheatsheet
Tobias Bucher [Sun, 23 Feb 2014 18:52:33 +0000 (19:52 +0100)]
Fix C function FFI example in the Rust cheatsheet

10 years agoarena,std,serialize: remove some unnecessary transmutes.
Huon Wilson [Fri, 21 Feb 2014 12:56:09 +0000 (23:56 +1100)]
arena,std,serialize: remove some unnecessary transmutes.

`as`-able transmutes, duplication and manual slice decomposition are
silly.

10 years agonative: be more const correct with the FFI calls.
Huon Wilson [Fri, 21 Feb 2014 12:22:51 +0000 (23:22 +1100)]
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.

10 years agogreen,native,rustuv: Replace many pointer `transmute`'s with `as` or referencing.
Huon Wilson [Fri, 21 Feb 2014 11:40:53 +0000 (22:40 +1100)]
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.

10 years agoflate: return CVec<u8> rather than copying into a new vector.
Huon Wilson [Fri, 21 Feb 2014 08:28:44 +0000 (19:28 +1100)]
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.

10 years agogreen: remove ancient register-saving code.
Huon Wilson [Fri, 21 Feb 2014 11:22:35 +0000 (22:22 +1100)]
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).

10 years agoMake break and continue hygienic
Edward Wang [Sat, 15 Feb 2014 08:54:32 +0000 (16:54 +0800)]
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.

10 years agoRegister snapshots.
Huon Wilson [Sun, 23 Feb 2014 07:30:05 +0000 (18:30 +1100)]
Register snapshots.

10 years agoauto merge of #12416 : alexcrichton/rust/highlight, r=huonw
bors [Sun, 23 Feb 2014 11:36:56 +0000 (03:36 -0800)]
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

10 years agoauto merge of #12311 : brson/rust/unstable, r=alexcrichton
bors [Sun, 23 Feb 2014 10:21:53 +0000 (02:21 -0800)]
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]`).

10 years agostd: Move unstable::stack to rt::stack
Brian Anderson [Mon, 17 Feb 2014 05:37:12 +0000 (21:37 -0800)]
std: Move unstable::stack to rt::stack

10 years agostd: Remove unstable::lang
Brian Anderson [Mon, 17 Feb 2014 04:16:23 +0000 (20:16 -0800)]
std: Remove unstable::lang

Put the lonely lang items here closer to the code they are calling.

10 years agostd: Move raw to std::raw
Brian Anderson [Sun, 16 Feb 2014 08:04:33 +0000 (00:04 -0800)]
std: Move raw to std::raw

Issue #1457

10 years agostd: Move intrinsics to std::intrinsics.
Brian Anderson [Sun, 16 Feb 2014 07:49:08 +0000 (23:49 -0800)]
std: Move intrinsics to std::intrinsics.

Issue #1457

10 years agoauto merge of #12428 : alexcrichton/rust/move-hashmap, r=brson
bors [Sun, 23 Feb 2014 09:06:57 +0000 (01:06 -0800)]
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.

10 years agoMove std::{trie, hashmap} to libcollections
Alex Crichton [Thu, 20 Feb 2014 03:29:58 +0000 (19:29 -0800)]
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.

10 years agorustdoc: Add syntax highlighting
Alex Crichton [Thu, 20 Feb 2014 09:14:51 +0000 (01:14 -0800)]
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

10 years agostd: Remove some nonsense from old std::io docs
Brian Anderson [Sat, 22 Feb 2014 23:53:54 +0000 (15:53 -0800)]
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.

10 years agoauto merge of #12451 : edwardw/rust/ident-2-name, r=cmr
bors [Sun, 23 Feb 2014 06:01:54 +0000 (22:01 -0800)]
auto merge of #12451 : edwardw/rust/ident-2-name, r=cmr

Closes #7743.

10 years agoauto merge of #12450 : FlaPer87/rust/issue-10682, r=alexcrichton
bors [Sun, 23 Feb 2014 04:21:54 +0000 (20:21 -0800)]
auto merge of #12450 : FlaPer87/rust/issue-10682, r=alexcrichton

Fixes #10682

10 years agoauto merge of #12444 : thestinger/rust/arena, r=huonw
bors [Sun, 23 Feb 2014 03:06:52 +0000 (19:06 -0800)]
auto merge of #12444 : thestinger/rust/arena, r=huonw

This prevents generating visit glue when using a TypedArena. The problem
still exists for the untyped Arena.

10 years agoauto merge of #12448 : alexcrichton/rust/smaller-rust, r=brson
bors [Sun, 23 Feb 2014 01:46:53 +0000 (17:46 -0800)]
auto merge of #12448 : alexcrichton/rust/smaller-rust, r=brson

Two optimizations:

1. Compress `foo.bc` in each rlib with `flate`. These are just taking up space and are only used with LTO, no need for LTO to be speedy.
2. Stop install `librustc.rlib` and friends, this is a *huge* source of bloat. There's no need for us to install static libraries for these components.

cc #12440

10 years agoFixed invalid JavaScript
Daniel Fagnan [Sun, 23 Feb 2014 01:08:17 +0000 (18:08 -0700)]
Fixed invalid JavaScript

Signed-off-by: Daniel Fagnan <dnfagnan@gmail.com>