Commit Graph

26101 Commits

Author SHA1 Message Date
Ben Noordhuis
431edacbef Use __pthread_get_minstack() when available.
glibc >= 2.15 has a __pthread_get_minstack() function that returns
PTHREAD_STACK_MIN plus however many bytes are needed for thread-local
storage.  Use it when it's available because just PTHREAD_STACK_MIN is
not enough in applications that have big thread-local storage
requirements.

Fixes #6233.
2014-01-31 13:47:25 +01:00
Ben Noordhuis
b02b5cdcf4 Retry on EINVAL from pthread_attr_setstacksize()
Enforce that the stack size is > RED_ZONE + PTHREAD_STACK_MIN.  If the
call to pthread_attr_setstacksize() subsequently fails with EINVAL, it
means that the platform requires the stack size to be a multiple of the
page size.  In that case, round up to the nearest page and retry.

Fixes #11694.
2014-01-31 13:47:25 +01:00
Ben Noordhuis
464b2e2364 Add libc::consts::os::posix01::PTHREAD_STACK_MIN
Represents the minimum size of a thread's stack.  As such, it's both
platform and architecture-specific.

I put it under posix01 even though it predates POSIX.1-2001 by some
years.  I believe it was first formalized in SUSv2.  I doubt anyone
cares, though.
2014-01-31 13:47:25 +01:00
bors
0a0f87b7b8 auto merge of #11918 : omasanori/rust/reduce-warnings, r=alexcrichton
Moving forward to green waterfall.
2014-01-31 04:21:29 -08:00
David Manescu
bc8983a3fa Handle attributes on cross-crate tuple-structs correctly
Fixes #11741
2014-01-31 22:16:39 +11:00
bors
f910a977db auto merge of #11947 : alexcrichton/rust/osx-unwind, r=brson
On OSX 32-bit, the private fields are 5 words long, not 2. I found this
segfaulting before this change, and after this change it no longer segfaulted.
2014-01-30 23:51:28 -08:00
Alex Crichton
51b90004d9 Fix the size of the _Unwind_Exception struct
On OSX 32-bit, the private fields are 5 words long, not 2. I found this
segfaulting before this change, and after this change it no longer segfaulted.
2014-01-30 21:20:43 -08:00
bors
b7f673a627 auto merge of #11784 : eminence/rust/fix_run_tests, r=alexcrichton
This test is designed to ensure that running a non-existent executable
results in a correct error message (FileNotFound in this case of this
test).  However, if you try to run an executable that doesn't exist, and
that requires searching through the $PATH, and one of the $PATH components
is not readable, then a PermissionDenied error will be returned, instead
of FileNotFound.

Using an absolute path skips the $PATH search logic in exec, thus by-passing the logic in exec that would have returned a PermissionDenied

In the specific case of my machine, /usr/bin/games was part of $PATH, but my user account wasn't in the games group (thus being unable to read /usr/bin/games)

See the man pages for execv and execve for more details.

I've tested this on Linux and OSX, and I am fairly certain that there will be no problems on Windows
2014-01-30 18:11:30 -08:00
bors
7ac516a13b auto merge of #11759 : nathanielherman/rust/master, r=alexcrichton
For #5172
2014-01-30 15:46:28 -08:00
Nathaniel Herman
d9fadbc04f Make mut_last return Option instead of failing on empty vector (and add a test for mut_last) 2014-01-30 18:41:57 -05:00
Nathaniel Herman
339603426e Make pop_ref and mut_pop_ref return Option instead of failing on empty vectors 2014-01-30 18:41:43 -05:00
Nathaniel Herman
d451c15057 Make shift_ref and mut_shift_ref return Option instead of failing 2014-01-30 18:41:20 -05:00
Nathaniel Herman
89278f773d Make size_of, align_of, and element_offset functions return u64 instead of uint in trans::machine (per #5172) 2014-01-30 17:20:35 -05:00
bors
b3003e1e1a auto merge of #11895 : xales/rust/libstd, r=alexcrichton
Fixes #11814
2014-01-30 13:36:41 -08:00
bors
3427137f66 auto merge of #11217 : eddyb/rust/generic-default-type-params, r=cmr 2014-01-30 10:41:47 -08:00
Eduard Burtescu
7d967741c3 Implement default type parameters in generics. 2014-01-30 19:28:41 +02:00
bors
30e9bbaa2c auto merge of #11914 : FlaPer87/rust/issue-6157, r=alexcrichton
closes #6157
2014-01-30 07:06:27 -08:00
Keshav Kini
6a941ec602 Fix inconsistency in tutorial.md
Text refers to "the type shown earlier", when the type in
question was not in fact shown earlier.  I assume this is
an artifact of an earlier revision.
2014-01-30 08:36:49 -06:00
bors
e3dc5f5bcd auto merge of #11911 : kballard/rust/empty-functional-update, r=pcwalton
Fixes #8972
2014-01-30 05:06:30 -08:00
bors
a6764c28e6 auto merge of #11909 : thestinger/rust/tydesc, r=pcwalton 2014-01-30 03:36:25 -08:00
Flavio Percoco
0d0205a577 Add test case for issue #11681 2014-01-30 12:17:58 +01:00
bors
6b305f34fb auto merge of #11907 : sanxiyn/rust/simd-shift, r=thestinger
For the purpose of deciding whether to truncate or extend the right hand side of bit shifts, use the size of the element type for SIMD vector types.

Fix #11900.
2014-01-30 01:56:23 -08:00
bors
e3b1f3c443 auto merge of #11853 : alexcrichton/rust/up-llvm, r=brson
This upgrade brings commit by @eddyb to help optimizations of virtual calls in
a few places (https://github.com/llvm-mirror/llvm/commit/6d2bd95) as well as a
commit by @c-a to *greatly* improve the runtime of the optimization passes
(https://github.com/rust-lang/llvm/pull/3).

Nice work to these guys!
2014-01-29 23:46:26 -08:00
Alex Crichton
8cd935f52a Upgrade LLVM
This upgrade brings commit by @eddyb to help optimizations of virtual calls in
a few places (https://github.com/llvm-mirror/llvm/commit/6d2bd95) as well as a
commit by @c-a to *greatly* improve the runtime of the optimization passes
(https://github.com/rust-lang/llvm/pull/3).

Nice work to these guys!
2014-01-29 23:43:39 -08:00
bors
056363ff36 auto merge of #11839 : typelist/rust/issue3008, r=huonw
It was possible to trigger a stack overflow in rustc because the routine used to verify enum representability,
type_structurally_contains, would recurse on inner types until hitting the original type. The overflow condition was when a different structurally recursive type (enum or struct) was contained in the type being checked.

I suspect my solution isn't as efficient as it could be. I pondered adding a cache of previously-seen types to avoid duplicating work (if enums A and B both contain type C, my code goes through C twice), but I didn't want to do anything that may not be necessary.

I'm a new contributor, so please pay particular attention to any unidiomatic code, misuse of terminology, bad naming of tests, or similar horribleness :)

Updated to verify struct representability as well.

Fixes #3008.
Fixes #3779.
2014-01-29 22:21:29 -08:00
Johannes Muenzel
8d097b3bfb Consider types that contain fixed-length-zero vectors of themselves as non-representable until #11924 is resolved 2014-01-30 00:31:12 -05:00
bors
3cb72a3655 auto merge of #11672 : bjz/rust/remove-times, r=brson
`Times::times` was always a second-class loop because it did not support the `break` and `continue` operations. Its playful appeal (which I liked) was then lost after `do` was disabled for closures. It's time to let this one go.
2014-01-29 20:06:36 -08:00
Brendan Zabarauskas
729060dbb9 Remove Times trait
`Times::times` was always a second-class loop because it did not support the `break` and `continue` operations. Its playful appeal was then lost after `do` was disabled for closures. It's time to let this one go.
2014-01-30 14:52:25 +11:00
Johannes Muenzel
b46c0daa7b Add compile-fail tests for non-representable structs and enums 2014-01-29 20:33:51 -05:00
Johannes Muenzel
7a931574e3 Check enum and struct representability properly (issues #3008 and #3779) 2014-01-29 20:33:51 -05:00
xales
f17d972014 Remove seldom-used std::reference functions. 2014-01-29 20:31:03 -05:00
xales
d547f7ac21 Remove double-use of logging. 2014-01-29 20:31:03 -05:00
xales
d7f97e3018 Rename std::borrow to std::reference.
Fixes #11814
2014-01-29 20:31:03 -05:00
bors
704f93ff5e auto merge of #11893 : Armavica/rust/copyable-cloneable, r=huonw
I found awkward to have `MutableCloneableVector` and `CloneableIterator` on the one hand, and `CopyableVector` etc. on the other hand.

The concerned traits are:
* `CopyableVector` --> `CloneableVector`
* `OwnedCopyableVector` --> `OwnedCloneableVector`
* `ImmutableCopyableVector` --> `ImmutableCloneableVector`
* `CopyableTuple` --> `CloneableTuple`
2014-01-29 17:01:39 -08:00
Daniel Micay
e532e8d55d remove a layer of indirection from most intrinsics 2014-01-29 18:48:34 -05:00
OGINO Masanori
5281d874ef Append ; to #[allow(dead_code)].
Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
2014-01-30 08:42:50 +09:00
OGINO Masanori
d3270c215f Prefix _ to unused variables.
Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
2014-01-30 08:42:50 +09:00
OGINO Masanori
96f0e9c74f Remove unused imports.
Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
2014-01-30 08:42:50 +09:00
bors
f84b7291e7 auto merge of #11776 : FlaPer87/rust/issue-11681-static-lifetime, r=nikomatsakis
Closes #11681
Closes #11854
2014-01-29 15:01:43 -08:00
Flavio Percoco
dbd8f2605a Add test for issue 6157 2014-01-29 23:39:09 +01:00
Flavio Percoco
cb5d7236f1 Fixes temporary lifetime computation for static items
closes: #11854
2014-01-29 22:39:33 +01:00
bors
1e23c5c051 auto merge of #11879 : thestinger/rust/frame-pointer, r=alexcrichton
This is still used for Rust code (`Options.NoFramePointerElim = true`).
2014-01-29 13:36:40 -08:00
Daniel Micay
cb263e875e enable fp-elim when debug info is disabled
This can almost be fully disabled, as it no longer breaks retrieving a
backtrace on OS X as verified by @alexcrichton. However, it still
breaks retrieving the values of parameters. This should be fixable in
the future via a proper location list...

Closes #7477
2014-01-29 16:35:05 -05:00
Daniel Micay
383e3fd13b use a more efficient vtable representation
[TyDesc, ... methods] -> [destructor, ... methods]
2014-01-29 16:31:46 -05:00
bors
dfb61166f5 auto merge of #11877 : Armavica/rust/doc-pm-vector, r=alexcrichton
This feature already was in the tutorial, but I believe that the tutorial should be a strict subset of the manual.

I also added an example.
2014-01-29 11:36:41 -08:00
Kevin Ballard
2258243ad8 Allow empty functional updating of structs
Fixes #8972
2014-01-29 10:44:27 -08:00
bors
c3ae182d5c auto merge of #11754 : alexcrichton/rust/unused-result, r=brson
The general consensus is that we want to move away from conditions for I/O, and I propose a two-step plan for doing so:

1. Warn about unused `Result` types. When all of I/O returns `Result`, it will require you inspect the return value for an error *only if* you have a result you want to look at. By default, for things like `write` returning `Result<(), Error>`, these will all go silently ignored. This lint will prevent blind ignorance of these return values, letting you know that there's something you should do about them.

2. Implement a `try!` macro:

```
macro_rules! try( ($e:expr) => (match $e { Ok(e) => e, Err(e) => return Err(e) }) )
```

With these two tools combined, I feel that we get almost all the benefits of conditions. The first step (the lint) is a sanity check that you're not ignoring return values at callsites. The second step is to provide a convenience method of returning early out of a sequence of computations. After thinking about this for awhile, I don't think that we need the so-called "do-notation" in the compiler itself because I think it's just *too* specialized. Additionally, the `try!` macro is super lightweight, easy to understand, and works almost everywhere. As soon as you want to do something more fancy, my answer is "use match".

Basically, with these two tools in action, I would be comfortable removing conditions. What do others think about this strategy?

----

This PR specifically implements the `unused_result` lint. I actually added two lints, `unused_result` and `unused_must_use`, and the first commit has the rationale for why `unused_result` is turned off by default.
2014-01-29 09:46:34 -08:00
Alex Crichton
c13a62593c Flag Result as #[must_use] and deal with fallout. 2014-01-29 08:35:49 -08:00
bors
e1580f6d09 auto merge of #11868 : bytbox/rust/remove-do, r=alexcrichton
Fixes #10815.
2014-01-29 08:21:38 -08:00
Daniel Micay
50bee30459 stop making visit glue for closures and traits 2014-01-29 10:41:39 -05:00