Commit Graph

22393 Commits

Author SHA1 Message Date
Erick Tryzelaar
5ab843fbc3 std: Remove Option.or_{default,zero}
These can be replaced with `Some(option.or_default())`.
2013-09-17 19:50:41 -07:00
bors
460021bdf2 auto merge of #9269 : alexcrichton/rust/ignore-rustpkg-test, r=brson
@catamorphism says he has a fix coming soon, so I didn't allocate an issue for
it. If it festers for more than a few days I'll open something up though.
2013-09-17 17:15:45 -07:00
Alex Crichton
3b07f1efe5 Ignore a test which is blocking a snapshot
@catamorphism says he has a fix coming soon, so I didn't allocate an issue for
it. If it festers for more than a few days I'll open something up though.
2013-09-17 17:11:15 -07:00
bors
0efc4822e9 auto merge of #9257 : alexcrichton/rust/better-address-insignificant, r=thestinger
If a static is flagged as address_insignificant, then for LLVM to actually
perform the relevant optimization it must have an internal linkage type. What
this means, though, is that the static will not be available to other crates.
Hence, if you have a generic function with an inner static, it will fail to link
when built as a library because other crates will attempt to use the inner
static externally.

This gets around the issue by inlining the static into the metadata. The same
relevant optimization is then applied separately in the external crate. What
this ends up meaning is that all statics tagged with #[address_insignificant]
will appear at most once per crate (by value), but they could appear in multiple
crates.

This should be the last blocker for using format! ...
2013-09-17 15:20:44 -07:00
bors
c135cb2683 auto merge of #9235 : olsonjeffery/rust/newrt_file_io_1, r=thestinger
A quick rundown:

- added `file::{readdir, stat, mkdir, rmdir}`
- Added access-constrained versions of `FileStream`; `FileReader` and `FileWriter` respectively
- big rework in `uv::file` .. most actions are by-val-self methods on `FsRequest`; `FileDescriptor` has gone the way of the dinosaurs
- playing nice w/ homing IO (I just copied ecr's work, hehe), etc
- added `FileInfo` trait, with an impl for `Path`
  - wrapper for file-specific actions, with the file path always implied by self's value
  - has the means to create `FileReader` & `FileWriter` (this isn't exposed in the top-level free function API)
  - has "safe" wrappers for `stat()` that won't throw in the event of non-existence/error (in this case, I mean `is_file` and `exists`)
  - actions should fail if done on non-regular-files, as appropriate
- added `DirectoryInfo` trait, with an impl for `Path`
  - pretty much ditto above, but for directories
  - added `readdir` (!!) to iterate over entries in a dir as a `~[Path]` (this was *brutal* to get working)

...<del>and lots of other stuff</del>not really. Do your worst!
2013-09-17 14:05:45 -07:00
bors
9e8fb4ad61 auto merge of #9256 : thestinger/rust/drop, r=alexcrichton 2013-09-17 12:50:46 -07:00
Alex Crichton
9adcbac30d Prevent a rare linkage issue with an xcrate static
If a static is flagged as address_insignificant, then for LLVM to actually
perform the relevant optimization it must have an internal linkage type. What
this means, though, is that the static will not be available to other crates.
Hence, if you have a generic function with an inner static, it will fail to link
when built as a library because other crates will attempt to use the inner
static externally.

This gets around the issue by inlining the static into the metadata. The same
relevant optimization is then applied separately in the external crate. What
this ends up meaning is that all statics tagged with #[address_insignificant]
will appear at most once per crate (by value), but they could appear in multiple
crates.

This should be the last blocker for using format! ...
2013-09-17 11:24:05 -07:00
Jeff Olson
70152ff557 std: fix win32 build issue re: multistring parsing 2013-09-17 11:15:33 -07:00
bors
023aab453c auto merge of #9236 : steveklabnik/rust/rustpkg_init, r=catamorphism
Closes #9045

Built on top of #9235, which isn't strictly needed for now, but I imagine I will use part of. Unsure.

I mostly wanted to start this off to get some feedback from @catamorphism and others. These are the directories that actually need made, but I was thinking about adding a few other things:

1. an `examples` directory, since it seems like that's a common pattern
2. a `.gitignore` file that ignores `build`. And anything else that makes sense
3. a sample module that'd actually compile


Feedback?
2013-09-17 11:00:46 -07:00
Steve Klabnik
77bbf23b4a Implementing 'rustpkg init'.
This will initialize a new workspace.
2013-09-17 10:53:32 -07:00
Jeff Olson
a5275ffd5c std: whitespace clean up io::file docs 2013-09-17 10:14:15 -07:00
Daniel Micay
befc561fa4 remove unnecessary transmutes 2013-09-17 11:54:37 -04:00
bors
72e7c62ec4 auto merge of #9245 : kballard/rust/bytes-span, r=catamorphism
This constrains the span to the appropriate argument, so you know which
one caused the problem. Instead of

    foo.rs:2:4: 2:21 error: Too large integer literal in bytes!
    foo.rs:2    bytes!(1, 256, 2)
                ^~~~~~~~~~~~~~~~~

it will say

    foo.rs:2:14 2:17 error: Too large integer literal in bytes!
    foo.rs:2    bytes!(1, 256, 2)
                          ^~~
2013-09-17 08:45:44 -07:00
Jeff Olson
5d9932fddb std: fix win32 build error in os::env() 2013-09-17 08:40:31 -07:00
Jeff Olson
3067ee6373 std: remove RtioStream 2013-09-17 08:01:44 -07:00
bors
29cdf58861 auto merge of #9244 : thestinger/rust/drop, r=catamorphism
This doesn't close any bugs as the goal is to convert the parameter to by-value, but this is a step towards being able to make guarantees about `&T` pointers (where T is Freeze) to LLVM.
2013-09-17 07:15:42 -07:00
bors
f45c6406bc auto merge of #9241 : alexcrichton/rust/build-rustdoc-ng, r=catamorphism
Now rustdoc_ng will be built as both a binary and a library (using the same
rules as all the other binaries that rust has). Furthermore, this will also
start building rustdoc_ng unit tests (and running them).

Note that some `rustdoc_ng` tests were removed, but @cmr says they weren't supposed to be there in the first place. The rustdoc_ng code should also be included in `make install` and `make dist` now.
2013-09-17 06:00:45 -07:00
bors
7ea85333ff auto merge of #9239 : steveklabnik/rust/rustpkg_tutorial, r=catamorphism
First shot at a new tutorial for rustpkg. /cc @catamorphism

Right now, I'm linking to my sample package on GitHub, I'm not sure that everyone would be comfortable with me having that there. Maybe under the mozilla org? I think having one to install and hold up as a default makes sense.
2013-09-17 04:45:45 -07:00
bors
2a706aab1c auto merge of #9234 : steveklabnik/rust/rustpkg_manpage, r=cmr
Closes #9221.

"rustpkg test" isn't implemented yet, so it shouldn't be in the manpage. Referring interested parties to the manual is probably
the right thing for now; eventually, these documents should merge.

/cc @catamorphism
2013-09-17 03:30:48 -07:00
bors
07e821aa6b auto merge of #9225 : huonw/rust/closing-time, r=alexcrichton
Closes #2074.
Closes #5008.
Closes #7519.
Closes #7673.
Closes #7770.
Closes #8171.
2013-09-17 02:15:49 -07:00
Huon Wilson
4f92f452bd Tests for fixed issues.
Closes #2074.
Closes #5008.
Closes #7519.
Closes #7673.
Closes #7770.
Closes #8171.
2013-09-17 18:02:44 +10:00
bors
6055611af6 auto merge of #9214 : adridu59/rust/issue-7723, r=thestinger
This avoids default CRLF on msysgit for Windows which can cause trouble.
Cf. https://help.github.com/articles/dealing-with-line-endings#text-eollf

Closes #7723.
2013-09-17 01:00:47 -07:00
bors
d1c05504ba auto merge of #9130 : alexcrichton/rust/inline-globals, r=thestinger
In #8185 cross-crate condition handlers were fixed by ensuring that globals
didn't start appearing in different crates with different addressed. An
unfortunate side effect of that pull request is that constants weren't inlined
across crates (uint::bits is unknown to everything but libstd).

This commit fixes this inlining by using the `available_eternally` linkage
provided by LLVM. It partially reverts #8185, and then adds support for this
linkage type. The main caveat is that not all statics could be inlined into
other crates. Before this patch, all statics were considered "inlineable items",
but an unfortunate side effect of how we deal with `&static` and `&[static]`
means that these two cases cannot be inlined across crates. The translation of
constants was modified to propogate this condition of whether a constant
should be considered inlineable into other crates.

Closes #9036
2013-09-16 23:45:49 -07:00
Jeff Olson
c0ec40f74b std: merge conflict cleanup from std::str 2013-09-16 23:39:33 -07:00
Jeff Olson
95ef1f5415 std: docstring fixes in io::file 2013-09-16 23:36:39 -07:00
Jeff Olson
56c87ffb30 std: minor cleanup in some io_error descs in io::file 2013-09-16 23:19:24 -07:00
Jeff Olson
d3ed9a9e3b std: lots of docs for std::rt::io::file
i hope they don't bitrot
2013-09-16 23:19:24 -07:00
Jeff Olson
60ba17098b std: FsRequest.req_boilerplate() be &mut self 2013-09-16 23:19:24 -07:00
Jeff Olson
a87ff60f49 std: remove impl'd/commented-out fstat signatures 2013-09-16 23:19:24 -07:00
Jeff Olson
e9acdd9392 std: generlize & move io::file::suppressed_stat to io::ignore_io_error 2013-09-16 23:19:24 -07:00
Jeff Olson
52840a5bbc std: correctly pass STDOUT in to naive_print test fn 2013-09-16 23:19:24 -07:00
Jeff Olson
e741449ea1 std: unignore some file io tests that work on windows, now 2013-09-16 23:19:24 -07:00
Jeff Olson
bf399d558e std: bind uv_fs_readdir(), flesh out DirectoryInfo and docs/cleanup 2013-09-16 23:19:24 -07:00
Jeff Olson
25b4d8c1d7 std: expose more stat info 2013-09-16 23:19:23 -07:00
Jeff Olson
63182885d8 std: more work on from_c_multistring.. let it take an optional len param 2013-09-16 23:19:23 -07:00
Jeff Olson
71c7798d66 std: clean up Dir/FileInfo inheritence and flesh out Dir Info 2013-09-16 23:17:47 -07:00
Jeff Olson
daf4974628 std: win32 os::env() str parsing to str::raw::from_c_multistring + test 2013-09-16 23:17:46 -07:00
Jeff Olson
b49fc4cf4e std: adding file::{stat,mkdir,rmdir}, FileInfo and FileReader/FileWriter
add ignores for win32 tests on previous file io stuff...
2013-09-16 23:17:46 -07:00
Jeff Olson
055488df1a merge cleanup 2013-09-16 23:17:46 -07:00
Jeff Olson
af650572e0 std/rt: in-progress file io work
std: remove unneeded field from RequestData struct

std: rt::uv::file - map us_fs_stat & start refactoring calls into FsRequest

std: stubbing out stat calls from the top-down into uvio

std: us_fs_* operations are now by-val self methods on FsRequest

std: post-rebase cleanup

std: add uv_fs_mkdir|rmdir + tests & minor test cleanup in rt::uv::file

WORKING: fleshing out FileStat and FileInfo + tests

std: reverting test files..

refactoring back and cleanup...
2013-09-16 23:17:46 -07:00
bors
66ecff2b13 auto merge of #9237 : brson/rust/valgrind, r=thestinger
This fixes valgrind on the linux snapshot bot. The command added here
makes us require a fairly recent valgrind.
2013-09-16 22:30:51 -07:00
bors
b75e07501b auto merge of #9233 : catamorphism/rust/issue-4208, r=catamorphism
Closes #4208
2013-09-16 21:15:51 -07:00
bors
d5e9033a0d auto merge of #9108 : blake2-ppc/rust/hazards-on-overflow, r=alexcrichton
Fix uint overflow bugs in std::{at_vec, vec, str}

Closes #8742

Fix issue #8742, which summarized is: unsafe code in vec and str did assume
that a reservation for `X + Y` elements always succeeded, and didn't overflow.

Introduce the method `Vec::reserve_additional(n)` to make it easy to check for
overflow in `Vec::push` and `Vec::push_all`.

In std::str, simplify and remove a lot of the unsafe code and use `push_str`
instead. With improvements to `.push_str` and the new function
`vec::bytes::push_bytes`, it looks like this change has either no or positive
impact on performance.

I believe there are many places still where `v.reserve(A + B)` still can overflow.
This by itself is not an issue unless followed by (unsafe) code that steps aside
boundary checks.
2013-09-16 19:35:50 -07:00
Daniel Micay
4e161a4d40 switch Drop to &mut self 2013-09-16 22:19:23 -04:00
Kevin Ballard
b0647feab0 Limit spans in bytes!() error messages to the argument in question
This constrains the span to the appropriate argument, so you know which
one caused the problem. Instead of

  foo.rs:2:4: 2:21 error: Too large integer literal in bytes!
  foo.rs:2    bytes!(1, 256, 2)
              ^~~~~~~~~~~~~~~~~

it will say

  foo.rs:2:14 2:17 error: Too large integer literal in bytes!
  foo.rs:2    bytes!(1, 256, 2)
                        ^~~
2013-09-16 18:55:56 -07:00
Steve Klabnik
cf2253ba3f Updating rustpkg tutorial from feedback. 2013-09-16 18:49:47 -07:00
Alex Crichton
876cb76f1b Add the rustdoc_ng binary to the makefile rules
Now rustdoc_ng will be built as both a binary and a library (using the same
rules as all the other binaries that rust has). Furthermore, this will also
start building rustdoc_ng unit tests (and running them).
2013-09-16 18:10:46 -07:00
bors
2f96c22a21 auto merge of #9231 : cmr/rust/enum_encoding, r=catamorphism 2013-09-16 17:55:46 -07:00
blake2-ppc
e211888407 std::at_vec: Fix segfault on overflow when resizing ~[@T]
Easy to reproduce:

    let mut v = ~[@1];
    v.resize(-1);  // success a.k.a silent failure
    v.push(@2); // segfault
2013-09-17 02:48:00 +02:00
blake2-ppc
6e538edea2 rt::io: Use vec::reserve_additional 2013-09-17 02:48:00 +02:00