Commit Graph

26487 Commits

Author SHA1 Message Date
Adolfo Ochagavía 02866e6fe2 Pub use CheckedDiv in the prelude 2014-06-10 10:01:49 +02:00
Piotr Jawniak 9bead9b3f1 Add test for issue #13214
Closes #13214
2014-06-10 09:26:49 +02:00
bors 0ee6a8e8a5 auto merge of #14606 : pcwalton/rust/fn-trait-sugar, r=alexcrichton
r? @alexcrichton
2014-06-09 23:41:53 -07:00
bors 5bc2d03955 auto merge of #14783 : alexcrichton/rust/rollup, r=alexcrichton
Closes #14611 (std: Remove the as_utf16_p functions)
Closes #14694 (Num cleanup)
Closes #14760 (Add --color to test binary options)
Closes #14763 (std: Move dynamic_lib from std::unstable to std)
Closes #14766 (Add test for issue #13446)
Closes #14769 (collections: Add missing Default impls)
Closes #14773 (General nits)
Closes #14776 (rustdoc: Correctly classify enums/typedefs)
2014-06-09 21:57:09 -07:00
Alex Crichton 5ede96c2fd Test fixes from rollup 2014-06-09 21:52:37 -07:00
Alex Crichton 4fecc503ee rustrt: Fix invalid reads caught by valgrind
This is another case of #13246. The RAII lock wasn't being destroyed until after
the allocation was free'd due to destructor scheduling.

Closes #14784
2014-06-09 20:57:55 -07:00
Patrick Walton 1a381fa2d2 librustc: Use *signed* extension when converting enums to floats.
Previously, constants used unsigned extension, while non-constants used
signed extension. This unifies both paths to use signed extension.

If this breaks your code, take a deep breath, go for a walk, and
consider why you're relying on the sign extension semantics of
enum-to-float casts.

Closes #8230.

[breaking-change]
2014-06-09 20:55:38 -07:00
Renato Zannon 47b72e388d Remove & -> &mut transmute from TypedArena 2014-06-10 00:41:44 -03:00
Renato Zannon a535cfb1f0 Remove & -> &mut transmute from Arena 2014-06-10 00:29:42 -03:00
Patrick Walton f02b6f3a8b librustc: Implement sugar for the `FnMut` trait 2014-06-09 20:19:07 -07:00
Renato Zannon e0855bccd3 Add a test for nested Arena.alloc 2014-06-09 23:54:52 -03:00
bors 5bf5cc605f auto merge of #14694 : aochagavia/rust/num-cleanup, r=alexcrichton 2014-06-09 19:52:08 -07:00
Alex Crichton 24cbe38423 rustdoc: Correctly classify enums/typedefs
Both of these items are surfaced as a DefTy, so some extra logic was needed in
the decoder module to figure out whether one is actually an enum or whether it's
a typedef.

Closes #14757
2014-06-09 17:46:53 -07:00
Huon Wilson 14668f2791 std: adjust the TCP io doc example to work reliably.
Fixes #11576 by making the code never run (and hence never
pass when the test was marked `should_fail`).
2014-06-09 17:46:53 -07:00
Huon Wilson 05810604c8 native: add more info to the native unimplemented error.
This refers to green, which (AFAICT) has everything implemented. In
particular, this will help guide people to get working signal handling
via libgreen.
2014-06-09 17:46:53 -07:00
Tom Jakubowski d6a39419db collections: Add missing Default impls
Add Default impls for TreeMap, TreeSet, SmallIntMap, BitvSet, DList,
PriorityQueue, RingBuf, TrieMap, and TrieSet.
2014-06-09 17:46:53 -07:00
Piotr Jawniak 810ddfd611 Add test for issue #13446
Closes #13446
2014-06-09 17:46:53 -07:00
Brian Anderson 1635ef2a19 std: Move dynamic_lib from std::unstable to std
This leaves a deprecated reexport in place temporarily.

Closes #1457.
2014-06-09 17:46:53 -07:00
Steven Fackler 5eb4d19dc3 Add a --color flag to test binaries
It uses the same behavior as rustc's.
2014-06-09 17:46:27 -07:00
Adolfo Ochagavía 9faf5a3483 Cleanup bigint 2014-06-09 17:46:27 -07:00
Adolfo Ochagavía 1e931918c8 Moved integer trait and functions to submodule 2014-06-09 17:46:27 -07:00
Alex Crichton d42cc130f9 std: Remove the as_utf16_p functions
These functions are all much better expressed via RAII using the to_utf16()
method on strings. This refactoring also takes this opportunity to properly
handle when filenames aren't valid unicode when passed through to the windows
I/O layer by properly returning I/O errors.

All previous users of the `as_utf16_p` or `as_utf16_mut_p` functions will need
to convert their code to using `foo.to_utf16().append_one(0)` to get a
null-terminated utf16 string.

[breaking-change]
2014-06-09 17:46:27 -07:00
bors 907d961876 auto merge of #14590 : pcwalton/rust/overloaded-call, r=nick29581
gate.

This is part of unboxed closures.

r? @nick29581
2014-06-09 17:37:08 -07:00
bors 0ea7aa30cc auto merge of #14554 : kmcallister/rust/plugin_registrar, r=cmr
This implements the design in rust-lang/rfcs#86.  It shouldn't be merged until that RFC is accepted, but it would be great if somebody has time to review the code before then.
2014-06-09 15:52:07 -07:00
Keegan McAllister d43a948bb1 Document rustc::plugin 2014-06-09 14:29:30 -07:00
Keegan McAllister 7c674aceeb Add a test for deprecated phase(syntax) 2014-06-09 14:29:30 -07:00
Keegan McAllister 5084de3aaf Convert tests to use #[plugin_registrar] 2014-06-09 14:29:30 -07:00
Keegan McAllister aca0bac29f Convert libraries to use #[plugin_registrar] 2014-06-09 14:29:30 -07:00
Keegan McAllister ed41b71fbe Use phase(plugin) in tests 2014-06-09 14:29:30 -07:00
Keegan McAllister 84243ed6e1 Use phase(plugin) in other crates 2014-06-09 14:29:30 -07:00
Keegan McAllister ffb2f12ed8 Use phase(plugin) in bootstrap crates
Do this to avoid warnings on post-stage0 builds.
2014-06-09 14:29:30 -07:00
Keegan McAllister 6d15c6749c Implement #[plugin_registrar]
See RFC 22.

[breaking-change]
2014-06-09 14:29:29 -07:00
Jakub Wieczorek 8e34f647ee Add missing repr(C) annotations to mutex.rs 2014-06-09 22:14:51 +02:00
Alex Crichton a7872b3c1e std: Read HOME instead of USER
Apparently one of the linux bots doesn't have the USER variable defined, and
this fix will likely land more quickly than a fix to the bots.
2014-06-09 12:44:45 -07:00
Patrick Walton 966c7346ca librustc: Implement overloading for the call operator behind a feature
gate.

This is part of unboxed closures.
2014-06-09 12:39:17 -07:00
Adolfo Ochagavía 0eb858b4c9 Cleanup bigint 2014-06-09 16:36:56 +02:00
Adolfo Ochagavía 3ca00ec0db Moved integer trait and functions to submodule 2014-06-09 16:36:40 +02:00
bors e55f64f997 auto merge of #14709 : alexcrichton/rust/collections, r=brson
This is mostly just a cosmetic change, continuing the work from #14333.
2014-06-09 01:11:58 -07:00
Alex Crichton da0703973a core: Move the collections traits to libcollections
This commit moves Mutable, Map, MutableMap, Set, and MutableSet from
`core::collections` to the `collections` crate at the top-level. Additionally,
this removes the `deque` module and moves the `Deque` trait to only being
available at the top-level of the collections crate.

All functionality continues to be reexported through `std::collections`.

[breaking-change]
2014-06-09 00:38:46 -07:00
bors a6a9e09f98 auto merge of #14740 : P1start/rust/name-warnings, r=alexcrichton
This updates identifier warnings such as ``struct `foo_bar` should have a
camel case identifier`` to provide an example.

Closes #14738.
2014-06-08 23:26:57 -07:00
Brian Anderson 50942c7695 core: Rename `container` mod to `collections`. Closes #12543
Also renames the `Container` trait to `Collection`.

[breaking-change]
2014-06-08 21:29:57 -07:00
bors 61d65cd56e auto merge of #14765 : rapha/rust/master, r=alexcrichton 2014-06-08 21:26:59 -07:00
Raphael Speyer 1638c4b749 Converted PortReader and ChanWriter to use Vec. 2014-06-09 14:18:11 +10:00
bors 443a1cdf94 auto merge of #14756 : TeXitoi/rust/relicense-shootout-fannkuch-redux, r=brson
Part of #14248

Main contributors are @pcwalton, @alexcrichton and me.  Only
@dguenther appear in git blame as a minor contribution, but it is
only adding the rust license, so removed by this relicensing.

@brson OK?
2014-06-08 14:56:52 -07:00
Guillaume Pinot b13e275852 relicense shootout-fannkuch-redux.rs
Part of #14248

Main contributors are @pcwalton, @alexcrichton and me.  Only
@dguenther appear in git blame as a minor contribution, but it is
only adding the rust license, so removed by this relicensing.
2014-06-08 22:25:49 +02:00
Jakub Wieczorek 135625df96 Mark relevant structs with repr(C) 2014-06-08 22:20:17 +02:00
bors e688d0e846 auto merge of #14751 : jbcrail/rust/fix-comments, r=alexcrichton 2014-06-08 12:51:51 -07:00
Jakub Wieczorek f8b4e821ea Remove a redundant bitcast from fail!() handling 2014-06-08 20:01:38 +02:00
Jakub Wieczorek a2bbcb594f Fix an LLVM assertion when matching against static strings
Fixes #8315
Fixes #11940
2014-06-08 19:43:38 +02:00
Joseph Crail 45e56eccbe Fix spelling errors in comments. 2014-06-08 13:39:42 -04:00
Steven Fackler 89c76bb142 Implement Hash for Bitv and BitvSet
Closes #14744
2014-06-08 10:29:55 -07:00
bors 17ba0cf428 auto merge of #14745 : huonw/rust/timer-doc, r=alexcrichton
std::io: expand the oneshot/periodic docs.

Examples!

Fixes #14714.
2014-06-08 06:01:49 -07:00
Jakub Wieczorek f7d86b2f4a Remove the dead code identified by the new lint 2014-06-08 13:36:28 +02:00
Jakub Wieczorek 0271224bda Add detection of dead struct fields 2014-06-08 13:30:04 +02:00
bors 9239bb4960 auto merge of #14741 : sfackler/rust/visit-attr, r=alexcrichton
The lint was missing a *lot* of cases previously.
2014-06-08 04:16:53 -07:00
bors 010d96ede9 auto merge of #14728 : TeXitoi/rust/relicense-shootout-regex-dna, r=brson
Part of #14248

The authors are @pcwalton and @BurntSushi, and we have their agreement.

@brson OK?
2014-06-08 02:31:53 -07:00
Huon Wilson e8d180df46 std::io: expand the oneshot/periodic docs.
Examples!

Fixes #14714.
2014-06-08 18:32:15 +10:00
bors 7580ef902e auto merge of #14743 : Sawyer47/rust/range-msg, r=huonw
Range allows char and numeric types, but previous error message
mentioned only numeric types.
2014-06-08 00:46:57 -07:00
Steven Fackler 9452cd24fb Remove unused name_str_pair method 2014-06-08 00:21:35 -07:00
Steven Fackler 862cd65dca Add back hint for crate level attributes 2014-06-08 00:21:15 -07:00
Piotr Jawniak 90339ef189 Improve error message for range in match
Range allows char and numeric types, but previous error message
mentioned only numeric types.
2014-06-08 08:57:33 +02:00
Steven Fackler 42a18bd985 Remove the attribute_usage lint
It has been superseded by the unused_attribute lint.

[breaking change]
2014-06-07 23:46:32 -07:00
Steven Fackler 3654ac68be Add visit_attribute to Visitor, use it for unused_attribute
The lint was missing a *lot* of cases previously.
2014-06-07 23:21:33 -07:00
P1start c1c76590cb update identifier naming warnings to give an example
This updates identifier warnings such as ``struct `foo_bar` should have a
camel case identifier`` to provide an example.

Closes #14738.
2014-06-08 17:56:09 +12:00
bors bbd448a27c auto merge of #14733 : sfackler/rust/partial-eq-nan-docs, r=alexcrichton
It is in fact the case that `NaN != NaN`. The true relations for
compareQuietNotEqual are LT, GT *and* UN.

I also rephrased the docs for PartialOrd since floats are not the only
types which are not totally ordered.
2014-06-07 18:01:46 -07:00
Steven Fackler 6b3d3803eb Clarify restrictions on ne
I can't think of any sane cases where this restriction would not hold,
and the standard library seems to assume it pretty much everywhere.
2014-06-07 17:52:48 -07:00
Steven Fackler 92221aba7b Fix PartialEq documentation with regards to floats
It is in fact the case that `NaN != NaN`. The true relations for
compareQuietNotEqual are LT, GT *and* UN.

I also rephrased the docs for PartialOrd since floats are not the only
types which are not totally ordered.
2014-06-07 17:48:54 -07:00
bors fa1832800a auto merge of #14725 : aochagavia/rust/show, r=alexcrichton 2014-06-07 15:31:44 -07:00
bors 01eb0ce122 auto merge of #14722 : hannobraun/rust/quote-args, r=alexcrichton
The need for this came up while I worked on a procedural macro that parses an argument and adds the same argument to a generated function.
2014-06-07 13:46:42 -07:00
bors ddd09df137 auto merge of #14730 : alexcrichton/rust/issue-14723, r=cmr
Closes #14723
2014-06-07 12:01:41 -07:00
Alex Crichton 3688c1d0ca rustdoc: More selectively remove execute links
Closes #14723
2014-06-07 10:53:22 -07:00
Adolfo Ochagavía 9731c28e11 Implement Show for SmallIntMap 2014-06-07 19:44:45 +02:00
Guillaume Pinot fe7fc4aeb2 relicense shootout-regex-dna.rs
Part of #14248

The authors are @pcwalton and @BurntSushi, and we have their agreement.
2014-06-07 19:34:29 +02:00
bors ffdb881337 auto merge of #14717 : zwarich/rust/borrowck-tests, r=cmr
After sitting down to build on the work merged in #14318, I realized that some of the test names were not clear, others probably weren't testing the right thing, and they were also not as exhaustive as they could have been.
2014-06-07 10:17:38 -07:00
Hanno Braun cc28ae5201 Implement ToSource and ToToken for ast::Arg
This makes ast::Arg usable in the quote_ macros.

Please note that this commit doesn't include a regression test. There
are tests that use the quote macros, but all of them are ignored. Due to
that, there is no obvious (to me) way to test this.

Since this change is absolutely trivial and only hooks up an additional
type to existing infrastructure (which presumably is tested elsewhere),
I concluded it's not worth the effort to follow up on this.
2014-06-07 13:46:41 +00:00
Adolfo Ochagavía f1bff592b1 Implement Show for DList 2014-06-07 15:01:44 +02:00
Cameron Zwarich 4666792ac6 Clean up borrows in borrowck field-sensitivity tests
Instead of calling a borrow() function that takes a pointer type, just
create a local pointer and dereference it. The dereference is there to
outsmart any future liveness analysis in borrowck.
2014-06-07 03:03:03 -07:00
Cameron Zwarich 653f57af20 Fix bad borrowck tests and move them from run-pass to compile-fail
The move_after_borrow / fu_move_after_borrow tests in
run-pass/borrowck-field-sensitivity.rs are not testing the right thing,
since the scope of the borrow is limited to the call to borrow(). When
fixed, these tests fail and thus should be moved to the corresponding
compile-fail test file.
2014-06-07 03:03:03 -07:00
Cameron Zwarich 61c81bf00c Add more borrowck tests for functional update moves
Add more borrowck field-sensitivity tests for functional update moves.
This makes the collection of test functions more combinatorially
exhaustive.
2014-06-07 02:31:01 -07:00
Cameron Zwarich 8a543ffc76 Make borrowck test functions better match their names
A number of borrowck field-sensitivity tests perform more moves and
copies than their naming scheme would indicate. This is only necessary
for borrowed pointers (to ensure that the borrowws stay alive in the
near future when borrow liveness is tracked), but all other test
functions should be changed to match their name more closely.
2014-06-07 02:31:01 -07:00
Cameron Zwarich 53198ffda6 Mention the specific kind of use in borrowck test function names
Some of the borrowck field-sensitivity test functions have 'use' in
their name, but they don't refer to the specific kind of use (whether a
copy or a deref). It would be better if the name more precisely
reflected what the function is testing.
2014-06-07 02:30:33 -07:00
bors 8e9e484d70 auto merge of #14708 : gereeter/rust/faster-sem, r=alexcrichton
Currently, `Sem`, which is used as a building block for all the blocking primitives, uses a very ugly hack to implement `Share` and be able to mutate the stored `WaitQueue` by hiding it all behind a `transmute`d `*()`. This PR replaces all that ugly machinery with `Unsafe`. Beyond being cleaner and not requiring `transmute`, this removes an allocation in the creation and removes an indirection for access.
2014-06-07 00:51:36 -07:00
Alex Crichton 75014f7b17 libs: Fix miscellaneous fallout of librustrt 2014-06-06 23:00:01 -07:00
Alex Crichton d743b8831e test: Fix fallout of previous changes 2014-06-06 22:19:57 -07:00
Alex Crichton 550c347d7b rustuv: Deal with the rtio changes 2014-06-06 22:19:57 -07:00
Alex Crichton 51348b068b native: Deal with the rtio changes 2014-06-06 22:19:57 -07:00
Alex Crichton da2293c6f6 std: Deal with fallout of rtio changes 2014-06-06 22:19:57 -07:00
Alex Crichton 5ec36c358f std: Extract librustrt out of libstd
As part of the libstd facade efforts, this commit extracts the runtime interface
out of the standard library into a standalone crate, librustrt. This crate will
provide the following services:

* Definition of the rtio interface
* Definition of the Runtime interface
* Implementation of the Task structure
* Implementation of task-local-data
* Implementation of task failure via unwinding via libunwind
* Implementation of runtime initialization and shutdown
* Implementation of thread-local-storage for the local rust Task

Notably, this crate avoids the following services:

* Thread creation and destruction. The crate does not require the knowledge of
  an OS threading system, and as a result it seemed best to leave out the
  `rt::thread` module from librustrt. The librustrt module does depend on
  mutexes, however.
* Implementation of backtraces. There is no inherent requirement for the runtime
  to be able to generate backtraces. As will be discussed later, this
  functionality continues to live in libstd rather than librustrt.

As usual, a number of architectural changes were required to make this crate
possible. Users of "stable" functionality will not be impacted by this change,
but users of the `std::rt` module will likely note the changes. A list of
architectural changes made is:

* The stdout/stderr handles no longer live directly inside of the `Task`
  structure. This is a consequence of librustrt not knowing about `std::io`.
  These two handles are now stored inside of task-local-data.

  The handles were originally stored inside of the `Task` for perf reasons, and
  TLD is not currently as fast as it could be. For comparison, 100k prints goes
  from 59ms to 68ms (a 15% slowdown). This appeared to me to be an acceptable
  perf loss for the successful extraction of a librustrt crate.

* The `rtio` module was forced to duplicate more functionality of `std::io`. As
  the module no longer depends on `std::io`, `rtio` now defines structures such
  as socket addresses, addrinfo fiddly bits, etc. The primary change made was
  that `rtio` now defines its own `IoError` type. This type is distinct from
  `std::io::IoError` in that it does not have an enum for what error occurred,
  but rather a platform-specific error code.

  The native and green libraries will be updated in later commits for this
  change, and the bulk of this effort was put behind updating the two libraries
  for this change (with `rtio`).

* Printing a message on task failure (along with the backtrace) continues to
  live in libstd, not in librustrt. This is a consequence of the above decision
  to move the stdout/stderr handles to TLD rather than inside the `Task` itself.
  The unwinding API now supports registration of global callback functions which
  will be invoked when a task fails, allowing for libstd to register a function
  to print a message and a backtrace.

  The API for registering a callback is experimental and unsafe, as the
  ramifications of running code on unwinding is pretty hairy.

* The `std::unstable::mutex` module has moved to `std::rt::mutex`.

* The `std::unstable::sync` module has been moved to `std::rt::exclusive` and
  the type has been rewritten to not internally have an Arc and to have an RAII
  guard structure when locking. Old code should stop using `Exclusive` in favor
  of the primitives in `libsync`, but if necessary, old code should port to
  `Arc<Exclusive<T>>`.

* The local heap has been stripped down to have fewer debugging options. None of
  these were tested, and none of these have been used in a very long time.

[breaking-change]
2014-06-06 22:19:41 -07:00
Alex Crichton a3f9aa9ef8 rtio: Remove usage of `Path`
The rtio interface is a thin low-level interface over the I/O subsystems, and
the `Path` type is a little too high-level for this interface.
2014-06-06 22:19:41 -07:00
Alex Crichton b830b4b86b rtio: Remove unused stuct 2014-06-06 22:19:41 -07:00
Alex Crichton 8bf6da0836 Test fixes from the rollup 2014-06-06 20:37:26 -07:00
Alex Crichton e5bbbca33e rustdoc: Submit examples to play.rust-lang.org
This grows a new option inside of rustdoc to add the ability to submit examples
to an external website. If the `--markdown-playground-url` command line option
or crate doc attribute `html_playground_url` is present, then examples will have
a button on hover to submit the code to the playground specified.

This commit enables submission of example code to play.rust-lang.org. The code
submitted is that which is tested by rustdoc, not necessarily the exact code
shown in the example.

Closes #14654
2014-06-06 20:00:16 -07:00
Alex Crichton cc63d4c61b doc: Turn off special features for rustdoc tests
These were only used for the markdown tests, and there's no reason they should
be distinct from the other tests.
2014-06-06 20:00:07 -07:00
Axel Viala 5915763106 Removing unused wrapper to libc::close. 2014-06-06 19:52:25 -07:00
Alex Crichton d4dec4701a rustc: Preserve reachable extern fns with LTO
All rust functions are internal implementation details with respect to the ABI
exposed by crates, but extern fns are public components of the ABI and shouldn't
be stripped. This commit serializes reachable extern fns to metadata, so when
LTO is performed all of their symbols are not stripped.

Closes #14500
2014-06-06 19:52:21 -07:00
Alex Crichton cb12e7ab74 mk: Run doc tests with --cfg dox
There were a few examples in the macros::builtin module that weren't being run
because they were being #[cfg]'d out.

Closes #14697
2014-06-06 19:51:52 -07:00
Huon Wilson 1f4d8f924e url: encode small bytes correctly.
Previously, bytes less than 16 would be encoded as %X, rather than %XX,
since the output width was left to be automatic.
2014-06-06 19:51:49 -07:00
Steven Fackler b662aa5ec0 Implement Eq for HashSet and HashMap
Also fix documentation references to PartialEq.
2014-06-06 19:51:37 -07:00
Aaron Turon 1bde6e3fcb Rename Iterator::len to count
This commit carries out the request from issue #14678:

> The method `Iterator::len()` is surprising, as all the other uses of
> `len()` do not consume the value. `len()` would make more sense to be
> called `count()`, but that would collide with the current
> `Iterator::count(|T| -> bool) -> unit` method. That method, however, is
> a bit redundant, and can be easily replaced with
> `iter.filter(|x| x < 5).count()`.
> After this change, we could then define the `len()` method
> on `iter::ExactSize`.

Closes #14678.

[breaking-change]
2014-06-06 19:51:31 -07:00
fort 1bc29924dc Remove reference to ~str in documentation 2014-06-06 19:51:26 -07:00