Commit Graph

23662 Commits

Author SHA1 Message Date
Michael Letterle
ca2f3028e9 Updated debugging metadata for ty_nil and ty_bot
ty_nil will now report as "()" in gdb
ty_bot will now report as "!" in gdb

Added test to confirm basic types debugging metadata.

This fixes #9226
2013-11-02 19:35:35 -04:00
bors
e0c01ca153 auto merge of #10165 : dcrewi/rust/missing-doc-on-private-trait, r=cmr
Fixes #10069.
2013-11-02 12:11:18 -07:00
bors
3899f8da6b auto merge of #10217 : alexcrichton/rust/less-reachable, r=pcwalton
Previously, all functions called by a reachable function were considered
reachable, but this is only the case if the original function was possibly
inlineable (if it's type generic or #[inline]-flagged).
2013-11-02 11:01:16 -07:00
bors
22dfdc927b auto merge of #10233 : sfackler/rust/private-module, r=alexcrichton
A private module will survive the strip-private pass if it contains
trait implementations, which aren't stripped until a separate pass in
render.
2013-11-02 03:11:10 -07:00
bors
95b18335da auto merge of #10230 : alexcrichton/rust/snapshots, r=brson
Closes #2240
2013-11-02 02:01:25 -07:00
bors
9ec4c1851a auto merge of #10229 : brson/rust/warnings, r=thestinger
In Rust we don't like capital letters.
2013-11-02 00:51:12 -07:00
bors
6879c8b382 auto merge of #10225 : Jurily/rust/master, r=alexcrichton 2013-11-01 23:36:10 -07:00
Steven Fackler
ea9432ef00 Rustdoc: Properly strip private modules
A private module will survive the strip-private pass if it contains
trait implementations, which aren't stripped until a separate pass in
render.
2013-11-01 23:32:58 -07:00
bors
57627b1e2f auto merge of #10232 : brson/rust/destdir, r=thestinger 2013-11-01 21:56:13 -07:00
Alex Crichton
7f31b079e5 Statically link sundown to librustdoc
Closes #10103
2013-11-01 21:28:48 -07:00
Alex Crichton
2b9c7742b9 Stop propagating link arguments across crates
This is a fairly brittle modle that doesn't scale well across many crates. It's
unlikely that all of the downstream crates will have all of the original native
dependencies of all the upstream crates. In the case that FFI functions are
reachable, then it should be the responsibility of the downstream crate to link
against the correct library, or the upstream crate should prevent the functions
from being reachable.
2013-11-01 21:28:47 -07:00
bors
2456272626 auto merge of #10222 : nibrahim/rust/docfix, r=brson
Earlier versions of pandoc don't have the `default.html5` template file. When `make docs` is run, the build process fails with this message.

    pandoc: doc/rust.html
    pandoc: /usr/share/pandoc-1.8.2.1/templates/default.html5: openFile: does not exist (No such file or directory)
    
    node.js:201
            throw e; // process.nextTick error, or 'error' event on first tick
                  ^
    Error: write EPIPE
        at errnoException (net.js:670:11)
        at Object.afterWrite [as oncomplete] (net.js:503:19)
    make: *** [doc/rust.html] Error 1
2013-11-01 20:46:18 -07:00
Brian Anderson
758af60334 Fix installation with DESTDIR 2013-11-01 20:23:22 -07:00
bors
c15038db08 auto merge of #10223 : huonw/rust/gamma, r=cmr
Implements the [Gamma distribution](https://en.wikipedia.org/wiki/Gamma_distribution), using the algorithm described by Marsaglia & Tsang 2000[1]. I added tests checking that the mean and variance of this implementation is as expected for a range of values of the parameters in 5d87c00a0f (they pass locally, but obviously won't even build on Travis until this is merged).

Also, moves `std::rand::distributions` to a subfolder, and performs a minor clean-up of the benchmarking (makes the number of iterations shared by the whole `std::rand` subtree).

[1]: George Marsaglia and Wai Wan Tsang. 2000. "A Simple Method for Generating Gamma Variables" *ACM Trans. Math. Softw.* 26, 3 (September 2000), 363-372. DOI:[10.1145/358407.358414](http://doi.acm.org/10.1145/358407.358414).
2013-11-01 18:36:42 -07:00
Alex Crichton
9df164c145 Register new snapshots
Closes #2240
2013-11-01 16:51:33 -07:00
bors
894c1f6398 auto merge of #10215 : brson/rust/rustctask, r=thestinger 2013-11-01 16:16:26 -07:00
Brian Anderson
e9605dc0c9 Use consistent capitalization in makefile errors
In Rust we don't like capital letters.
2013-11-01 15:28:12 -07:00
Noufal Ibrahim
60cb1fb4d1 Bump required pandoc version to 1.9.
Earlier versions of pandoc don't have the default.html5 and thus,
building the docs fail.

Signed-off-by: Noufal Ibrahim <noufal@nibrahim.net.in>
2013-11-02 02:08:43 +05:30
bors
8ea2123055 auto merge of #10220 : luqmana/rust/con, r=brson
Previously we were actually overwriting `CFG_{HOST,TARGET,BUILD}` with `CFG_{HOST,TARGET,BUILD}_TRIPLE(S)` since configure tested for the legacy one by checking if it was empty which would never be the case. That meant it wouldn't split up multiple triples and just treat it as one long triple.

This pull also fixes the rules that were changed when librustuv was added to use the right CFG_ vars and removes the legacy flags.
2013-11-01 12:46:21 -07:00
Alex Crichton
b00449380f Remove unnecessary unwind messages
Now that the type_id intrinsic is working across crates, all of these
unnecessary messages can be removed to have the failure type for a task truly be
~Any and only ~Any
2013-11-01 11:58:25 -07:00
bors
fa2bb970d1 auto merge of #10204 : alexcrichton/rust/better-names, r=brson
Tests now have the same name as the test that they're running (to allow for
easier diagnosing of failure sources), and the main task is now specially named
`<main>` instead of `<unnamed>`.

Closes #10195
Closes #10073
2013-11-01 11:31:32 -07:00
Luqman Aden
d9decf30bd configure: Remove legacy triple flags. 2013-11-01 14:21:48 -04:00
Alex Crichton
61637439dc Add a type_id intrinsic
Closes #9913
2013-11-01 10:31:33 -07:00
bors
7cff3c74b8 auto merge of #10119 : Kimundi/rust/option_and_generic, r=alexcrichton
This takes the last reforms on the `Option` type and applies them to `Result` too. For that, I reordered and grouped the functions in both modules, and also did some refactorings:

- Added `as_ref` and `as_mut` adapters to `Result`.
- Renamed `Result::map_move` to `Result::map` (same for `_err` variant), deleted other map functions. 
- Made the `.expect()` methods be generic over anything you can
  fail with.
- Updated some doc comments to the line doc comment style
- Cleaned up and extended standard trait implementations on `Option` and `Result`
- Removed legacy implementations in the `option` and `result` module
2013-11-01 09:36:25 -07:00
Alex Crichton
e2a68b6867 Give test and main tasks better names
Tests now have the same name as the test that they're running (to allow for
easier diagnosing of failure sources), and the main task is now specially named
<main> instead of <unnamed>.

Closes #10195
Closes #10073
2013-11-01 09:16:11 -07:00
Gyorgy Andrasek
0f66856e53 Fix typo in to_digit 2013-11-01 17:13:43 +01:00
bors
3a15482b9c auto merge of #10218 : alexcrichton/rust/stdio-flush-safe, r=cmr
The previous method was unsound because you could very easily create two mutable
pointers which alias the same location (not sound behavior). This hides the
function which does so and then exports an explicit flush() function (with
documentation about how it works).
2013-11-01 08:26:24 -07:00
Marvin Löbel
415a04315e Fixed unused import warning in tests 2013-11-01 15:37:29 +01:00
Marvin Löbel
45fe20515c Removed legacy implementations 2013-11-01 15:01:56 +01:00
Marvin Löbel
c22e7f02d1 Cleaned up the option and result module in more detail
Made both types implement more standard traits in a nicer way

Derived more traits
2013-11-01 15:01:56 +01:00
Marvin Löbel
0d92c53f4a Reordered the methods in std::Option and std::Result
Cleaned up the source in a few places

Renamed `map_move` to `map`, removed other `map` methods

Added `as_ref` and `as_mut` adapters to `Result`

Added `fmt::Default` impl
2013-11-01 15:00:46 +01:00
bors
a300314827 auto merge of #10213 : telotortium/rust/rand-fill_bytes-stack-overflow, r=huonw
Fix the implementation of `std::rand::Rng::fill_bytes()` for
`std::rand::reseeding::ReseedingRng` to call the `fill_bytes()` method
of the underlying RNG rather than itself, which causes infinite
recursion.

Fixes #10202.
2013-11-01 05:21:24 -07:00
Huon Wilson
3c25baa540 std::rand: share the benchmark counter among the whole module tree. 2013-11-01 22:09:06 +11:00
Huon Wilson
cd50fb39b5 std::rand: Implement the Gamma distribution. 2013-11-01 22:09:06 +11:00
bors
04c58c9f81 auto merge of #10205 : brson/rust/unnamed_addr, r=thestinger 2013-11-01 04:06:23 -07:00
Huon Wilson
701b4d137e std::rand: Move distributions to a subfolder. 2013-11-01 21:47:07 +11:00
bors
fa8a202858 auto merge of #10203 : kud1ing/rust/ios, r=alexcrichton
This is based on the work by @dobkeratops, updated and extended to work for Xcode 5.

This gets you going. I will add separate PRs for compilation/linking fixes.
See also https://github.com/mozilla/rust/wiki/Doc-building-for-ios
2013-11-01 02:26:23 -07:00
bors
986d1f78be auto merge of #10196 : huonw/rust/fix-zig, r=alexcrichton
The code was using (in the notation of Doornik 2005) `f(x_{i+1}) -
f(x_{i+2})` rather than `f(x_i) - f(x_{i+1})`. This corrects that, and
removes the F_DIFF tables which caused this problem in the first place.

They `F_DIFF` tables are a micro-optimisation (in theory, they could
easily be a micro-pessimisation): that `if` gets hit about 1% of the
time for Exp/Normal, and the rest of the condition involves RNG calls
and a floating point `exp`, so it is unlikely that saving a single FP
subtraction will be very useful (especially as more tables means more
memory reads and higher cache pressure, as well as taking up space in
the binary (although only ~2k in this case)).

Closes #10084. Notably, unlike that issue suggests, this wasn't a
problem with the Exp tables. It affected Normal too, but since it is
symmetric, there was no bias in the mean (as the bias was equal on the
positive and negative sides and so cancelled out) but it was visible as
a variance slightly lower than it should be.

New plot:

![exp-density](https://f.cloud.github.com/assets/1203825/1445796/42218dfe-422a-11e3-9f98-2cd146b82b46.png)

I've started writing some tests in [huonw/random-tests](https://github.com/huonw/random-tests) (not in the main repo because they can and do fail occasionally, due to randomness, but it is on Travis and Rust-CI so it will hopefully track the language), unsurprisingly, they're [currently failing](https://travis-ci.org/huonw/random-tests/builds/13313987) (note that both exp and norm are failing, the former due to both mean and variance the latter due to just variance), but pass at the 0.01 level reliably with this change.

(Currently the only test is essentially a quantitative version of the plots I've been showing, which is run on the `f64` `Rand` instance (uniform 0 to 1), and the Normal and Exp distributions.)
2013-11-01 01:16:22 -07:00
Luqman Aden
12222f9825 configure: Fix passing multiple target and host triples. 2013-11-01 03:34:16 -04:00
Alex Crichton
e35cd962a6 Drop struct fields if the user destructor fails
This commit changes drop glue generated for structs to use the invoke LLVM
instruction instead of call. What this means is that if the user destructor
triggers an unwinding, then the fields of the struct will still ge dropped.

This is not an attempt to support failing while failing, as that's mostly a
problem of runtime support. This is more of an issue of soundness in making sure
that destructors are appropriately run. The test included fails before this
commit, and only has one call to fail!(), yet it doesn't destroy its struct
fields.
2013-10-31 23:31:11 -07:00
bors
41ffc90e98 auto merge of #10187 : pcwalton/rust/remove-mocks, r=pcwalton
r? @alexcrichton
2013-10-31 22:26:24 -07:00
Alex Crichton
8f258ab532 Provide a sound method of flushing stdout
The previous method was unsound because you could very easily create two mutable
pointers which alias the same location (not sound behavior). This hides the
function which does so and then exports an explicit flush() function (with
documentation about how it works).
2013-10-31 22:09:48 -07:00
Alex Crichton
681fda0169 Reduce the aggressiveness of reachability
Previously, all functions called by a reachable function were considered
reachable, but this is only the case if the original function was possibly
inlineable (if it's type generic or #[inline]-flagged).
2013-10-31 20:47:23 -07:00
bors
1bbd4afb4a auto merge of #10181 : brson/rust/managed_boxes, r=thestinger 2013-10-31 20:36:17 -07:00
Brian Anderson
c874e64aa6 Name the rustc task 'rustc' 2013-10-31 20:08:17 -07:00
Robert Irelan
96589e7264 Fix infinite recursion in fill_bytes()
Fix the implementation of `std::rand::Rng::fill_bytes()` for
`std::rand::reseeding::ReseedingRng` to call the `fill_bytes()` method
of the underlying RNG rather than itself, which causes infinite
recursion.

Fixes #10202.
2013-10-31 21:19:47 -05:00
bors
d04a58cf2d auto merge of #9740 : alexcrichton/rust/concat, r=cmr
This extension can be used to concatenate string literals at compile time. C has
this useful ability when placing string literals lexically next to one another,
but this needs to be handled at the syntax extension level to recursively expand
macros.

The major use case for this is something like:

    macro_rules! mylog( ($fmt:expr $($arg:tt)*) => {
        error2!(concat!(file!(), ":", line!(), " - ", $fmt) $($arg)*);
    })

Where the mylog macro will automatically prepend the filename/line number to the
beginning of every log message.
2013-10-31 17:51:26 -07:00
bors
23df6f9775 auto merge of #10206 : brson/rust/configure, r=brson 2013-10-31 15:36:36 -07:00
Brian Anderson
424e91a47d Fix fallback configuration flags 2013-10-31 15:27:54 -07:00
Brian Anderson
2992720c9b Declare all Rust functions as unnamed_addr. Closes #8957 2013-10-31 14:53:22 -07:00