Commit Graph

40827 Commits

Author SHA1 Message Date
Manish Goregaokar
9eb0bab9de Rollup merge of #23867 - nikomatsakis:issue-23086-take-3, r=pnkfelix
This PR implements rust-lang/rfcs#1023. In the process it fixes #23086 and #23516. A few impls in libcore had to be updated, but the impact is generally pretty minimal. Most of the fallout is in the tests that probed the limits of today's coherence.

I tested and we were able to build the most popular crates along with iron (modulo errors around errors being sendable).

Fixes #23918.
2015-04-02 00:40:38 +05:30
Manish Goregaokar
abd747cd15 Rollup merge of #23847 - bcoopers:read_clarification, r=sfackler
This introduces no functional changes except for reducing a few unnecessary operations and variables.  Vec has the behavior that, if you request space past the capacity with reserve(), it will round up to the nearest power of 2.  What that effectively means is that after the first call to reserve(16), we are doubling our capacity every time.  So using the DEFAULT_BUF_SIZE and doubling cap_size() here is meaningless and has no effect on the call to reserve().

Note that with #23842 implemented this will hopefully have a clearer API and less of a need for commenting.  If #23842 is not implemented then the most clear implementation would be to call reserve_exact(buf.capacity()) at every step (and making sure that buf.capacity() is not zero at the beginning of the function of course).

Edit- functional change now introduced.  We will now zero 16 bytes of the vector first, then double to 32, then 64, etc. until we read 64kB.  This stops us from zeroing the entire vector when we double it, some of which may be wasted work.  Reallocation still follows the doubling strategy, but the responsibility has been moved to vec.extend(), which calls reserve() and push_back().
2015-04-02 00:40:38 +05:30
Manish Goregaokar
1d17e6eb1e Rollup merge of #23844 - kvark:try_unique, r=alexcrichton
While trying to implement parallel ECS processing, I stumbled upon the need to mutate `Arc` contents. The only existed method that allowed that was `make_unique`, but it has issues:
  - it may clone the data as if nothing happened, where the program may just need to crash
  - it forces `Clone` bound, which I don't have

The new `try_unique` allows accessing the contents mutably without `Clone` bound and error out if the pointer is not unique.
2015-04-02 00:40:38 +05:30
Manish Goregaokar
02b38a2497 Rollup merge of #23066 - michaelwoerister:unreachable-if, r=pnkfelix
This PR solves #21559 by making sure that unreachable if-expressions are not further translated.

Could someone who knows their way around `trans` take a look at the changes in `controlflow.rs`? I'm not sure if any other code relies on any side-effects of translating unreachable things.

cc @nikomatsakis @nrc @eddyb
2015-04-02 00:40:38 +05:30
Niko Matsakis
cade32acf6 Remove Thunk struct and Invoke trait; change Thunk to be an alias
for `Box<FnBox()>`. I found the alias was still handy because it is
shorter than the fully written type.

This is a [breaking-change]: convert code using `Invoke` to use `FnBox`,
which is usually pretty straight-forward. Code using thunk mostly works
if you change `Thunk::new => Box::new` and `foo.invoke(arg)` to
`foo(arg)`.
2015-04-01 14:41:21 -04:00
Niko Matsakis
ed63d32651 Add (unstable) FnBox trait as a nicer replacement for Thunk. The doc
comment includes a test that also shows how it can be used.
2015-04-01 14:40:44 -04:00
Richo Healey
85c74c6305 cleanup: Test formatting 2015-04-01 11:04:09 -07:00
Richo Healey
a01138cb4f std: Unignore a test for #10663
This issue is long closed. It seems that unwrapping will always panic
though.
2015-04-01 11:04:09 -07:00
Alex Crichton
63f3d7f0fa rustup: Default to the beta channel
Switches rustup to using the beta channel by default
2015-04-01 11:04:03 -07:00
Valerii Hiora
28d7693930 iOS: os::last_os_error() fallout 2015-04-01 20:38:58 +03:00
Alex Crichton
c054ae2fa4 Merge branch 'fix-rustup' of https://github.com/richo/rust 2015-04-01 10:30:11 -07:00
Niko Matsakis
943729fa40 Missing imports 2015-04-01 12:49:02 -04:00
Niko Matsakis
c35c46821a Fallout in public-facing and semi-public-facing libs 2015-04-01 11:23:45 -04:00
Niko Matsakis
49b76a087b Fallout in libsyntax 2015-04-01 11:22:39 -04:00
Niko Matsakis
d9530c01a7 Fallout out rustc 2015-04-01 11:22:39 -04:00
Niko Matsakis
890ed5c468 Fallout in tests 2015-04-01 11:22:39 -04:00
Niko Matsakis
c4edd0c8df Make the trait Copy extend Clone. 2015-04-01 11:22:38 -04:00
Niko Matsakis
15b58fedca Fallout in libsyntax/librustc: use newtype'd options for linked lists,
since `Option` is not fundamental and hence the old impls run afoul of
the orphan rules.
2015-04-01 11:21:42 -04:00
Niko Matsakis
30b2d9e764 Fallout in libstd: remove impls now considered to conflict. 2015-04-01 11:21:42 -04:00
Niko Matsakis
b0af587b64 Update tests for new coherence rules, and add a swatch of new tests
probing the specifics of `Fundamental`.

Fixes #23086.
Fixes #23516.
2015-04-01 11:21:42 -04:00
Niko Matsakis
35c261aea0 Add #[fundamental] annotations into libcore so that Sized and the
`Fn` traits are considered fundamental, along with `Box` (though that is
mostly for show; the real type is `~T` in the compiler).
2015-04-01 11:21:42 -04:00
Niko Matsakis
03d3ba7667 Implement the changes to coherence such that we consider a type to be
local only if matches `FUNDAMENTAL(LocalType)`, where `FUNDAMENTAL`
includes `&T` and types marked as fundamental (which includes `Box`).
Also apply these tests to negative reasoning.
2015-04-01 11:21:40 -04:00
Carlos Galarza
48aea41adb Fix sidebar bug
Validate if the description is available in the rawSearchIndex
2015-04-01 10:16:36 -05:00
Corey Farwell
4b6248a806 Simplify match branches in iter.rs example 2015-04-01 10:44:52 -04:00
bors
d528aa9960 Auto merge of #23109 - nikomatsakis:closure-region-hierarchy, r=pnkfelix
Adjust internal treatment of the region hierarchy around closures. Work towards #3696.

r? @pnkfelix
2015-04-01 14:42:16 +00:00
Niko Matsakis
f15813d086 Update comments 2015-04-01 08:40:42 -04:00
Niko Matsakis
ea5138eba0 Remove the Option<> since when computing LUB since I believe that the
case where `None` was returned should never happen in practice; it
amounts to comparing regions from two unrelated hierarchies. (I was also
not able to make it happen.)
2015-04-01 08:40:42 -04:00
Niko Matsakis
a53a22eab9 Implement the new region hierarchy rules, in which regions from distinct
hierarchies are judged based on the lexical relationship of their
respective fn bodies.
2015-04-01 08:40:42 -04:00
Niko Matsakis
bc959fdb28 Add a meta-hierarchy of trees -- in future, each fn body will inhabit
its own disjoint region tree, and the new table encodes the lexical
relationships between those trees.
2015-04-01 08:40:42 -04:00
bors
8943653624 Auto merge of #23936 - pnkfelix:rollup, r=pnkfelix
This is an attempt to fix #23922
2015-04-01 10:02:37 +00:00
Felix S. Klock II
2b71aed003 Update android tests to reflect API switch from os::env to env::vars. 2015-04-01 11:59:51 +02:00
Alex Crichton
8dff0ac143 Test fixes and rebase conflicts 2015-04-01 00:36:26 -07:00
Chris Wong
7c3efcc5bb Don't reborrow the target of a write!()
This means passing in e.g. a `Vec<u8>` or `String` will work as
intended, rather than deref-ing to `&mut [u8]` or `&mut str`.

[breaking-change]

Closes #23768
2015-04-01 19:48:49 +13:00
kgv
343c110e76 Fix rust book error-handling.md for new std::io.
Fix example and some text for: `read_line` takes `&mut String` and return `Result` instead `IoResult`.
2015-04-01 09:37:19 +03:00
Steve Klabnik
8ded156265 Add examples + documentation for std::path 2015-04-01 01:11:38 -04:00
Dzmitry Malyshau
39aa668a01 Added Arc::try_unique 2015-03-31 23:44:23 -04:00
Nick Cameron
0dd0925f57 Tidying up and reformatting 2015-04-01 14:07:19 +13:00
Alex Crichton
6ebb6e60b9 rollup merge of #23923: steveklabnik/gh23688
Fixes #23688

r? @alexcrichton
2015-03-31 18:06:42 -07:00
Alex Crichton
1d5ef755de rollup merge of #23921: aturon/issue-17746
Closes #17746
2015-03-31 18:06:41 -07:00
Alex Crichton
4f643d79fc rollup merge of #23863: pnkfelix/arith-oflo-const-eval
const_eval : add overflow-checking for {`+`, `-`, `*`, `/`, `<<`, `>>`}.

One tricky detail here: There is some duplication of labor between `rustc::middle::const_eval` and `rustc_trans::trans::consts`. It might be good to explore ways to try to factor out the common structure to the two passes (by abstracting over the particular value-representation used in the compile-time interpreter).

----

Update: Rebased atop #23841

Fix #22531

Fix #23030

Fix #23221

Fix #23235
2015-03-31 18:06:35 -07:00
Felix S. Klock II
2a9de1d989 dealing with fallout to the tests, in particular diffs between 32- vs 64-bit targets.
See also #23926.
2015-04-01 02:56:08 +02:00
Felix S. Klock II
2243a2cced Unify handling of checking repeat-count validity. 2015-04-01 02:56:08 +02:00
Felix S. Klock II
1973f7ebe5 Fixes to compile-fail error messages post-rebase. 2015-04-01 02:56:08 +02:00
Felix S. Klock II
1f5e45b769 Include feature core to get access to wrapping_add. 2015-04-01 02:56:08 +02:00
Felix S. Klock II
41b3c86e9a Test cases for checking arithmetic overflow during const eval. 2015-04-01 02:56:07 +02:00
Felix S. Klock II
8d54ea3ec9 Fallout from changes for overflow-checking during constant evaluation. 2015-04-01 02:56:07 +02:00
Felix S. Klock II
6808e414c7 rustc_trans::trans::consts add overflow checking 2015-04-01 02:56:07 +02:00
Felix S. Klock II
b02f7d2fac rustc::middle::const_eval : add overflow-checking for {+, -, *}.
The overflow-checking attempts to accommodate early evaluation where
we do not have type information yet.

Also, add fixme note about something that has been bothering me.
2015-04-01 02:56:07 +02:00
Felix S. Klock II
2e93e386fd rust_llvm: Add way to reflectively ask if a ValueRef is a known constant int.
Add option-returning variants to `const_to_int`/`const_to_uint` that
never assert fail. (These will be used for overflow checking from
rustc_trans::trans::consts.)
2015-04-01 02:56:07 +02:00
Felix S. Klock II
7875dae83f ty.rs improve error feedback when const-eval errs during repeat count eval. 2015-04-01 02:56:07 +02:00