Commit Graph

24483 Commits

Author SHA1 Message Date
klutzy
1890290ded llvm: Disable pthread on mingw
llvm supports both win32 native threads and pthread,
but configure tries to find pthread first.
This manually disables pthread to use native api.

This removes libpthreads-2.dll dependency on librustc.
2013-12-18 09:48:58 +09:00
bors
bf30a213c4 auto merge of #10967 : chris-morgan/rust/clean-and-tidy-some-traits, r=alexcrichton
### Remove {As,Into,To}{Option,Either,Result} traits.

Expanded, that is:

- `AsOption`
- `IntoOption`
- `ToOption`
- `AsEither`
- `IntoEither`
- `ToEither`
- `AsResult`
- `IntoResult`
- `ToResult`

These were defined for each other but never *used* anywhere. They are
all trivial and so removal will have negligible effect upon anyone.
`Either` has fallen out of favour (and its implementation of these
traits of dubious semantics), `Option<T>` → `Result<T, ()>` was never
really useful and `Result<T, E>` → `Option<T>` should now be done with
`Result.ok()` (mirrored with `Result.err()` for even more usefulness).

In summary, there's really no point in any of these remaining.

### Rename To{Str,Bytes}Consume traits to Into*.

That is:

- `ToStrConsume` → `IntoStr`;
- `ToBytesConsume` → `IntoBytes`.
2013-12-17 12:56:39 -08:00
bors
3272b002b3 auto merge of #10979 : alexcrichton/rust/less-bc, r=cmr
By performing this logic very late in the build process, it ended up leading to
bugs like those found in #10973 where certain stages of the build process
expected a particular output format which didn't end up being the case. In order
to fix this, the build output generation is moved very early in the build
process to the absolute first thing in phase 2.

Closes #10973
2013-12-17 11:36:42 -08:00
bors
fe85856dc9 auto merge of #10863 : cadencemarseille/rust/patch-handle-ENOENT, r=alexcrichton
Translate ENOENT to IoErrorKind::FileNotFound.
2013-12-17 10:21:44 -08:00
bors
b870ce7a9f auto merge of #11030 : cmr/rust/rustdoc_on_fire, r=metajack
By returning the items to process and storing them in a queue, we were losing
the context that was setup for that item during the recursion. This is an easy
fix, rather than hoisting out the state that it needs.
2013-12-17 09:01:58 -08:00
Corey Richardson
8b5a317d48 Fix rustdoc HTML rendering
By returning the items to process and storing them in a queue, we were losing
the context that was setup for that item during the recursion. This is an easy
fix, rather than hoisting out the state that it needs.
2013-12-17 11:19:14 -05:00
bors
d5798b3902 auto merge of #10972 : metajack/rust/pkgid-with-name, r=alexcrichton
This change extends the pkgid attribute to allow of explicit crate names, instead of always inferring them based on the path. This means that if your GitHub repo is called `rust-foo`, you can have your pkgid set your library name to `foo`. You'd do this with a pkgid attribute like `github.com/somewhere/rust-foo#foo:1.0`.

This is half of the fix for #10922.
2013-12-17 07:41:40 -08:00
Jack Moffitt
262cc4a2bc Update docs to new syntax. 2013-12-17 07:41:39 -07:00
Jack Moffitt
66e049e3af Change pkgid parser to allow overriding the inferred crate name.
Previously the a pkgid of `foo/rust-bar#1.0` implied a crate name of
`rust-bar` and didn't allow this to be overridden. Now you can override the
inferred crate name with `foo/rust-bar#bar:1.0`.
2013-12-17 07:41:39 -07:00
bors
1a26bd166a auto merge of #11005 : sanxiyn/rust/mut, r=alexcrichton
There is no `~mut T` and `[mut T]` any more.
2013-12-17 06:26:40 -08:00
bors
fb6ec38352 auto merge of #10998 : thestinger/rust/iter, r=alexcrichton 2013-12-17 05:11:41 -08:00
Cadence Marseille
33ca3e35be Handle ENOENT
Translate ENOENT to IoErrorKind::FileNotFound.
2013-12-17 08:08:19 -05:00
bors
793eb1d38d auto merge of #10996 : huonw/rust/more-vec-raw, r=cmr
The removal of the aliasing &mut[] and &[] from `shift_opt` also comes with its simplification.

The above also allows the use of `copy_nonoverlapping_memory` in `[].copy_memory` (I did an audit of each use of `.copy_memory` and `std::vec::bytes::copy_memory`, and I believe none of them are called with arguments can ever alias). This changes requires that `unsafe` code using `copy_memory` **needs** to respect the aliasing rules of `&mut[]`.
2013-12-17 03:51:40 -08:00
bors
dc65762d79 auto merge of #10990 : ktt3ja/rust/method-stability, r=huonw
If it's a trait method, this checks the stability attribute of the
method inside the trait definition. Otherwise, it checks the method
implementation itself.

Close #8961.
2013-12-17 02:31:55 -08:00
bors
47c9a35747 auto merge of #10830 : alexcrichton/rust/spsc-queue, r=brson
This pull request completely rewrites std::comm and all associated users. Some major bullet points

* Everything now works natively
* oneshots have been removed
* shared ports have been removed
* try_recv no longer blocks (recv_opt blocks)
* constructors are now Chan::new and SharedChan::new
* failure is propagated on send
* stream channels are 3x faster

I have acquired the following measurements on this patch. I compared against Go, but remember that Go's channels are fundamentally different than ours in that sends are by-default blocking. This means that it's not really a totally fair comparison, but it's good to see ballpark numbers for anyway

```
          oneshot         stream          shared1
std         2.111           3.073          1.730 
my          6.639           1.037          1.238 
native      5.748           1.017          1.250 
go8         1.774           3.575          2.948 
go8-inf     slow            0.837          1.376 
go8-128     4.832           1.430          1.504 
go1         1.528           1.439          1.251 
go2         1.753           3.845          3.166 
```

I had three benchmarks:

* oneshot - N times, create a "oneshot channel", send on it, then receive on it (no task spawning)
* stream - N times, send from one task to another task, wait for both to complete
* shared1 - create N threads, each of which sends M times, and a port receives N*M times.

The rows are as follows:

* `std` - the current libstd implementation (before this pull request)
* `my` - this pull request's implementation (in M:N mode)
* `native` - this pull request's implementation (in 1:1 mode)
* `goN` - go's implementation with GOMAXPROCS=N. The only relevant value is 8 (I had 8 cores on this machine)
* `goN-X` - go's implementation where the channels in question were created with buffers of size `X` to behave more similarly to rust's channels.
2013-12-17 01:16:43 -08:00
bors
2c41a823cc auto merge of #10924 : pcwalton/rust/pod, r=pcwalton
This will be used for the new `Cell`.

r? @nikomatsakis
2013-12-16 22:56:45 -08:00
Alex Crichton
39a6c9d637 Test fallout from std::comm rewrite 2013-12-16 22:55:49 -08:00
Patrick Walton
865701787c doc: Update the documentation to describe the Pod trait. 2013-12-16 22:38:02 -08:00
Patrick Walton
36990dfa3f test: Add a test that POD types can be implicitly copied. 2013-12-16 22:38:02 -08:00
Patrick Walton
e7fbc1f553 libstd: Implement the new Cell. 2013-12-16 22:38:02 -08:00
Patrick Walton
caf34b41c3 librustc: Implement a Pod kind for types that can be memcpy'd.
This will be used for the new `Cell`.
2013-12-16 22:38:02 -08:00
bors
c2c2c4d6f3 auto merge of #10964 : cartazio/rust/gcc-detector, r=alexcrichton
@alexcrichton and others: heres a proof of concept patch for configure that (for now is OS X only) checks at the very end of the configure script if ``cc``, ``gcc``, and ``g++`` possibly point to the same compiler or not.

The way its currently done is i call ```cc  --version```, ``gcc --version`` and ``g++ --version`` and check if theres any matchings for the word ``clang``, ``gcc`` or ``g++``.  So it doesn't rule out miss matched gcc versions or the like, but thats a bit more implausible I think.
2013-12-16 19:16:43 -08:00
Alex Crichton
529e268ab9 Fallout of rewriting std::comm 2013-12-16 17:47:11 -08:00
Alex Crichton
bfa9064ba2 Rewrite std::comm
* Streams are now ~3x faster than before (fewer allocations and more optimized)
    * Based on a single-producer single-consumer lock-free queue that doesn't
      always have to allocate on every send.
    * Blocking via mutexes/cond vars outside the runtime
* Streams work in/out of the runtime seamlessly
* Select now works in/out of the runtime seamlessly
* Streams will now fail!() on send() if the other end has hung up
    * try_send() will not fail
* PortOne/ChanOne removed
* SharedPort removed
* MegaPipe removed
* Generic select removed (only one kind of port now)
* API redesign
    * try_recv == never block
    * recv_opt == block, don't fail
    * iter() == Iterator<T> for Port<T>
    * removed peek
    * Type::new
* Removed rt::comm
2013-12-16 17:47:11 -08:00
Carter Tazio Schonwald
d952553048 provide an error at at configure time if gcc, and g++ point to a mixture of clang and gcc. Fixes issue #10959
Signed-off-by: Carter Tazio Schonwald <carter.schonwald@gmail.com>
2013-12-16 20:00:37 -05:00
Huon Wilson
dd355700cf std::vec: make init_elem nicer by doing fewer moves. 2013-12-17 08:36:04 +11:00
Huon Wilson
8a5a5922c6 std::vec: convert .copy_memory to use copy_nonoverlapping_memory.
It is required that &mut[]s are disjoint from all other &(mut)[]s, so
this assumption is ok.
2013-12-17 08:36:04 +11:00
Huon Wilson
5c147cc408 std::vec::bytes: remove the reference to overlapping src and dest in
docs for copy_memory.

&mut [u8] and &[u8] really shouldn't be overlapping at all (part of the
uniqueness/aliasing guarantee of &mut), so no point in encouraging it.
2013-12-17 08:36:04 +11:00
Huon Wilson
d0ae820765 std::vec::raw: convert copy_memory to a method. 2013-12-17 08:36:01 +11:00
Huon Wilson
ad20a78c54 std::vec::raw: convert init_elem to a method. 2013-12-17 08:35:34 +11:00
Kiet Tran
4f95dceb59 Detect stability attributes on methods.
If it's a trait method, this checks the stability attribute of the
method inside the trait definition. Otherwise, it checks the method
implementation itself.
2013-12-16 16:25:45 -05:00
bors
000cda611f auto merge of #11002 : pnkfelix/rust/fsk-improve-doc-for-ptr-offset, r=alexcrichton
Spell out the units used for the `offset` argument, so that people do not try to scale to units of bytes themselves.
2013-12-16 13:16:40 -08:00
Seo Sanghyeon
4a13364010 Remove obsolete mutability from ast::Ty 2013-12-17 03:01:40 +09:00
bors
35e5056b6a auto merge of #11000 : cmr/rust/auto_encode, r=alexcrichton
Closes #6122
2013-12-16 09:06:38 -08:00
Felix S. Klock II
16f69b225b Spell out the units used for the offset argument, so that people do
not try to scale to units of bytes themselves.
2013-12-16 17:07:04 +01:00
Corey Richardson
b1fcba6024 Update and un-xfail auto-encode test
Closes #6122
2013-12-16 10:17:08 -05:00
Daniel Micay
664c9af1e9 vec: avoid some unsafe code in MoveIterator's dtor 2013-12-16 08:58:41 -05:00
bors
4e77c1148f auto merge of #10966 : michaelwoerister/rust/prelude2, r=cmr
This PR improves the stepping experience in GDB. It contains some fine tuning of line information and makes *rustc* produce nearly the same IR/DWARF as Clang. The focus of the changes is function prologue handling which has caused some problems in the past (https://github.com/mozilla/rust/issues/9641).

It seems that GDB does not properly handle function prologues when the function uses segmented stacks, i.e. it does not recognize that the `__morestack` check is part of the prologue. When setting a breakpoint like `break foo` it will set the break point before the arguments of `foo()` have been loaded and still contain bogus values. For function with the #[no_split_stack] attribute this problem has never occurred for me so I'm pretty sure that segmented stacks are the cause of the problem. @jdm mentioned that segmented stack won't be completely abandoned after all. I'd be grateful if you could tell me about what the future might bring in this regard (@brson, @cmr).

Anyway, this PR should alleviate this problem at least in the case when setting breakpoints using line numbers and also make it less confusing when setting them via function names because then GDB will break *before* the first statement where one could conceivably argue that arguments need not be initialized yet.

Also, a koala: 🐨

Cheers,
Michael
2013-12-16 05:51:32 -08:00
Huon Wilson
33b6bf4bc1 std::vec: remove aliasing &mut [] and &[] from shift_opt.
Also, dramatically simplify it with some tasteful raw pointers, rather
than treating everything as a nail with `transmute`.
2013-12-17 00:18:51 +11:00
bors
7b42497453 auto merge of #10995 : thestinger/rust/fast_move_iter, r=huonw
Closes #10976

Taken from 863fbaaa12, so it will be easily updated to the better vector representation too.
2013-12-16 03:01:58 -08:00
Daniel Micay
e3b168dab3 vec: make the move iterator fast for all types
Closes #10976
2013-12-16 05:56:42 -05:00
Michael Woerister
9384de77bb debuginfo: Add comment on is_local_to_unit parameter. 2013-12-16 10:23:28 +01:00
Michael Woerister
d35fff8994 debuginfo: Added some documentation of source location management. 2013-12-16 10:23:28 +01:00
Michael Woerister
89b47d5557 debuginfo: Add test cases for function prologue handling. 2013-12-16 10:23:28 +01:00
Michael Woerister
91efb2a67f debuginfo: Set correct source position for function calls. 2013-12-16 10:23:28 +01:00
Michael Woerister
b0100c5a0f debuginfo: Set the is_local_to_unit attribute of functions correctly 2013-12-16 10:23:28 +01:00
Michael Woerister
69f4bf79b2 debuginfo: Use same behavior as Clang for calculating scope_line parameter when creating function DIEs. 2013-12-16 10:23:28 +01:00
Michael Woerister
45e472aa4b debuginfo: Get rid of redundant argument copying with debuginfo activated 2013-12-16 10:23:28 +01:00
Michael Woerister
7eae649a01 debuginfo: Create separate lexical block for function bodies. 2013-12-16 10:23:28 +01:00
Michael Woerister
184d39414d debuginfo: Clear source positions where they'd confuse LLVM otherwise. 2013-12-16 10:23:28 +01:00