Commit Graph

29771 Commits

Author SHA1 Message Date
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
bors
e87e18064e auto merge of #14712 : alexcrichton/rust/rollup, r=alexcrichton
Closes #14675 (rustc: Encode argument names for traits)
Closes #14681 (rustc: Avoid UB with signed division/remainder)
Closes #14682 (librustc: Update AutoObject adjustment in writeback.)
Closes #14683 (Avoid 16-byte filenames in rlibs)
Closes #14687 (rustdoc: Inline static documentation across crates)
Closes #14689 (Remove reference to ~str in documentation)
Closes #14692 (Rename Iterator::len to count)
Closes #14693 (Implement Eq for HashSet and HashMap)
Closes #14699 (url: encode small bytes correctly.)
Closes #14700 (rustdoc: Submit examples to play.rust-lang.org)
Closes #14701 (mk: Run doc tests with --cfg dox)
Closes #14710 (rustc: Preserve reachable extern fns with LTO)
Closes #14711 (Removing unused wrapper to libc::close.)
2014-06-06 20:42:01 -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
Alex Crichton
06f3f9a0c9 rustdoc: Inline static documentation across crates 2014-06-06 19:51:24 -07:00
Alex Crichton
2290dbb8cc rustc: Avoid 16-byte filenames in rlibs
In addition to avoiding 16-byte filenames with bytecode files, this commit also
avoids 16-byte filenames with object files pulled in from native libraries.
2014-06-06 19:51:19 -07:00
Michael Woerister
6a43af3f84 Add workaround for archive reading bug in LLDB.
LLDB contains a bug that makes it crash if an archive it reads
contains a file the name of which is exactly 16 bytes long. This
bug recently has made it impossible to debug Rust applications with
LLDB because some standard libraries triggered it indirectly:
For rlibs, rustc includes the LLVM bytecode in the archive, giving
it the extension ".bc.deflate". For liballoc (for example) this
results in the 16 character filename "alloc.bc.deflate", which is
bad.

This commit replaces the ".bc.deflate" suffix with
".bytecode.deflate" which itself is already longer than 16 bytes,
thus making sure that the bug won't be run into anymore.

The bug could still be run into with 14 character filenames because
then the .o files will trigger it. However, this is much more rare
and working around it would introduce more complexity than necessary
at the moment. It can always be done later on, if the need arises.

Fixes #14356.
2014-06-06 19:51:19 -07:00
Luqman Aden
735e518a81 librustc: Update AutoObject adjustment in writeback. 2014-06-06 19:51:17 -07:00
Alex Crichton
f35328caed rustc: Avoid UB with signed division/remainder
Division and remainder by 0 are undefined behavior, and are detected at runtime.
This commit adds support for ensuring that MIN / -1 is also checked for at
runtime, as this would cause signed overflow, or undefined behvaior.

Closes #8460
2014-06-06 19:51:13 -07:00
Alex Crichton
9fd075f5af rustc: Encode argument names for traits
This ensures that rustdoc can properly document inlined traits across crates.

Closes #14670
2014-06-06 19:51:08 -07:00
bors
bd6683c729 auto merge of #14702 : nikomatsakis/rust/issue-5527-namespace-substs-b, r=pnkfelix
Separate out initial refactorings for PR #14604
2014-06-06 17:02:00 -07:00
Niko Matsakis
4a51e9c549 Fix resolve to not permit refs to type vars from outer fns
(Fixes #14603)
2014-06-06 19:51:24 -04:00
Niko Matsakis
3fecd10428 Add missing test case for contravariant trait matching 2014-06-06 19:51:23 -04:00
Niko Matsakis
bc5eb7d98c Stop passing around Option<&substs> in trans and just pass &substs, making the code more regular 2014-06-06 19:51:23 -04:00
Niko Matsakis
0f03b5608c Move Def out of syntax crate, where it does not belong 2014-06-06 19:51:23 -04:00
Niko Matsakis
14d626a9fa Simplify MonoId not to include parameters which, given coherence, are purely derived 2014-06-06 19:46:38 -04:00
Niko Matsakis
f24a53757e Move subst data structures into subst.rs, fix capitalization 2014-06-06 19:46:38 -04:00
bors
8a414858ac auto merge of #14680 : Kimundi/rust/master, r=brson
Also updated/corrected a few other details in the tuple and struct sections.
2014-06-06 15:21:59 -07:00
Jonathan S
f2f1991c81 Make sync::raw::Sem use Unsafe to manage mutability instead of transmuting an unsafe pointer 2014-06-06 15:24:14 -05:00
bors
61d79175c0 auto merge of #14318 : zwarich/rust/check-loans-refactor, r=nikomatsakis
I tried to split up the less mechanical changes into separate commits so they are easier to review. One thing I'm not quite sure of is whether `MoveReason` should just be replaced with `move_data::MoveKind`.
2014-06-06 12:17:10 -07:00
Cameron Zwarich
f1542a6a7d Add a test for borrowck errors with multiple closure captures.
When converting check_loans to use ExprUseVisitor I encountered a few
issues where the wrong number of errors were being emitted for multiple
closure captures, but there is no existing test for this.
2014-06-06 11:59:33 -07:00
Cameron Zwarich
74eb4b4b57 Add new tests for borrowck field-sensitivity. 2014-06-06 11:59:33 -07:00
Cameron Zwarich
c53d296e12 Change check_loans to use ExprUseVisitor. 2014-06-06 11:59:33 -07:00
Cameron Zwarich
78934b03e3 Add a kind_of_move_of_path method to FlowedMoveData. 2014-06-06 11:59:33 -07:00
Cameron Zwarich
40e3fb4c0b Use the MoveReason to determine a more precise MoveKind in gather_moves. 2014-06-06 11:59:33 -07:00
Cameron Zwarich
5ccb7644be Add a move reason to the Move ConsumeMode.
Currently it is not possible to distinguish moves caused by captures
in the ExprUseVisitor interface. Since check_Loans needs to make that
distinction for generating good diagnostics, this is necessary for
check_loans to switch to ExprUseVisitor.
2014-06-06 11:59:33 -07:00
Cameron Zwarich
f63fad5d60 Add an Init mode to MutateMode.
This isn't necessary right now, but check_loans needs to be able to
distinguish between initialization and writes in the ExprUseVisitor
mutate callback.
2014-06-06 11:59:32 -07:00
Cameron Zwarich
0339b27e6d Fix mem_categorization to treat an AutoObject adjustment as an rvalue.
Currently mem_categorization categorizes an AutoObject adjustment the
same as the original expression. This can cause two moves to be
generated for the same underlying expression. Currently this isn't a
problem in practice, since check_loans doesn't rely on ExprUseVisitor.
2014-06-06 11:59:32 -07:00
Cameron Zwarich
d123188b20 Clean up check_loans.
Refactor a number of functions in check_loans to take node IDs and spans
rather than taking expressions directly. Also rename some variables to
make them less ambiguous.

This is the first step towards using ExprUseVisitor in check_loans, as
now some of the interfaces more closely match those used in
ExprUseVisitor.
2014-06-06 11:59:32 -07:00
bors
3744940706 auto merge of #14677 : alexcrichton/rust/issue-2665, r=brson
There's no need to distribute these ABI helpers for tests with the standard rust
distribution they're only needed for our tests.

Closes #2665
2014-06-06 10:36:55 -07:00
bors
124e997f36 auto merge of #14676 : brson/rust/double-rainbow, r=alexcrichton 2014-06-06 08:07:07 -07:00
bors
071e22ed89 auto merge of #14673 : sylvestre/rust/master, r=alexcrichton
Remove a warning (./configure: 1140: [: unexpected operator) when built with --disable-manage-submodules
2014-06-06 06:27:00 -07:00
bors
566b7b93c6 auto merge of #14671 : aochagavia/rust/patch-1, r=alexcrichton 2014-06-06 04:41:53 -07:00
bors
76baa5f086 auto merge of #14668 : aochagavia/rust/pr3, r=alexcrichton
Closes https://github.com/mozilla/rust/issues/14577
Closes https://github.com/mozilla/rust/issues/14639
2014-06-06 03:01:57 -07:00
bors
732e057815 auto merge of #14667 : aochagavia/rust/pr2, r=huonw 2014-06-06 01:21:54 -07:00