Commit Graph

23231 Commits

Author SHA1 Message Date
bors
cd59a7c464 auto merge of #9976 : thestinger/rust/typo, r=thestinger 2013-10-20 21:11:19 -07:00
Daniel Micay
93b95dd394 fix typo 2013-10-20 15:12:13 -04:00
bors
69860b79b8 auto merge of #9812 : HNO3/rust/windows-utf8, r=alexcrichton
This fixes #9418 and #9618, and potential problems related to directory walking.
2013-10-20 10:31:17 -07:00
bors
424c171da5 auto merge of #9973 : huonw/rust/7580, r=luqmana
Fixed by the privacy changes that allowed the `mod std {}` at the top
level of `std` to be non-`pub`.
2013-10-20 02:26:17 -07:00
Huon Wilson
ab045fa797 testsuite: test for fixed issue. Closes #7580.
Fixed by the privacy changes that allowed the `mod std {}` at the top
level of `std` to be non-`pub`.
2013-10-20 20:19:29 +11:00
LEE Wondong
3e53c929a2 Fix unicode errors on Windows in path_is_dir, path_exists, getcwd and rust_localtime.
This make these functions use wchar_t version of APIs, instead of char version.
2013-10-20 15:02:03 +09:00
bors
69e46f3aa9 auto merge of #9956 : sfackler/rust/more-more-visibility, r=alexcrichton 2013-10-19 14:01:10 -07:00
bors
9d047cdead auto merge of #9952 : huonw/rust/fmt-doc, r=alexcrichton
Cf. the concern raised in https://github.com/mozilla/rust/pull/9938#issuecomment-26648696.
2013-10-19 12:11:13 -07:00
bors
310f7a5f52 auto merge of #9949 : Heather/rust/driver-rs-cleanup-pullrequest, r=thestinger 2013-10-19 10:56:15 -07:00
bors
31a209ca42 auto merge of #9834 : alexcrichton/rust/morestack, r=brson
This commit re-introduces the functionality of __morestack in a way that it was
not originally anticipated. Rust does not currently have segmented stacks,
rather just large stack segments. We do not detect when these stack segments are
overrun currently, but this commit leverages __morestack in order to check this.

This commit purges a lot of the old __morestack and stack limit C++
functionality, migrating the necessary chunks to rust. The stack limit is now
entirely maintained in rust, and the "main logic bits" of __morestack are now
also implemented in rust as well.

I put my best effort into validating that this currently builds and runs successfully on osx and linux 32/64 bit, but I was unable to get this working on windows. We never did have unwinding through __morestack frames, and although I tried poking at it for a bit, I was unable to understand why we don't get unwinding right now.

A focus of this commit is to implement as much of the logic in rust as possible. This involved some liberal usage of `no_split_stack` in various locations, along with some use of the `asm!` macro (scary). I modified a bit of C++ to stop calling `record_sp_limit` because this is no longer defined in C++, rather in rust.

Another consequence of this commit is that `thread_local_storage::{get, set}` must both be flagged with `#[rust_stack]`. I've briefly looked at the implementations on osx/linux/windows to ensure that they're pretty small stacks, and I'm pretty sure that they're definitely less than 20K stacks, so we probably don't have a lot to worry about.

Other things worthy of note:
* The default stack size is now 4MB instead of 2MB. This is so that when we request 2MB to call a C function you don't immediately overflow because you have consumed any stack at all.
* `asm!` is actually pretty cool, maybe we could actually define context switching with it?
* I wanted to add links to the internet about all this jazz of storing information in TLS, but I was only able to find a link for the windows implementation. Otherwise my suggestion is just "disassemble on that arch and see what happens"
* I put my best effort forward on arm/mips to tweak __morestack correctly, we have no ability to test this so an extra set of eyes would be useful on these spots.
* This is all really tricky stuff, so I tried to put as many comments as I thought were necessary, but if anything is still unclear (or I completely forgot to take something into account), I'm willing to write more!
2013-10-19 09:46:18 -07:00
Alex Crichton
6d8330afb6 Use __morestack to detect stack overflow
This commit resumes management of the stack boundaries and limits when switching
between tasks. This additionally leverages the __morestack function to run code
on "stack overflow". The current behavior is to abort the process, but this is
probably not the best behavior in the long term (for deails, see the comment I
wrote up in the stack exhaustion routine).
2013-10-19 09:43:31 -07:00
Huon Wilson
759b20da87 std::fmt: fix markdown peculiarity, unicodify some arrows, ` some trait names. 2013-10-19 23:37:50 +11:00
bors
5751794d97 auto merge of #9946 : sfackler/rust/enum-doc, r=alexcrichton
Struct fields with inherited visibility were previously stripped.

Closes #9899
2013-10-19 05:06:17 -07:00
bors
0b1fb461d6 auto merge of #9941 : alexcrichton/rust/rustdoc, r=huonw
Beforehand the id of a method was the id of the 'self' argument, but this is not
the id which privacy was using (the id of the ast::method) struct, so by moving
the ids over to the privacy-target ones the methods are now stripped correctly.
2013-10-19 03:56:19 -07:00
bors
404a4619dc auto merge of #9939 : sinma/rust/doc, r=alexcrichton
Recently, the float type, and the rust and rusti tools have been removed from master.

float replaced by f64 in code examples, removed mentions of float, f suffix, rust and rusti in explanations.

(+ some stupid things like rust -> Rust)
2013-10-19 02:46:25 -07:00
Sébastien Chauvel
62cb92d4ea doc (en & ja): remove mentions of type float, rust and rusti tools 2013-10-20 01:00:22 +02:00
Heather
8c5f584567 remove rust and rusti from driver.rs 2013-10-19 13:31:39 +04:00
bors
8f2480420e auto merge of #9932 : alexcrichton/rust/better-fmt-errors, r=cmr
Instead of just saying "unterminated format string" and friends, instead print
information about what was expected and what was found.

Closes #9931
2013-10-19 01:31:21 -07:00
Steven Fackler
c18afcd83a Check unnecessary visibility for struct variants 2013-10-18 22:44:11 -07:00
Steven Fackler
590b50f71a Fix struct field visibility and add enum field doc
Struct fields with inherited visibility were previously stripped.

Closes #9899
2013-10-18 22:03:14 -07:00
Alex Crichton
a447c3ca16 Try to improve format! error messages
Instead of just saying "unterminated format string" and friends, instead print
information about what was expected and what was found.

Closes #9931
2013-10-18 21:28:00 -07:00
bors
34a1e3dc9a auto merge of #9938 : alexcrichton/rust/fmtdox, r=huonw
Closes #9865
Closes #9808
2013-10-18 21:21:22 -07:00
bors
3a7337ff17 auto merge of #9437 : catamorphism/rust/rustpkg-dates, r=alexcrichton
r? @alexcrichton On most platforms, the time granularity is 1 sec or more, so comparing
dates in tests that check whether rebuilding did or didn't happen leads
to spurious failures. Instead, test the same thing by making an output
file read-only and trapping attempts to write to it.
2013-10-18 19:36:22 -07:00
Tim Chevalier
e779313b07 rustpkg: invoke touch with a portable set of args 2013-10-18 18:36:27 -07:00
Tim Chevalier
4dbef017dd rustc: Check that the output file is writeable before linking
This is because on Linux, the linker will silently overwrite
a read-only file.
2013-10-18 18:36:23 -07:00
Tim Chevalier
1cf029c229 rustpkg: Make rustpkg tests stop comparing dates
Instead of scrutinizing modification times in rustpkg tests,
change output files to be read-only and detect attempts to write
to them (hack suggested by Jack). This avoids time granularity problems.

As part of this change, I discovered that some dependencies weren't
getting written correctly (involving built executables and library
files), so this patch fixes that too.

This partly addresses #9441, but one test (test_rebuild_when_needed)
is still ignored on Linux.
2013-10-18 18:36:17 -07:00
bors
cd623e3e36 auto merge of #9919 : alexcrichton/rust/fmt-begone, r=huonw
It lived a good life, but its time has come. The groundwork is set for the
official transition after the next snapshot (removal of XXX2 macros)
2013-10-18 18:26:23 -07:00
Alex Crichton
7168e70bcb rustdoc: Strip methods correctly based on privacy
Beforehand the id of a method was the id of the 'self' argument, but this is not
the id which privacy was using (the id of the ast::method) struct, so by moving
the ids over to the privacy-target ones the methods are now stripped correctly.
2013-10-18 18:16:38 -07:00
bors
a9836e72dd auto merge of #9856 : alexcrichton/rust/privacy-errors, r=huonw
This stops labeling everything as "is private" when in fact the destination may
be public. Instead, the clause "is inaccessible" is used and the private part of
the flag is called out with a "is private" message.

Closes #9793
2013-10-18 17:11:25 -07:00
Alex Crichton
29c58c473f Remove the fmt! syntax extension
It lived a good life, but its time has come. The groundwork is set for the
official transition after the next snapshot (removal of XXX2 macros)
2013-10-18 16:01:40 -07:00
Alex Crichton
7a8324d3e8 Document traits and Default about format! better
Closes #9865
Closes #9808
2013-10-18 15:55:28 -07:00
bors
df187a0b67 auto merge of #9933 : alexcrichton/rust/no-jemalloc, r=brson
As discovered in #9925, it turns out that we weren't using jemalloc on most
platforms. Additionally, on some platforms we were using it incorrectly and
mismatching the libc version of malloc with the jemalloc version of malloc.

Additionally, it's not clear that using jemalloc is indeed a large performance
win in particular situtations. This could be due to building jemalloc
incorrectly, or possibly due to using jemalloc incorrectly, but it is unclear at
this time.

Until jemalloc can be confirmed to integrate correctly on all platforms and has
verifiable large performance wins on platforms as well, it shouldn't be part of
the default build process. It should still be available for use via the
LD_PRELOAD trick on various architectures, but using it as the default allocator
for everything would require guaranteeing that it works in all situtations,
which it currently doesn't.

Closes #9925
2013-10-18 15:26:24 -07:00
bors
6b07d885f3 auto merge of #9935 : reedlepee123/rust/my_new_branch, r=bstrie 2013-10-18 14:16:26 -07:00
chitra
bdcd29c6d0 Make fields in std::comm private 2013-10-19 00:18:17 +05:30
bors
a1b25f2f09 auto merge of #9930 : alexcrichton/rust/refcount-tests, r=thestinger
This fixes a bug I accidentally introduced in #9922
2013-10-18 11:31:31 -07:00
Alex Crichton
90911d7259 Remove jemalloc from the runtime
As discovered in #9925, it turns out that we weren't using jemalloc on most
platforms. Additionally, on some platforms we were using it incorrectly and
mismatching the libc version of malloc with the jemalloc version of malloc.

Additionally, it's not clear that using jemalloc is indeed a large performance
win in particular situtations. This could be due to building jemalloc
incorrectly, or possibly due to using jemalloc incorrectly, but it is unclear at
this time.

Until jemalloc can be confirmed to integrate correctly on all platforms and has
verifiable large performance wins on platforms as well, it shouldn't be part of
the default build process. It should still be available for use via the
LD_PRELOAD trick on various architectures, but using it as the default allocator
for everything would require guaranteeing that it works in all situtations,
which it currently doesn't.

Closes #9925
2013-10-18 10:38:21 -07:00
bors
d052912297 auto merge of #9851 : alexcrichton/rust/include_bin, r=huonw
Previously an ExprLit was created *per byte* causing a huge increase in memory
bloat. This adds a new `lit_binary` to contain a literal of binary data, which
is currently only used by the include_bin! syntax extension. This massively
speeds up compilation times of the shootout-k-nucleotide-pipes test

    before:
        time: 469s
        memory: 6GB
        assertion failure in LLVM (section too large)

    after:
        time: 2.50s
        memory: 124MB

Closes #2598
2013-10-18 09:41:33 -07:00
Alex Crichton
6a11e17b6b Fix an off-by-one in managed::refcount
This fixes a bug I accidentally introduced in #9922
2013-10-18 09:33:18 -07:00
Alex Crichton
273784e9bf Optimize include_bin! for large inputs
Previously an ExprLit was created *per byte* causing a huge increase in memory
bloat. This adds a new `lit_binary` to contain a literal of binary data, which
is currently only used by the include_bin! syntax extension. This massively
speeds up compilation times of the shootout-k-nucleotide-pipes test

    before:
        time: 469s
        memory: 6GB
        assertion failure in LLVM (section too large)

    after:
        time: 2.50s
        memory: 124MB

Closes #2598
2013-10-18 09:20:08 -07:00
bors
792d73259d auto merge of #9929 : chris-morgan/rust/2013-10-19-vim-updates, r=sanxiyn
- Update prelude items specially highlighted.
- Highlight `
2013-10-18 08:31:24 -07:00
bors
a1848bc755 auto merge of #9927 : chris-morgan/rust/fix-url-to_str-so-it-includes-the-port, r=huonw
Fixes #9451.
Fixes chris-morgan/rust-http#16.
2013-10-18 07:21:25 -07:00
Chris Morgan
f3796616de Highlight \0 in strings and chars in Vim. 2013-10-19 00:56:41 +11:00
Chris Morgan
0ae9e476af Update prelude items in Vim syntax. 2013-10-19 00:55:52 +11:00
Chris Morgan
1093730d72 Fix extra::url::to_str to include the port.
Fixes #9451.
Fixes chris-morgan/rust-http#16.
2013-10-19 00:25:03 +11:00
bors
3f240fedec auto merge of #9926 : Kimundi/rust/future_result_bad_sig, r=huonw 2013-10-18 06:11:18 -07:00
Marvin Löbel
3011801256 Made std::task::TaskBuilder::future_result() easier to use 2013-10-18 10:43:41 +02:00
bors
71c3f8c20c auto merge of #9924 : metajack/rust/fix-starts-with-ends-with, r=huonw
d4a32386f3 broke these since slice_to() and slice_from() must get character
boundaries, and arbitrary needle lengths don't necessarily map to character
boundaries of the haystack.

This also adds new tests that would have caught this bug.
2013-10-18 00:26:19 -07:00
bors
d0d554456a auto merge of #9850 : eddyb/rust/inline-asm-constraints, r=luqmana
I've implemented analysis support for the [GCC '=' write-only inline asm constraint modifier](http://gcc.gnu.org/onlinedocs/gcc/Modifiers.html). I had more changes, for '+' (read+write) as well, but it turns out LLVM doesn't support '+' at all.

I've removed the need for wrapping each output in ExprAddrOf, as that would require unwrapping almost everywhere and it was harder to reason about in borrowck than ExprAssign's LHS.

With this change, rustc will treat (in respect to validity of accessing a local) code like this:
```rust
let x: int;
unsafe {
    asm!("mov $1, $0" : "=r"(x) : "r"(5u));
}
```
as if it were this:
```rust
let x : int;
x = 5;
```

Previously, the local was required to be both mutable and initialized, and the write effect wasn't recorded.
2013-10-17 23:16:22 -07:00
Jack Moffitt
090b2453a1 Fix starts_with() and ends_with().
d4a32386f3 broke these since slice_to() and slice_from() must get character
boundaries, and arbitrary needle lengths don't necessarily map to character
boundaries of the haystack.

This also adds new tests that would have caught this bug.
2013-10-17 23:36:43 -06:00
bors
0e4d1fc8ca auto merge of #9922 : alexcrichton/rust/less-sys, r=thestinger
More progress on #2240
2013-10-17 22:06:22 -07:00