Commit Graph

25984 Commits

Author SHA1 Message Date
Patrick Walton
8e52b85d5a libsyntax: De-@str literal strings in the AST 2014-02-02 01:44:48 +11:00
Patrick Walton
70c5a0fbf7 libsyntax: Introduce an InternedString type to reduce @str in the
compiler and use it for attributes
2014-02-02 01:44:47 +11:00
Björn Steinbrink
5afc63a2ae Optimize u64_to_{le,be}_bytes
LLVM fails to properly optimize the shifts used to convert the source
value to the right endianess. The resulting assembly copies the value
to the stack one byte at a time even when there's no conversion required
(e.g. u64_to_le_bytes on a little endian machine).

Instead of doing the conversion ourselves using shifts, we can use the
existing intrinsics to perform the endianess conversion and then
transmute the value to get a fixed vector of its bytes.

Before:

test be_i8  ... bench:     21442 ns/iter (+/- 70)
test be_i16 ... bench:     21447 ns/iter (+/- 45)
test be_i32 ... bench:     23832 ns/iter (+/- 63)
test be_i64 ... bench:     26887 ns/iter (+/- 267)

test le_i8  ... bench:     21442 ns/iter (+/- 56)
test le_i16 ... bench:     21448 ns/iter (+/- 36)
test le_i32 ... bench:     23825 ns/iter (+/- 153)
test le_i64 ... bench:     26271 ns/iter (+/- 138)

After:

test be_i8  ... bench:     21438 ns/iter (+/- 10)
test be_i16 ... bench:     21441 ns/iter (+/- 15)
test be_i32 ... bench:     19057 ns/iter (+/- 6)
test be_i64 ... bench:     21439 ns/iter (+/- 34)

test le_i8  ... bench:     21438 ns/iter (+/- 19)
test le_i16 ... bench:     21439 ns/iter (+/- 8)
test le_i32 ... bench:     21439 ns/iter (+/- 19)
test le_i64 ... bench:     21438 ns/iter (+/- 22)
2014-02-01 15:17:22 +01:00
bors
362cbbe01c auto merge of #11932 : dmanescu/rust/11741-stability-cross-crate, r=alexcrichton
Fixes #11741
Added tests and removed xfail-fast from run-pass/simd-experimental which is now fixed (see #11738).
2014-02-01 05:31:24 -08:00
bors
1d494198bb auto merge of #11930 : bjz/rust/next_power_of_two, r=huonw 2014-02-01 04:11:21 -08:00
bors
c80d28c8e3 auto merge of #11963 : alexcrichton/rust/fix-rustpkg, r=brson
Right now the bots are all injecting a libstd version, so all the rustpkg tests
are passing. All rustpkg compilations will fail unless the version number is
explicitly given because rustpkg attempts to exactly guess the target file name.
Switch back to using a pattern match in order to unbreak tests.

Closes #11852
2014-02-01 00:46:23 -08:00
bors
ac000cd8e1 auto merge of #11789 : pongad/rust/master, r=kballard
All tests passing. #5268
2014-01-31 23:31:28 -08:00
bors
5c5d995126 auto merge of #11965 : alexcrichton/rust/issue-7385, r=alexcrichton
I've verified that it works on osx x86_64

Closes #7385

Rolled up PRs:

Closes #11898
Closes #11934
Closes #11942
Closes #11952 
Closes #11960 
Closes #11966
Closes #11953 

Closed issues:

Closes #4063 
Closes #7911
2014-01-31 22:21:38 -08:00
Alex Crichton
a67a3b7749 Fixing tests 2014-01-31 22:11:18 -08:00
Alex Crichton
b59895847e Remove the need to count lang items
This solves horrible diffs where all you do is renumber literally everything.
2014-01-31 21:43:12 -08:00
Kevin Ballard
cad4fcd21b Test for null buffer in CString.len()/.iter() and fail
Also change .as_str() to fail on null buffer.
2014-01-31 21:43:09 -08:00
Huon Wilson
a9f73b5e3d Remove the obsolete handler for impl A;.
This is has been obsolete for quite a while now (including a release),
so removing the special handling seems fine. (The error message is quite
good still anyway.)

Fixes #9580.
2014-01-31 21:43:09 -08:00
Huon Wilson
6c52e72214 Add test for sensible #[start] error message.
Fixes #9575.
2014-01-31 21:43:09 -08:00
OGINO Masanori
ed5b897899 Add test cases for #4063.
Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
2014-01-31 21:43:09 -08:00
Daniel Micay
b5334b3c0d mark the minimum supported Linux kernel version
This is just taken from the binary itself. It would be nice to mark the
minimum glibc version too, and the corresponding RHEL/CentOS version.
2014-01-31 21:43:08 -08:00
Daniel Micay
c9dd1ce89a mark Windows 8 as supported 2014-01-31 21:43:08 -08:00
Daniel Micay
d244512626 bump minimum supported OS X version to 10.7
Closes #11927
Closes #10842
Closes #2024
2014-01-31 21:43:08 -08:00
JeremyLetang
4f24caae11 Add test case for issue 7911 2014-01-31 21:43:08 -08:00
Virgile Andreani
b9a026afba Fix minor doc typos 2014-01-31 21:43:07 -08:00
Alex Crichton
2c8b112580 Un-xfail test for 7385
I've verified that it works on osx x86_64

Closes #7385
2014-01-31 21:43:07 -08:00
Michael Darakananda
d088e5fd94 Added minmax function.
Tests ok
2014-02-01 00:27:28 -05:00
bors
cc6afe1ec0 auto merge of #11768 : nikomatsakis/rust/issue-11385-cell-and-variance, r=pnkfelix
Introduce marker types for indicating variance and for opting out
of builtin bounds.

Fixes #10834.
Fixes #11385.
cc #5922.

r? @pnkfelix (since you reviewed the variance inference in the first place)
2014-01-31 19:36:41 -08:00
bors
a1f157b6ee auto merge of #11885 : bnoordhuis/rust/issue11694, r=alexcrichton
EINVAL means that the requested stack size is either not a multiple
of the system page size or that it's smaller than PTHREAD_STACK_MIN.
Figure out what the case is, fix it up and retry.  If it still fails,
give up, like before.

Suggestions for future improvements:

  * don't fail!() but instead signal a condition, or
  * silently ignore the error and use a default sized stack.

Fixes #11694.

The first two commits put the framework in place, the third one contains the meat.
2014-01-31 18:21:41 -08:00
Niko Matsakis
81d8328517 Introduce marker types for indicating variance and for opting out
of builtin bounds.

Fixes #10834.
Fixes #11385.
cc #5922.
2014-01-31 21:18:48 -05:00
Brendan Zabarauskas
1f15d24243 Move int and uint overflow tests into macros 2014-02-01 13:03:02 +11:00
Brendan Zabarauskas
1388c053a8 Remove free-standing div functions in std::uint 2014-02-01 13:03:02 +11:00
Brendan Zabarauskas
4109caffc3 Remove some unused imports 2014-02-01 13:03:01 +11:00
Brendan Zabarauskas
9a3583f06d Make next_power_of_two generic for unsigned integers
Also rename `next_power_of_two_opt` to `checked_next_power_of_two`.
2014-02-01 13:02:53 +11:00
Alex Crichton
723072ff6a Fix rustpkg tests with --disable-inject-std-version
Right now the bots are all injecting a libstd version, so all the rustpkg tests
are passing. All rustpkg compilations will fail unless the version number is
explicitly given because rustpkg attempts to exactly guess the target file name.
Switch back to using a pattern match in order to unbreak tests.

Closes #11852
2014-01-31 15:56:37 -08:00
bors
83f0f6ef6c auto merge of #11810 : Armavica/rust/issue-11645, r=alexcrichton
The doc-generating tool comments out the lines that match `/$# /` (note the space), which is not what is wanted here. And it lets live the lines matching `/$#[^ ]/`. But we still want to see a space. So I replaced the normal space by a non breakable one, which fools the parser into displaying the line.
2014-01-31 15:11:32 -08:00
bors
5a618129b8 auto merge of #11832 : jfager/rust/r5900, r=alexcrichton
I tried a couple of different ways to squash this, and still don't think this is ideal, but I wanted to get it out for feedback.

Closes #5900
Closes #9942

There are a few scenarios where the compiler tries to evaluate CastExprs without the corresponding types being available yet in the type context:  https://github.com/mozilla/rust/issues/10618, https://github.com/mozilla/rust/issues/5900, https://github.com/mozilla/rust/issues/9942

This PR takes the approach of having eval_const_expr_partial's CastExpr arm fall back to a limited ast_ty_to_ty call that only checks for (a subset of) valid const types, when the direct type lookup fails.  It's kind of hacky, so I understand if you don't want to take this as is.  I'd need a little mentoring to get this into better shape, as figuring out the proper fix has been a little daunting. I'm also happy if someone else wants to pick this up and run with it.

This closes 5900 and 9942, but only moves the goalposts a little on 10618, which now falls over in a later phase of the compiler.
2014-01-31 13:06:39 -08:00
bors
f47879637f auto merge of #11955 : alexcrichton/rust/fix-unwinding-on-mac-64, r=cmr
I believe that this is leading to lots of failures on the bots.

cc #11954
2014-01-31 11:21:33 -08:00
Alex Crichton
e8e0cdd73f Disable fp elim on mac64
I believe that this is leading to lots of failures on the bots.

cc #11954
2014-01-31 10:23:25 -08:00
bors
237885cc53 auto merge of #11917 : thestinger/rust/intrinsic, r=alexcrichton 2014-01-31 10:01:48 -08:00
bors
bec01ad17c auto merge of #11933 : kini/rust/patch-1, r=alexcrichton
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-31 08:46:34 -08:00
bors
535e806841 auto merge of #11929 : FlaPer87/rust/issue-11681, r=huonw
closes #11681
2014-01-31 05:36:31 -08:00
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