Commit Graph

24524 Commits

Author SHA1 Message Date
Eduard Burtescu
a9c4b18b18 Box Block, fn_decl, variant and Ty in the AST, as they were inflating critical enum sizes. 2013-12-01 00:00:39 +02:00
bors
dfe46f788b auto merge of #10737 : huonw/rust/with-cap, r=alexcrichton
This allows one to reduce the number of reallocs of the internal buffer
if one has an approximate idea of the size of the final output.
2013-11-30 09:56:41 -08:00
Steven Fackler
26e57bbdb5 Fixes for BufferedWriter and LineBufferedWriter
BufferedWriter::inner flushes before returning the underlying writer.

BufferedWriter::write no longer flushes the underlying writer.

LineBufferedWriter::write flushes up to the *last* newline in the input
string, not the first.
2013-11-30 11:33:11 -05:00
bors
9bf62f71bc auto merge of #10727 : erickt/rust/json, r=huonw
This PR does some small modernizations to the json library. First is to remove the `@` boxes, second is to rename the constructors to `new`.
2013-11-30 06:06:42 -08:00
Huon Wilson
be6ae6eb37 std::io::mem: add a with_capacity constructor to MemWriter.
This allows one to reduce the number of reallocs of the internal buffer
if one has an approximate idea of the size of the final output.
2013-12-01 00:58:27 +11:00
bors
eeaf2e1ddc auto merge of #10735 : alexcrichton/rust/issue-10734, r=cmr
Turns out `with_scope` already translates destructors, so by manually
translating destructors we end up running them all twice (bad).

Closes #10734
2013-11-30 04:01:45 -08:00
bors
156054f55c auto merge of #10722 : cmr/rust/type_id_opaque, r=alexcrichton
Closes #10594
2013-11-30 01:21:41 -08:00
Alex Crichton
7bb166ef4f Don't run cleanups twice in "if true" blocks
Turns out `with_scope` already translates destructors, so by manually
translating destructors we end up running them all twice (bad).

Closes #10734
2013-11-30 00:30:28 -08:00
Corey Richardson
572635b76f Wrap the return value of the type_id intrinsic in an opaque box
Closes #10594
2013-11-30 02:58:36 -05:00
Alex Crichton
f1cbfceefb Ignore a deque test on windows
I've seen this fail on windows twice now, and it's not clear to me why it's
failing. For now, ignore it on that platform while investigation enuses.
2013-11-29 23:20:10 -08:00
Erick Tryzelaar
a7b311ac61 extra: missed a couple @ in json 2013-11-29 21:26:03 -08:00
Alex Crichton
c1e287af77 Make -Z gen-crate-map usable for I/O
In #10422, I didn't actually test to make sure that the '-Z gen-crate-map'
option was usable before I implemented it. The crate map was indeed generated
when '-Z gen-crate-map' was specified, but the I/O factory slot was empty
because of an extra check in trans about filling in that location.

This commit both fixes that location, and checks in a "fancy test" which does
lots of fun stuff. The test will use the rustc library to compile a rust crate,
and then compile a C program to link against that crate and run the C program.
To my knowledge this is the first test of its kind, so it's a little ad-hoc, but
it seems to get the job done. We could perhaps generalize running tests like
this, but for now I think it's fine to have this sort of functionality tucked
away in a test.
2013-11-29 18:36:14 -08:00
Alex Crichton
6d6ccb75ff Add a new run-make test directory
This infrastructure is meant to support runnings tests that involve various
interesting interdependencies about the types of crates being linked or possibly
interacting with C libraries. The goal of these make tests is to not restrict
them to a particular test runner, but allow each test to run its own tests.

To this end, there is a new src/test/run-make directory which has sub-folders of
tests. Each test requires a `Makefile`, and running the tests constitues simply
running `make` inside the directory. The new target is `check-stageN-rmake`.

These tests will have the destination directory (as TMPDIR) and the local rust
compiler (as RUSTC) passed along to them. There is also some helpful
cross-platform utilities included in src/test/run-make/tools.mk to aid with
compiling C programs and running them.

The impetus for adding this new test suite is to allow various interesting forms
of testing rust linkage. All of the tests initially added are various flavors of
compiling Rust and C with one another as well as just making sure that rust
linkage works in general.

Closes #10434
2013-11-29 18:36:14 -08:00
Alex Crichton
9fbba7b2ee Statically link librustrt to libstd
This commit alters the build process of the compiler to build a static
librustrt.a instead of a dynamic version. This means that we can stop
distributing librustrt as well as default linking against it in the compiler.

This also means that if you attempt to build rust code without libstd, it will
no longer work if there are any landing pads in play. The reason for this is
that LLVM and rustc will emit calls to the various upcalls in librustrt used to
manage exception handling. In theory we could split librustrt into librustrt and
librustupcall. We would then distribute librustupcall and link to it for all
programs using landing pads, but I would rather see just one librustrt artifact
and simplify the build process.

The major benefit of doing this is that building a static rust library for use
in embedded situations all of a sudden just became a whole lot more feasible.

Closes #3361
2013-11-29 18:36:14 -08:00
Alex Crichton
e338a4154b Add generation of static libraries to rustc
This commit implements the support necessary for generating both intermediate
and result static rust libraries. This is an implementation of my thoughts in
https://mail.mozilla.org/pipermail/rust-dev/2013-November/006686.html.

When compiling a library, we still retain the "lib" option, although now there
are "rlib", "staticlib", and "dylib" as options for crate_type (and these are
stackable). The idea of "lib" is to generate the "compiler default" instead of
having too choose (although all are interchangeable). For now I have left the
"complier default" to be a dynamic library for size reasons.

Of the rust libraries, lib{std,extra,rustuv} will bootstrap with an
rlib/dylib pair, but lib{rustc,syntax,rustdoc,rustpkg} will only be built as a
dynamic object. I chose this for size reasons, but also because you're probably
not going to be embedding the rustc compiler anywhere any time soon.

Other than the options outlined above, there are a few defaults/preferences that
are now opinionated in the compiler:

* If both a .dylib and .rlib are found for a rust library, the compiler will
  prefer the .rlib variant. This is overridable via the -Z prefer-dynamic option
* If generating a "lib", the compiler will generate a dynamic library. This is
  overridable by explicitly saying what flavor you'd like (rlib, staticlib,
  dylib).
* If no options are passed to the command line, and no crate_type is found in
  the destination crate, then an executable is generated

With this change, you can successfully build a rust program with 0 dynamic
dependencies on rust libraries. There is still a dynamic dependency on
librustrt, but I plan on removing that in a subsequent commit.

This change includes no tests just yet. Our current testing
infrastructure/harnesses aren't very amenable to doing flavorful things with
linking, so I'm planning on adding a new mode of testing which I believe belongs
as a separate commit.

Closes #552
2013-11-29 18:36:13 -08:00
Chris Morgan
d3019af244 Fix double slashes in make paths.
CFG_BUILD_DIR, CFG_LLVM_SRC_DIR and CFG_SRC_DIR all have trailing
slashes, by definition, so this is correct.
2013-11-30 12:09:10 +11:00
bors
80991bb578 auto merge of #10719 : Kimundi/rust/switch_to_multi_item_macros, r=alexcrichton
- Removed module reexport workaround for the integer module macros
- Removed legacy reexports of `cmp::{min, max}` in the integer module macros
- Combined a few macros in `vec` into one
- Documented a few issues
2013-11-29 14:01:48 -08:00
bors
dd1184eedb auto merge of #10678 : alexcrichton/rust/issue-4877, r=pcwalton
This adds an implementation of the Chase-Lev work-stealing deque to libstd
under std::rt::deque. I've been unable to break the implementation of the deque
itself, and it's not super highly optimized just yet (everything uses a SeqCst
memory ordering).

The major snag in implementing the chase-lev deque is that the buffers used to
store data internally cannot get deallocated back to the OS. In the meantime, a
shared buffer pool (synchronized by a normal mutex) is used to
deallocate/allocate buffers from. This is done in hope of not overcommitting too
much memory. It is in theory possible to eventually free the buffers, but one
must be very careful in doing so.

I was unable to get some good numbers from src/test/bench tests (I don't think
many of them are slamming the work queue that much), but I was able to get some
good numbers from one of my own tests. In a recent rewrite of select::select(),
I found that my implementation was incredibly slow due to contention on the
shared work queue. Upon switching to the parallel deque, I saw the contention
drop to 0 and the runtime go from 1.6s to 0.9s with the most amount of time
spent in libuv awakening the schedulers (plus allocations).

Closes #4877
2013-11-29 12:31:49 -08:00
Alex Crichton
a70f9d7324 Implement a lock-free work-stealing deque
This adds an implementation of the Chase-Lev work-stealing deque to libstd
under std::rt::deque. I've been unable to break the implementation of the deque
itself, and it's not super highly optimized just yet (everything uses a SeqCst
memory ordering).

The major snag in implementing the chase-lev deque is that the buffers used to
store data internally cannot get deallocated back to the OS. In the meantime, a
shared buffer pool (synchronized by a normal mutex) is used to
deallocate/allocate buffers from. This is done in hope of not overcommitting too
much memory. It is in theory possible to eventually free the buffers, but one
must be very careful in doing so.

I was unable to get some good numbers from src/test/bench tests (I don't think
many of them are slamming the work queue that much), but I was able to get some
good numbers from one of my own tests. In a recent rewrite of select::select(),
I found that my implementation was incredibly slow due to contention on the
shared work queue. Upon switching to the parallel deque, I saw the contention
drop to 0 and the runtime go from 1.6s to 0.9s with the most amount of time
spent in libuv awakening the schedulers (plus allocations).

Closes #4877
2013-11-29 12:19:16 -08:00
Marvin Löbel
4840064f85 Removed module macro workaround for signed and unsigned integers 2013-11-29 20:36:47 +01:00
Marvin Löbel
0d8ace823b Removed useless cmp::{min, max} reexports from the integer modules 2013-11-29 20:19:22 +01:00
Erick Tryzelaar
6818b96a66 extra: json::Encoder should take a &mut io::Writer 2013-11-29 11:19:19 -08:00
Erick Tryzelaar
f7b739c34c extra: Rename json constructors into *::init 2013-11-29 11:19:19 -08:00
Erick Tryzelaar
5b41df4ca0 Remove some unnecessary impls from json 2013-11-29 11:19:18 -08:00
Erick Tryzelaar
18ca312984 Remove @ from json::Error 2013-11-29 11:19:18 -08:00
bors
08f4d1ff9f auto merge of #10697 : pcwalton/rust/path-new, r=pcwalton
r+

(carrying over from @alexcrichton's review)
2013-11-29 11:01:50 -08:00
Patrick Walton
c54427ddfb libstd: Change Path::new to Path::init. 2013-11-29 10:55:13 -08:00
bors
631cbd2e11 auto merge of #10726 : pnkfelix/rust/fsk-remove-at-fn-artifact, r=thestinger
While tracking down how this function became dead, identified a spot
(@fn cannot happen) where we probably would prefer to ICE rather than
pass silently; so added fail! invocation.
2013-11-29 09:36:40 -08:00
Felix S. Klock II
fffa10c175 Removed some dead code.
While tracking down how this function became dead, identified a spot
(@fn cannot happen) where we probably would prefer to ICE rather than
pass silently; so added fail! invocation.
2013-11-29 18:20:27 +01:00
Marvin Löbel
90f9eb3b1e Removed a few macro-expanding-to-module workarounds
Also documented a few issues
2013-11-29 17:33:36 +01:00
bors
6c672ee094 auto merge of #10715 : alexcrichton/rust/fix-log-twice, r=huonw
It may mislead you into thinking tasks are spawning twice, when in fact they are
not.
2013-11-29 01:31:47 -08:00
osa1
bc423583a4 don't create intermediate string while creating json (rustdoc) 2013-11-29 10:06:21 +02:00
Alex Crichton
bfba120133 Fix initial debug statements printing twice
It may mislead you into thinking tasks are spawning twice, when in fact they are
not.
2013-11-28 23:46:22 -08:00
bors
bf6964ecb6 auto merge of #10709 : alexcrichton/rust/snapshot, r=pcwalton 2013-11-28 20:31:39 -08:00
Alex Crichton
ab387a6838 Register new snapshots 2013-11-28 20:27:56 -08:00
bors
90d06ecf6b auto merge of #10704 : TeXitoi/rust/spectralnorm-resurected, r=alexcrichton 2013-11-28 12:26:31 -08:00
Guillaume Pinot
6bd22494e9 shootout-spectralnorm resurection with parallelization 2013-11-28 20:46:59 +01:00
bors
859c3baf64 auto merge of #10519 : nikomatsakis/rust/issue-8624-borrowck-overly-permissive, r=pnkfelix
See #8624 for details.

r? @pnkfelix
2013-11-28 03:51:32 -08:00
Niko Matsakis
09e12fa553 Test that reborrowing contents of an &'a mut &'b mut pointer can only
be done for at most lifetime `'a`

Fixes #8624
2013-11-28 06:43:39 -05:00
Niko Matsakis
bc4164d4c0 Modify iterators to make them safe with the new rules. 2013-11-28 06:43:39 -05:00
bors
42ea44ba27 auto merge of #10694 : klutzy/rust/rustdoc-closure, r=alexcrichton 2013-11-27 21:02:52 -08:00
bors
68e3292fd7 auto merge of #10691 : g3xzh/rust/benchm, r=cmr
I have written some benchmark tests to `push`, `push_many`, `join`,
`join_many` and `ends_with_path`.

Let me know what you think (@cmr).
Thanks in advance.
2013-11-27 19:47:15 -08:00
bors
db5b51ae63 auto merge of #10687 : alexcrichton/rust/issue-10686, r=thestinger
Turns out android doesn't support LLVM's thread_local attribute and accompanying
implementation.

Closes #10686
2013-11-27 18:32:30 -08:00
bors
503e5df3f2 auto merge of #10621 : Florob/rust/unicode63, r=cmr
This update the unicode.rs file to the latest Unicode version released 2013-09-30.
2013-11-27 16:47:14 -08:00
bors
d2c405eeff auto merge of #10642 : cmr/rust/strict_doccomment, r=alexcrichton
Previously, `//// foo` and `/*** foo ***/` were accepted as doc comments. This
changes that, so that only `/// foo` and `/** foo ***/` are accepted. This
confuses many newcomers and it seems weird.

Also update the manual for these changes, and modernify the EBNF for comments.

Closes #10638
2013-11-27 15:32:18 -08:00
Corey Richardson
b50b162884 Be more strict about doc comments
Previously, `//// foo` and `/*** foo ***/` were accepted as doc comments. This
changes that, so that only `/// foo` and `/** foo ***/` are accepted. This
confuses many newcomers and it seems weird.

Also update the manual for these changes, and modernify the EBNF for comments.

Closes #10638
2013-11-27 18:00:50 -05:00
Florian Zeitz
dfe38dbca4 Fix handling of upper/lowercase, and whitespace 2013-11-27 23:36:20 +01:00
Florian Zeitz
c234614950 Update Unicode data to version 6.3 2013-11-27 23:25:19 +01:00
Florian Zeitz
e9ab9bf01a Update unicode.py to reflect language changes 2013-11-27 23:21:22 +01:00
bors
d662820b29 auto merge of #10680 : alexcrichton/rust/relax-feature-gate, r=thestinger
Instead of forcibly always aborting compilation, allow usage of
 #[warn(unknown_features)] and related lint attributes to selectively abort
 compilation. By default, this lint is deny.
2013-11-27 14:17:41 -08:00