Commit Graph

26745 Commits

Author SHA1 Message Date
bors
6c41f993d3 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.
2014-02-25 23:31:35 -08:00
bors
eb86913dcf 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.
2014-02-25 19:21:32 -08:00
bors
2e1cfae943 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.
2014-02-25 17:41:32 -08:00
Alex Crichton
4f4d43bf6c 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.
2014-02-25 16:51:52 -08:00
bors
3b09469a62 auto merge of #12539 : gmjosack/rust/master, r=alexcrichton
std::condition was removed in 454882dcb7
but there are still links to the guide. Removing them.
2014-02-25 16:26:30 -08:00
bors
c24946e9c6 auto merge of #12493 : eddyb/rust/saner-overloads, r=nikomatsakis
Fixes #12402.
2014-02-25 13:01:42 -08:00
bors
fc1c06d7b1 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
2014-02-25 11:41:36 -08:00
bors
fd83b2be26 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
2014-02-25 10:26:37 -08:00
Alex Crichton
294b27d806 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.
2014-02-25 09:37:30 -08:00
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
Alex Crichton
1b3b273f80 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
2014-02-25 09:22:24 -08:00
Alex Crichton
9cc26cfdf4 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
2014-02-25 09:21:09 -08:00
bors
3276090253 auto merge of #12537 : kballard/rust/add-test-to-doc-index, r=alexcrichton 2014-02-25 09:11:39 -08:00
Eduard Burtescu
39504719b4 resolve: Don't use @RefCell in trait_map, nothing modifies its entries. 2014-02-25 19:08:55 +02:00
Eduard Burtescu
9d5532618f resolve: Remove all the operator overloads from trait_map. 2014-02-25 19:08:55 +02:00
Eduard Burtescu
d096eefd80 Use only the appropriate trait when looking up operator overloads. 2014-02-25 19:08:54 +02:00
Eduard Burtescu
818203e9d2 typeck: Remove old diagnostic that refers to do. 2014-02-25 19:08:54 +02:00
bors
34a224f4a1 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.
2014-02-25 07:56:35 -08:00
bors
25d68366b7 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.
2014-02-25 06:41:36 -08:00
bors
d222f03f42 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.
2014-02-25 05:26:36 -08:00
bors
27cc309a7f auto merge of #12473 : bjz/rust/remove-bool, r=alexcrichton
These were never used outside of the tests.
2014-02-25 02:16:39 -08:00
Gary M. Josack
7e85431775 Remove references to guide-conditions
std::condition was removed in 454882dcb7
but there are still links to the guide. Removing them.
2014-02-25 01:01:55 -08:00
Brendan Zabarauskas
6efa3c63d0 Remove std::bool::{Bool, all_values}
These were never used outside of the tests
2014-02-25 19:52:51 +11:00
Kevin Ballard
2003a5eb34 Add link to libtest in doc index 2014-02-24 23:11:23 -08:00
bors
4243cad56b 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
2014-02-24 22:17:02 -08:00
Alex Crichton
7d85546721 Test fixes from rollup 2014-02-24 22:11:43 -08:00
Flavio Percoco
35f2da4063 test: single-variant enum can't be dereferenced
Closes #9814
2014-02-24 21:22:27 -08:00
Jag Talon
7fc7c37763 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
2014-02-24 21:22:27 -08:00
George Papanikolaou
54abbda9b4 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.
2014-02-24 21:22:27 -08:00
Alex Crichton
a7b1d65080 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.
2014-02-24 21:22:27 -08:00
Edward Wang
4690ab0ea8 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.
2014-02-24 21:22:27 -08:00
Huon Wilson
6757053cff 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.
2014-02-24 21:22:27 -08:00
Björn Steinbrink
0309104cc5 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.
2014-02-24 21:22:26 -08:00
Huon Wilson
8812e8ad49 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
2014-02-24 21:22:26 -08:00
Huon Wilson
ff79a4471c 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.
2014-02-24 21:22:26 -08:00
Brendan Zabarauskas
dad52cfcb5 Remove std::num::ToStrRadix from the prelude 2014-02-24 21:22:26 -08:00
Brendan Zabarauskas
84a8893f19 Remove std::from_str::FromStr from the prelude 2014-02-24 21:22:26 -08:00
Brendan Zabarauskas
3cc95314c3 Remove std::default::Default from the prelude 2014-02-24 21:22:26 -08:00
Huon Wilson
ac64db94bf 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
2014-02-24 21:22:26 -08:00
Huon Wilson
16e635cdfb 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.
2014-02-24 21:22:26 -08:00
Florian Hahn
3ca01676bc 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
2014-02-24 21:22:26 -08:00
Alex Crichton
53b9484daf 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
2014-02-24 21:22:26 -08:00
Alex Crichton
8922fa0122 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
2014-02-24 21:22:25 -08:00
bors
043c972179 auto merge of #12454 : omasanori/rust/semver-eq, r=alexcrichton
Closes #12438
2014-02-24 20:07:01 -08:00
Erick Tryzelaar
6335a76b6e rustc: rename hash to the proper name state 2014-02-24 19:56:10 -08:00
Erick Tryzelaar
922eb47a20 test: Use #[deriving(Hash)] in a couple tests 2014-02-24 19:52:29 -08:00
Erick Tryzelaar
848cbb4e13 replace manual Hash impls with #[deriving(Hash)] 2014-02-24 19:52:29 -08:00
Erick Tryzelaar
f12ff1964b std: minor whitespace cleanup 2014-02-24 19:52:29 -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