Commit Graph

23209 Commits

Author SHA1 Message Date
bors
0daced63fc auto merge of #9517 : crabtw/rust/cabi, r=nikomatsakis
I borrow some ideas from clang's ABIInfo.h and TargetInfo.cpp.
LLVMType is replaced with ArgType, which is similar to clang's ABIArgInfo,
and I also merge attrs of FnType into it.

Now ABI implementation doesn't need to insert hidden return pointer
to arg_tys of FnType. Instead it is handled in foreign.rs.

This change also fixes LLVM assertion failure when compiling MIPS target.
2013-10-10 19:56:22 -07:00
Alex Crichton
478c9b701e Add tests and un-xfail a few issues
Closes #4545
Closes #5791
Closes #6470
Closes #8044
2013-10-10 18:48:52 -07:00
bors
afa42a0237 auto merge of #9785 : catamorphism/rust/remove-convenience-tool, r=pcwalton
r? @pcwalton Sadly, there's a lack of resources for maintaining the `rust` tool,
and we decided in the 2013-10-08 Rust team meeting that it's better
to remove it altogether than to leave it in a broken state.

This deletion is without prejudice. If a person or people appear who
would like to maintain the tool, we will probably be happy to
resurrect it!

Closes #9775
2013-10-10 18:46:23 -07:00
Alex Crichton
b70306158f Remove named extern blocks from the AST
There's currently a fair amount of code which is being ignored on unnamed blocks
(which are the default now), and I opted to leave it commented out for now. I
intend on very soon revisiting on how we perform linking with extern crates in
an effort to support static linking.
2013-10-10 18:04:58 -07:00
bors
2e1df8e35b auto merge of #9732 : catamorphism/rust/rustpkg-read-only, r=brson
r? @metajack rustpkg now makes source files that it checks out automatically read-only, and stores
them under build/.

Also, refactored the `PkgSrc` type to keep track of separate source and destination
workspaces, as well as to have a `build_workspace` method that returns the workspace
to put temporary files in (usually the source, sometimes the destination -- see
comments for more details).

Closes #6480
2013-10-10 17:36:21 -07:00
Jyun-Yan You
95fc31ae9b improve C ABI
I borrow some ideas from clang's ABIInfo.h and TargetInfo.cpp.
LLVMType is replaced with ArgType, which is similar to clang's ABIArgInfo,
and I also merge attrs of FnType into it.

Now ABI implementation doesn't need to insert hidden return pointer
to arg_tys of FnType. Instead it is handled in foreign.rs.

This change also fixes LLVM assertion failure when compiling MIPS target.
2013-10-11 08:03:34 +08:00
bors
6ad1d0f861 auto merge of #9800 : vmx/rust/fix-random-doc, r=thestinger
The example for std::rand::random was still
using <float>, which got removed from Rust.
2013-10-10 16:26:20 -07:00
Tim Chevalier
8854b78b55 rustpkg: Make checked-out source files read-only, and overhaul where temporary files are stored
rustpkg now makes source files that it checks out automatically read-only, and stores
them under build/.

Also, refactored the `PkgSrc` type to keep track of separate source and destination
workspaces, as well as to have a `build_workspace` method that returns the workspace
to put temporary files in (usually the source, sometimes the destination -- see
comments for more details).

Closes #6480
2013-10-10 15:16:31 -07:00
bors
6aa5934e2b auto merge of #9798 : mtwilliams/rust/master, r=brson
I also removed superfluous trailing whitespace.

I don't think I need to run the test suite.
2013-10-10 14:36:34 -07:00
Tim Chevalier
a9dddbacde rust / build: Remove the rust tool
Sadly, there's a lack of resources for maintaining the `rust` tool,
and we decided in the 2013-10-08 Rust team meeting that it's better
to remove it altogether than to leave it in a broken state.

This deletion is without prejudice. If a person or people appear who
would like to maintain the tool, we will probably be happy to
resurrect it!

Closes #9775
2013-10-10 14:36:06 -07:00
Michael 'devbug' Williams
bcf76ac3ed Fixed typo under 'Segmented stacks and the linter', and removed superfluous trailing whitespace. 2013-10-10 14:00:15 -07:00
bors
8b8a41a287 auto merge of #9797 : alexcrichton/rust/snapshots, r=thestinger
Some bug fixes to reexported statics in stage0 now, also some macro attribute goodies. Mostly just updating the snapshot to help enable some things that its patches have been blocking.
2013-10-10 13:26:30 -07:00
Alex Crichton
97f87102fe Register new snapshots 2013-10-10 13:19:18 -07:00
Volker Mische
82f53d6dc5 Fix usage of <float> in docs
The example for std::rand::random was still
using <float>, which got removed from Rust.
2013-10-10 21:54:29 +02:00
bors
8015f9c27e auto merge of #9791 : alexcrichton/rust/reachable, r=catamorphism
This fixes a bug in which the visibility rules were approximated by
reachability, but forgot to cover the case where a 'pub use' reexports a private
item. This fixes the commit by instead using the results of the privacy pass of
the compiler to create the initial working set of the reachability pass.

This may have the side effect of increasing the size of metadata, but it's
difficult to avoid for correctness purposes sadly.

Closes #9790
2013-10-10 06:06:24 -07:00
Alex Crichton
caf7b678dd Add pub to all the codegen tests
Otherwise the test function is internalized and LLVM will most likely optimize
it out.
2013-10-10 06:00:51 -07:00
bors
0ede2ea4e2 auto merge of #9749 : alexcrichton/rust/less-io, r=brson
This implements a number of the baby steps needed to start eliminating everything inside of `std::io`. It turns out that there are a *lot* of users of that module, so I'm going to try to tackle them separately instead of bringing down the whole system all at once.

This pull implements a large amount of unimplemented functionality inside of `std::rt::io` including:

* Native file I/O (file descriptors, *FILE)
* Native stdio (through the native file descriptors)
* Native processes (extracted from `std::run`)

I also found that there are a number of users of `std::io` which desire to read an input line-by-line, so I added an implementation of `read_until` and `read_line` to `BufferedReader`.

With all of these changes in place, I started to axe various usages of `std::io`. There's a lot of one-off uses here-and-there, but the major use-case remaining that doesn't have a fantastic solution is `extra::json`. I ran into a few compiler bugs when attempting to remove that, so I figured I'd come back to it later instead. 

There is one fairly major change in this pull, and it's moving from native stdio to uv stdio via `print` and `println`. Unfortunately logging still goes through native I/O (via `dumb_println`). This is going to need some thinking, because I still want the goal of logging/printing to be 0 allocations, and this is not possible if `io::stdio::stderr()` is called on each log message. Instead I think that this may need to be cached as the `logger` field inside the `Task` struct, but that will require a little more workings to get right (this is also a similar problem for print/println, do we cache `stdout()` to not have to re-create it every time?).
2013-10-10 04:31:24 -07:00
Alex Crichton
413747176c Make the file::DirectoryInfo trait public
This was just a mistake that it was hidden.
2013-10-10 03:38:51 -07:00
Alex Crichton
2290ce14f2 Remove some users of io::file_reader 2013-10-10 03:38:51 -07:00
Alex Crichton
ff95904c48 Remove usage of io::FILE_writer 2013-10-10 03:38:51 -07:00
Alex Crichton
b07ab1fe4b Migrate users of io::fd_t to io::native::file::fd_t 2013-10-10 03:38:51 -07:00
Alex Crichton
2e0f3f5b51 Move std::run off of std::io
This changes the implementation to instead use rt::io::native::process as well
as an example of using those bindings.
2013-10-10 03:38:51 -07:00
Alex Crichton
ee1e6529bd Implement BufferedReader.{read_until, read_line}
These two functions will be useful when replacing various other counterparts
used by std::io consumers.
2013-10-10 03:38:51 -07:00
Alex Crichton
facefa7c8d Implement rt::io::stdio
Additionally, this moves the prelude imports of print/println from std::io to
std::rt::io.

Closes #6846
2013-10-10 03:38:51 -07:00
Alex Crichton
b0f6c29b4f Use the result of privacy for reachability
This fixes a bug in which the visibility rules were approximated by
reachability, but forgot to cover the case where a 'pub use' reexports a private
item. This fixes the commit by instead using the results of the privacy pass of
the compiler to create the initial working set of the reachability pass.

This may have the side effect of increasing the size of metadata, but it's
difficult to avoid for correctness purposes sadly.

Closes #9790
2013-10-10 03:31:59 -07:00
bors
34d123db4e auto merge of #9783 : huonw/rust/macro-items, r=bstrie
Fixes #4471.
2013-10-09 21:56:20 -07:00
bors
2b978af227 auto merge of #9780 : sfackler/rust/extensions2, r=alexcrichton
This works around #9779, but is probably the right thing to do anyways
since that's the module where all of the documentation for those traits
lives.
2013-10-09 20:46:21 -07:00
bors
8f4b87290b auto merge of #9774 : sebcrozet/rust/master, r=huonw
The minimum (negative) value of a float is `-Bounded::max_value()`, not `Bounded::min_value()`.
Otherwise the following has an incorrect behavior:

```rust
let a = -1.0f64;
let b: f32 = NumCast::from(a); // incorrectly returns None
```
2013-10-09 17:41:23 -07:00
Huon Wilson
4e0822e253 syntax: allow macros to expand to items with attributes.
Fixes #4471.
2013-10-10 09:57:37 +11:00
bors
2076959336 auto merge of #9750 : alexcrichton/rust/safer-strings, r=brson
This behavior was decided to get out-right forbidden by the compiler


Closes #8891
2013-10-09 15:31:26 -07:00
bors
11d5670647 auto merge of #9742 : alexcrichton/rust/issue-9739, r=brson
This changes an `assert_once_ever!` assertion to just a plain old assertion
around an atomic boolean to ensure that one particular runtime doesn't attempt
to exit twice.

Closes #9739
2013-10-09 14:21:38 -07:00
Alex Crichton
8fcf62b638 Don't abort if the runtime is run twice.
This changes an `assert_once_ever!` assertion to just a plain old assertion
around an atomic boolean to ensure that one particular runtime doesn't attempt
to exit twice.

Closes #9739
2013-10-09 12:38:18 -07:00
Alex Crichton
a0d2f71e8e Implement io::native::process 2013-10-09 11:24:15 -07:00
Alex Crichton
edf4c16997 Implement io::native::stdio 2013-10-09 11:21:47 -07:00
Alex Crichton
b509f7905a Implement io::native::file 2013-10-09 11:21:47 -07:00
bors
62812f1e38 auto merge of #9386 : Geal/rust/base64-doc, r=alexcrichton
Standard is now uppercase in the base64 module, and from_base64 now returns a Result
2013-10-09 10:41:31 -07:00
Alex Crichton
a69e4a55eb Forbid modifications of strings in the compiler
This disallows `str[0] = foo` along with `foo = &mut str[i]` to prevent strings
from being modified at runtime (except possibly through the `str` module)

Closes #8891
2013-10-09 10:34:35 -07:00
Geoffroy Couprie
0b4f052422 Correct code examples for base64 documentation 2013-10-09 18:36:51 +02:00
bors
4fd7f852e1 auto merge of #9748 : klutzy/rust/print-git-revision, r=alexcrichton
Fixes a bug that `rustc.exe -v` didn't show git revision hash.
The bug is caused by that `$(wildcard $(CFG_GIT))` requires
space-escaped inputs while `$(CFG_GIT)` is usually
`C:\Program Files (x86)\Gitin\git.exe`.
2013-10-09 09:31:36 -07:00
bors
2e64a718ea auto merge of #9664 : alexcrichton/rust/logging, r=huonw
This makes some headway on #3309, see commits for details.
2013-10-09 07:31:36 -07:00
bors
a3b04c1535 auto merge of #9359 : thestinger/rust/option, r=huonw
See #9355 for discussion.
2013-10-09 06:21:36 -07:00
Daniel Micay
6a90e80b62 option: rewrite the API to use composition 2013-10-09 09:17:29 -04:00
bors
f647ccc79c auto merge of #9695 : huonw/rust/rand2, r=alexcrichton
A pile of changes to `std::rand`:

- Add the 64-bit variant of the ISAAC Rng. This also splits the `Rng.next() -> u32` method into `Rng.next_u32() -> u32` and `Rng.next_u64() -> u64` to be able to actually take advantage of the wider numbers. They have default implementations in terms of each other. (This is ~2&times; faster than the 32 bit one for generating anything larger than a `u32` on 64-bit computers.)
- Add `ReaderRng` which just wraps a reader as an RNG, useful for `/dev/urandom`, `/dev/random`, `/dev/hwrng`, etc. This also adds the overrideable `fill_bytes` method to `Rng`, since readers can "generate" randomness more than just 8 bytes at a time.
- Add an interface to `/dev/urandom` (and the windows API) that implements `Rng` (`os::OSRng`) so that it is a first-class randomness source. This means that experimenting with things like seeding hashmaps from it will be much easier. It deletes most of the C++ supporting the old form, except for thin wrappers around the Windows API; I don't have access to a windows with Rust other than the try branch. ( **Note:** on unices, this means that `OSRng` requires the runtime, so it's not possible to use it to seed the scheduler RNG; I've replaced it with direct libc calls for reading from `/dev/urandom`.)
- Add the "blessed" `StdRng` which means users who just want a random number generator don't need to worry about the implementation details (which will make changing the underlying implementation from Isaac to something else will be easier, if this every happen). This actually changes between the 32 and 64-bit variants of Isaac depending on the platform at the moment.
- Add a `SeedableRng` trait for random number generators that can be explicitly seeded, 
- Add the `ReseedingRng` wrapper for reseeding a RNG after a certain amount of randomness is emitted. (The method for reseeding is controlled via the `Reseeder` trait from the same module)
- changes to the task rng: 
 - uses `StdRng`
 - it will reseed itself every 32KB, that is, after outputting 32KB of random data it will read new data from the OS (via `OSRng`)
- Implements `Rand` for `char`, and makes the `f32` and `f64` instances more reasonable (and more similar to most other languages I've looked at).
- Documentation, examples and tests
2013-10-09 05:11:33 -07:00
Huon Wilson
e678435cab std::rand: Minor clean-up of comments & add a missing default method. 2013-10-09 22:22:44 +11:00
Huon Wilson
5442a47362 std::rand: remove seed_task_rng and RUST_SEED. 2013-10-09 22:22:44 +11:00
Huon Wilson
62fededd8e std::rand: Make Rng.next_u32 non-default, waiting for #7771. 2013-10-09 22:22:44 +11:00
Huon Wilson
618c6afe32 std::rand::os: use the externfn! macro for the Windows RNG. 2013-10-09 22:22:44 +11:00
Huon Wilson
d86de18b61 std::rand::reseeding: seed the reseeder in the SeedableRng impl.
This stops us relying on Default here.
2013-10-09 22:22:43 +11:00
Huon Wilson
649c1759e8 std::rand::reader: describe cfg!(endianness). 2013-10-09 22:22:43 +11:00
Huon Wilson
38732c4b5c std::rand: Correct the implementation of Rand for f32 & f64. 2013-10-09 22:22:43 +11:00