Commit Graph

23635 Commits

Author SHA1 Message Date
Steven Fackler
ff859edb85 Ensure rustpkg test fails if tests failed
It previously set the exit status, but the main wrapper paved over that
with an exit code of 0.

Closes #9761
2013-11-03 22:23:47 -08:00
bors
556088cfb1 auto merge of #10251 : thestinger/rust/ptr, r=alexcritchton
This moves the per-architecture difference into the compiler.
2013-11-03 19:31:11 -08:00
Daniel Micay
67966fa9de simplify memcpy/memmove/memset intrinsics
This moves the per-architecture difference into the compiler.
2013-11-03 20:31:57 -05:00
bors
29359d0efa auto merge of #10252 : huonw/rust/docs, r=alexcrichton 2013-11-03 17:31:20 -08:00
bors
c4c2b38dae auto merge of #10248 : nibrahim/rust/docformatting, r=pcwalton
The code block shows up inline without proper formatting without this
newline.

Signed-off-by: Noufal Ibrahim <noufal@nibrahim.net.in>
2013-11-03 16:06:05 -08:00
Alex Crichton
f19d083362 Fill out the remaining functionality in io::file
This adds bindings to the remaining functions provided by libuv, all of which
are useful operations on files which need to get exposed somehow.

Some highlights:

* Dropped `FileReader` and `FileWriter` and `FileStream` for one `File` type
* Moved all file-related methods to be static methods under `File`
* All directory related methods are still top-level functions
* Created `io::FilePermission` types (backed by u32) that are what you'd expect
* Created `io::FileType` and refactored `FileStat` to use FileType and
  FilePermission
* Removed the expanding matrix of `FileMode` operations. The mode of reading a
  file will not have the O_CREAT flag, but a write mode will always have the
  O_CREAT flag.

Closes #10130
Closes #10131
Closes #10121
2013-11-03 15:15:42 -08:00
Alex Crichton
9c1851019f Remove all blocking std::os blocking functions
This commit moves all thread-blocking I/O functions from the std::os module.
Their replacements can be found in either std::rt::io::file or in a hidden
"old_os" module inside of native::file. I didn't want to outright delete these
functions because they have a lot of special casing learned over time for each
OS/platform, and I imagine that these will someday get integrated into a
blocking implementation of IoFactory. For now, they're moved to a private module
to prevent bitrot and still have tests to ensure that they work.

I've also expanded the extensions to a few more methods defined on Path, most of
which were previously defined in std::os but now have non-thread-blocking
implementations as part of using the current IoFactory.

The api of io::file is in flux, but I plan on changing it in the next commit as
well.

Closes #10057
2013-11-03 15:15:42 -08:00
Alex Crichton
7bf58c2baa Modify IoFactory's fs_mkdir, and add fs_rename
The invocation for making a directory should be able to specify a mode to make
the directory with (instead of defaulting to one particular mode). Additionally,
libuv and various OSes implement efficient versions of renaming files, so this
operation is exposed as an IoFactory call.
2013-11-03 15:15:41 -08:00
Alex Crichton
d7b6502784 Move rt::io traits into the prelude
These traits belong here, and were simply waiting for the std::io traits to get
removed. It's time they take their rightful positions!
2013-11-03 15:15:41 -08:00
Huon Wilson
da43676e39 docs: Replace std::iterator with std::iter. 2013-11-04 10:01:00 +11:00
bors
702767db65 auto merge of #10219 : alexcrichton/rust/drop-invoke, r=pcwalton
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-11-03 11:16:17 -08:00
Noufal Ibrahim
c118b89ad9 Fixed formatting.
The code block shows up inline without proper formatting without this
newline.

Signed-off-by: Noufal Ibrahim <noufal@nibrahim.net.in>
2013-11-03 22:44:15 +05:30
bors
dc079e1596 auto merge of #10143 : chris-morgan/rust/filename-consistency, r=huonw
New standards have arisen in recent months, mostly for the use of
rustpkg, but the main Rust codebase has not been altered to match these
new specifications. This changeset rectifies most of these issues.

- Renamed the crate source files `src/libX/X.rs` to `lib.rs`, for
  consistency with current styles; this affects extra, rustc, rustdoc,
  rustpkg, std, syntax.

- Renamed `X/X.rs` to `X/mod.rs,` as is now recommended style, for
  `std::num` and `std::terminfo`.

- Shifted `src/libstd/str/ascii.rs` out of the otherwise unused `str`
  directory, to be consistent with its import path of `std::ascii`;
  libstd is flat at present so it's more appropriate thus.

While this removes some `#[path = "..."]` directives, it does not remove
all of them, and leaves certain other inconsistencies, such as `std::u8`
et al. which are actually stored in `src/libstd/num/` (one subdirectory
down). No quorum has been reached on this issue, so I felt it best to
leave them all alone at present. #9208 deals with the possibility of
making libstd more hierarchical (such as changing the crate to match the
current filesystem structure, which would make the module path
`std::num::u8`).

There is one thing remaining in which this repository is not
rustpkg-compliant: rustpkg would have `src/std/` et al. rather than
`src/libstd/` et al. I have not endeavoured to change that at this point
as it would guarantee prompt bitrot and confusion. A change of that
magnitude needs to be discussed first.
2013-11-03 05:01:02 -08:00
Chris Morgan
0369a41f0e Rename files to match current recommendations.
New standards have arisen in recent months, mostly for the use of
rustpkg, but the main Rust codebase has not been altered to match these
new specifications. This changeset rectifies most of these issues.

- Renamed the crate source files `src/libX/X.rs` to `lib.rs`, for
  consistency with current styles; this affects extra, rustc, rustdoc,
  rustpkg, rustuv, std, syntax.

- Renamed `X/X.rs` to `X/mod.rs,` as is now recommended style, for
  `std::num` and `std::terminfo`.

- Shifted `src/libstd/str/ascii.rs` out of the otherwise unused `str`
  directory, to be consistent with its import path of `std::ascii`;
  libstd is flat at present so it's more appropriate thus.

While this removes some `#[path = "..."]` directives, it does not remove
all of them, and leaves certain other inconsistencies, such as `std::u8`
et al. which are actually stored in `src/libstd/num/` (one subdirectory
down). No quorum has been reached on this issue, so I felt it best to
leave them all alone at present. #9208 deals with the possibility of
making libstd more hierarchical (such as changing the crate to match the
current filesystem structure, which would make the module path
`std::num::u8`).

There is one thing remaining in which this repository is not
rustpkg-compliant: rustpkg would have `src/std/` et al. rather than
`src/libstd/` et al. I have not endeavoured to change that at this point
as it would guarantee prompt bitrot and confusion. A change of that
magnitude needs to be discussed first.
2013-11-03 23:49:01 +11:00
bors
318e1da4a7 auto merge of #10244 : thestinger/rust/abort, r=alexcrichton
The function is marked `noreturn`, so it shouldn't have this.
2013-11-03 00:46:01 -07:00
Daniel Micay
ddbd89b33e replace RetVoid with Unreachable to fix lint
The function is marked `noreturn`, so it shouldn't return.
2013-11-03 01:39:36 -05:00
bors
4910b7ac28 auto merge of #10242 : thestinger/rust/inline_dtor, r=alexcrichton
Closes #7793
2013-11-02 23:26:00 -07:00
bors
b5c1b48048 auto merge of #10199 : alexcrichton/rust/no-propagate, r=brson
This commit removes the propagation of `link_args` attributes across crates. The first commit message has the reasons as to why. Additionally, this starts statically linking some C/C++ helper libraries that we have to their respective crates instead of throwing then in librustrt and then having everything depend on librustrt.

The major downside of this movement is that we're losing the ability to control visible symbols. I couldn't figure out a way to internalize symbols from a static library during the linking process, so everyone who links to librustdoc will be able to use its sundown implementation (not exactly ideal). I'm not entirely sure how to fix this (beyond generating a list of all public symbols, including rust ones, and passing that to the linker), but we may have a much easier time with this once we start using llvm's linker toolchain.

There's certainly a lot more possibilities in where this can go, but I didn't want to go too deep just yet. The main idea here is to stop propagating linker arguments and then see how we're able to start statically linking libraries as a result.

r? @catamorphism, you're going to be working on linking soon, so feel free to completely throw this away for something else!
2013-11-02 22:16:02 -07:00
Matt Carberry
66abb92a47 Grammar error and vim syntax highlighting mistake fixed. 2013-11-02 21:34:29 -07:00
Alex Crichton
0ce1b2f04d Statically link libuv to librustuv
Similarly to the previous commit, libuv is only used by this library, so there's
no need for it to be linked into librustrt and available to all crates by
default.
2013-11-02 21:28:17 -07:00
Matt Carberry
519b86b8a8 Added octal literal support. 2013-11-02 21:26:29 -07:00
Daniel Micay
e58270219f fix cross-crate destructor inlining
Closes #7793
2013-11-02 23:55:23 -04:00
bors
a248e34fc7 auto merge of #10235 : mletterle/rust/issue-9226, r=jdm
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 18:22:18 -07:00
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