Commit Graph

23843 Commits

Author SHA1 Message Date
Alex Crichton
7bc092f109 Introduce an io::Buffer trait
This trait is meant to abstract whether a reader is actually implemented with an
underlying buffer. For all readers which are implemented as such, we can
efficiently implement things like read_char, read_line, read_until, etc. There
are two required methods for managing the internal buffer, and otherwise
read_line and friends can all become default methods.

Closes #10334
2013-11-13 11:36:13 -08:00
Zach Kamsler
c2c7a2497d Implemented BufWriter
Filled in the implementations of Writer and Seek for BufWriter. It
raises the io_error condition if a write cannot fit in the buffer.

The Seek implementation for MemWriter, which was incorrectly using
unsigned arithmatic to add signed offsets, has also been replaced.
2013-11-13 14:22:03 -05:00
bors
314d6f693f auto merge of #10277 : dcrewi/rust/missing-doc-and-visibility-rules, r=alexcrichton
Now the privacy pass returns enough information that other passes do not need to duplicate the visibility rules, and the missing_doc implementation is more consistent with other lint checks.
2013-11-13 10:16:29 -08:00
David Creswick
1f7eb4f9aa make missing_doc lint respect the visibility rules
Previously, the `exported_items` set created by the privacy pass was
incomplete. Specifically, it did not include items that had been defined
at a private path but then `pub use`d at a public path. This commit
finds all crate exports during the privacy pass. Consequently, some code
in the reachable pass and in rustdoc is no longer necessary. This commit
then removes the separate `MissingDocLintVisitor` lint pass, opting to
check missing_doc lint in the same pass as the other lint checkers using
the visibility result computed by the privacy pass.

Fixes #9777.
2013-11-13 11:31:59 -06:00
Benjamin Peterson
d328ab765b be more robust when removing download artifacts and remove bogus raise statement 2013-11-13 12:02:50 -05:00
Adrien Tétar
3d57b240ab doc: tidy up makefile rules 2013-11-13 09:40:45 +01:00
Adrien Tétar
58aa18c8ba doc: add favicon to tutorial/manual
Since tutorial/manual files are stored on static.rust-lang.org, browsers
try to fetch the favicon from there while it should be retrieved from the
main domain.
2013-11-13 09:32:50 +01:00
Adrien Tétar
5a01dbe67b doc: disable parser error highlighting + a few fixes
CodeMirror parser errors are related to #9873.
2013-11-13 09:32:29 +01:00
Zack Corr
57486994d5 Add build_lib_with_cfgs, build_bin_with_cfgs to rustpkg API. Closes #9944. 2013-11-13 14:54:17 +10:00
bors
825b127d47 auto merge of #10441 : cmr/rust/bench_bufferedstream, r=alexcrichton
https://github.com/mozilla/rust/pull/10424 did optimizations without adding a
way to measure their effect and ensure no regressions. This fixes that.
2013-11-12 18:56:13 -08:00
Corey Richardson
67692b21b5 io: benchmarks for creation of the various Buffered objects 2013-11-12 21:51:15 -05:00
bors
1bfa45cfd9 auto merge of #10342 : catamorphism/rust/rustpkg-dir-checking-and-monitor, r=erickt
r? @brson
2013-11-12 16:41:14 -08:00
Tim Chevalier
65aacd083a rustpkg: Eliminate the spurious os::path_exists(&pkg_src.start_dir.join(p)) assertion failure
This addresses the problem reported in #10253 and possibly elsewhere.

Closes #10253
2013-11-12 15:32:31 -08:00
bors
2d6952e54a auto merge of #10410 : willingc/rust/shoot-done, r=huonw
...e.

Cleaned up unneeded imports and type changes to resolve compiler warnings.

Work in process
2013-11-12 15:31:21 -08:00
Carol W
33ee4335b9 Fixed xfail for nbody shootout benchmark by correcting command line parse.
Cleaned up unneeded imports and type changes to resolve compiler warnings.
2013-11-12 15:14:07 -08:00
Adrien Tétar
123e0cefb6 doc: CSS: fix code fonts
Closes #10330.
2013-11-12 21:36:09 +01:00
bors
3b0d48634f auto merge of #10427 : alexcrichton/rust/no-xray, r=brson
Just a few triage issues that I ran into.
2013-11-12 12:16:21 -08:00
Alex Crichton
b9b908f62f Make a time test less flaky
This test was failing periodically on windows and other platforms, and in
debugging the issue locally I've found that the previous test was failing
at the assertion `ns0 <= ns1`. Upon inspecting the values, the two numbers were
very close to one another, but off by a little bit.

I believe that this is because `precise_time_s` goes from `u64` -> `f64` and
then we go again back to `u64` for the assertion. This conversion is a lossy one
that's not always guaranteed to succeed, so instead I've changed the test to
only compare against u64 instances.
2013-11-12 11:44:14 -08:00
bors
f1a67bd4c0 auto merge of #10423 : alexcrichton/rust/move-io, r=pcwalton
I still plan on reorganizing the internals of the IO module a bit, but this is the major move which has been on the horizon for awhile.
2013-11-12 11:01:24 -08:00
Florian Hahn
20627c7430 Check inferred integer literals for overflows, closes #4220 2013-11-12 19:36:46 +01:00
Florian Hahn
be09626148 Remove type overflow checks from check_const.rs, refs #4220
The checks are now handled by the linter
2013-11-12 19:35:55 +01:00
Alex Crichton
5fdbcc4020 Improve error message for breaks in blocks
Before it was always stated that it was a "break outside of a loop" when you
could very well be in a loop, but just in a block instead.

Closes #3064
2013-11-12 09:40:21 -08:00
bors
2ee72ba5c6 auto merge of #10439 : brson/rust/rmcxx, r=bstrie 2013-11-12 08:01:20 -08:00
Brian Anderson
6b6f89b0ec rt: Delete more C++ 2013-11-12 06:05:03 -08:00
bors
11b07847e6 auto merge of #10435 : jayanderson/rust/docs, r=huonw
This fills in some missing docs in the nums package. Let me know if this is on the right track for what's wanted for docs. I can probably fill in more in the future. Thanks.

(As a side note the precedence of the unary negative operator '-' tripped me up for a bit. Essentially I would expect `-25.0f32.sqrt()` to result in NaN instead of `-5.0`.)
2013-11-12 02:31:15 -08:00
bors
34035036e3 auto merge of #10198 : alexcrichton/rust/darwin-quiet, r=jdm
Instead of running dsymutil for all builds, this changes it to only run the program for debug builds.

Closes #3495
2013-11-11 22:56:07 -08:00
bors
4320a0caff auto merge of #10425 : astrieanna/rust/rm-issue-912, r=brson
According to rust's issue #912, this will not be fixed. There's no point in keeping the test if it is never intended to pass.
2013-11-11 20:46:11 -08:00
Alex Crichton
49ee49296b Move std::rt::io to std::io 2013-11-11 20:44:07 -08:00
Jay Anderson
8a4be8080b Use constants instead of raw values. 2013-11-11 20:52:42 -07:00
bors
8b4683d79d auto merge of #10424 : alexcrichton/rust/optimize-buffered, r=brson
I was benchmarking rust-http recently, and I saw that 50% of its time was spent
creating buffered readers/writers. Albeit rust-http wasn't using
std::rt::io::buffered, but the same idea applies here. It's much cheaper to
malloc a large region and not initialize it than to set it all to 0. Buffered
readers/writers never use uninitialized data, and their internal buffers are
encapsulated, so any usage of uninitialized slots are an implementation bug in
the readers/writers.
2013-11-11 19:31:14 -08:00
bors
86787f8bef auto merge of #10109 : pcmattman/rust/pass-nonzero-exit-status-on-termination-by-signal, r=alexcrichton
The UvProcess exit callback is called with a zero exit status and non-zero termination signal when a child is terminated by a signal.

If a parent checks only the exit status (for example, only checks the return value from `wait()`), it may believe the process completed successfully when it actually failed.

Helpers for common use-cases are in `std::rt::io::process`.

Should resolve https://github.com/mozilla/rust/issues/10062.
2013-11-11 18:11:17 -08:00
Jay Anderson
deefb1f4b7 Got directions backwards in to_degrees and to_radians docs. 2013-11-11 18:56:48 -07:00
Jay Anderson
6c02e81c70 Add docs for traits Exponential, Hyperbolic, BitCount. 2013-11-11 18:49:48 -07:00
Jay Anderson
f4bedded8b Update docs for Fractional, Algebraic, Round, and Trigonometric traits. 2013-11-11 18:49:48 -07:00
Matthew Iselin
f698decf37 Implemented a ProcessExit enum and helper methods to std::rt::io::process for getting process termination status, or the signal that terminated a process.
A test has been added to rtio-processes.rs to ensure signal termination is picked up correctly.
2013-11-12 11:37:14 +10:00
bors
c0b7972f7d auto merge of #10422 : alexcrichton/rust/explicit-crate-map, r=pcwalton
As we start to move runtime components into the crate map, it's becoming harder
and harder to start the runtime from a C function as rust is embedded in another
application. Right now if you compile a rust crate as a dynamic library which is
then linked to another application, when using std::rt::start there are no I/O
local services, even though rustuv was linked against and requested. The reason
for this is that there is no top level crate map available specifying where to
find libuv I/O.

This option is not meant to be used regularly, but rather whenever compiling a
final library crate and linking it into another application. This lifts the
requirement that to get a crate map you must have the final destination be an
executable.
2013-11-11 16:11:22 -08:00
bors
88e383ef1e auto merge of #10419 : brson/rust/conditiondocs, r=alexcrichton
Fixes #8553 by just not mentioning TLS, and instead just referring to the 'task-local condition handler'.
2013-11-11 13:16:24 -08:00
bors
23746ae990 auto merge of #10403 : poiru/rust/issue-2675, r=alexcrichton
Closes #2675.
2013-11-11 12:06:25 -08:00
Alex Crichton
0cc5e6c83f Remove resolve's xray infrastructure
Since the removal of privacy from resolve, this flag is no longer necessary to
get the test runner working. All of the privacy checks are bypassed by a special
item attribute in the privacy visitor.

Closes #4947
2013-11-11 11:26:31 -08:00
Leah Hanson
a5b6d8d7c2 Remove test issue-3461
According to issue #3461, it doesn't sound like this is planned to be fixed.
2013-11-11 13:25:07 -06:00
Birunthan Mohanathas
36afd60609 Add asserts to check for faililng QueryPerformance* calls in precise_time_ns
Closes #2675.
2013-11-11 21:21:51 +02:00
Birunthan Mohanathas
61f76a5130 Change use of unsigned integers to signed integers for clarity in
precise_time_ns

The QueryPerformance* functions take a LARGE_INTEGER, which is a signed
64-bit integer rather than an unsigned 64-bit integer. `ts.tv_sec`, too,
is a signed integer so `ns_per_s` has been changed to a int64_t.
2013-11-11 21:21:24 +02:00
Leah Hanson
ba4bf7ec33 Remove run-pass/issue-3907-2.rs
This test is not supposed to compile; there is an equivalent test in compile-fail/issue-3907.rs.
2013-11-11 12:59:00 -06:00
bors
0966ec01dc auto merge of #10407 : alexcrichton/rust/no-fixed-stack-segment, r=brson
The commit messages have more details, but this removes all analysis and usage related to fixed_stack_segment and rust_stack attributes. It's now the assumption that we always have "enough stack" and we'll implement detection of stack overflow through other means.

The stack overflow detection is currently implemented for rust functions, but it is unimplemented for C functions (we still don't have guard pages).
2013-11-11 10:46:28 -08:00
Alex Crichton
1f19243095 Decrease the default stack size back to 2MB
I increased this to 4MB when I implemented abort-on-stack-overflow for Rust
functions. Now that the fixed_stack_segment attribute is removed, no rust
function will ever reasonably request 2MB of stack (due to calling an FFI
function).

The default size of 2MB should be plenty for everyday use-cases, and tasks can
still request more stack via the spawning API.
2013-11-11 10:40:34 -08:00
Alex Crichton
7755ffd013 Remove #[fixed_stack_segment] and #[rust_stack]
These two attributes are no longer useful now that Rust has decided to leave
segmented stacks behind. It is assumed that the rust task's stack is always
large enough to make an FFI call (due to the stack being very large).

There's always the case of stack overflow, however, to consider. This does not
change the behavior of stack overflow in Rust. This is still normally triggered
by the __morestack function and aborts the whole process.

C stack overflow will continue to corrupt the stack, however (as it did before
this commit as well). The future improvement of a guard page at the end of every
rust stack is still unimplemented and is intended to be the mechanism through
which we attempt to detect C stack overflow.

Closes #8822
Closes #10155
2013-11-11 10:40:34 -08:00
Leah Hanson
2d6ef29e68 Removed test issue-912.rs
This was marked xfail-test
According to rust's issue #912, this will not be fixed.
There's no point in keeping the test if it is never intended to pass.
2013-11-11 12:12:39 -06:00
Alex Crichton
cdf7d63bfc Optimize creation of buffered readers/writers
I was benchmarking rust-http recently, and I saw that 50% of its time was spent
creating buffered readers/writers. Albeit rust-http wasn't using
std::rt::io::buffered, but the same idea applies here. It's much cheaper to
malloc a large region and not initialize it than to set it all to 0. Buffered
readers/writers never use uninitialized data, and their internal buffers are
encapsulated, so any usage of uninitialized slots are an implementation bug in
the readers/writers.
2013-11-11 10:08:03 -08:00
Alex Crichton
2eb92b77a9 Add a flag to force generating toplevel crate map
As we start to move runtime components into the crate map, it's becoming harder
and harder to start the runtime from a C function as rust is embedded in another
application. Right now if you compile a rust crate as a dynamic library which is
then linked to another application, when using std::rt::start there are no I/O
local services, even though rustuv was linked against and requested. The reason
for this is that there is no top level crate map available specifying where to
find libuv I/O.

This option is not meant to be used regularly, but rather whenever compiling a
final library crate and linking it into another application. This lifts the
requirement that to get a crate map you must have the final destination be an
executable.
2013-11-11 09:26:24 -08:00
bors
4d9b95fada auto merge of #10417 : cmr/rust/vec_overflow, r=huonw
Fixes #10271
2013-11-11 08:56:18 -08:00