<feed xmlns='http://www.w3.org/2005/Atom'>
<title>rust/src/libstd/rt/rtio.rs, branch try</title>
<subtitle>https://github.com/rust-lang/rust
</subtitle>
<id>http://git.dreamy.place/mirrors/rust/atom?h=try</id>
<link rel='self' href='http://git.dreamy.place/mirrors/rust/atom?h=try'/>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/'/>
<updated>2014-06-07T05:19:41+00:00</updated>
<entry>
<title>std: Extract librustrt out of libstd</title>
<updated>2014-06-07T05:19:41+00:00</updated>
<author>
<name>Alex Crichton</name>
<email>alex@alexcrichton.com</email>
</author>
<published>2014-06-04T02:11:49+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=5ec36c358f74fe83332231e774ea20a21d165120'/>
<id>urn:sha1:5ec36c358f74fe83332231e774ea20a21d165120</id>
<content type='text'>
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&lt;Exclusive&lt;T&gt;&gt;`.

* 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]
</content>
</entry>
<entry>
<title>rtio: Remove usage of `Path`</title>
<updated>2014-06-07T05:19:41+00:00</updated>
<author>
<name>Alex Crichton</name>
<email>alex@alexcrichton.com</email>
</author>
<published>2014-06-03T05:11:19+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=a3f9aa9ef8657304006fcbe4759a263720b8592c'/>
<id>urn:sha1:a3f9aa9ef8657304006fcbe4759a263720b8592c</id>
<content type='text'>
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.
</content>
</entry>
<entry>
<title>rtio: Remove unused stuct</title>
<updated>2014-06-07T05:19:41+00:00</updated>
<author>
<name>Alex Crichton</name>
<email>alex@alexcrichton.com</email>
</author>
<published>2014-06-03T05:10:38+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=b830b4b86b39173843a2d660727b9e1854fe8bfb'/>
<id>urn:sha1:b830b4b86b39173843a2d660727b9e1854fe8bfb</id>
<content type='text'>
</content>
</entry>
<entry>
<title>std: Improve non-task-based usage</title>
<updated>2014-06-04T18:13:12+00:00</updated>
<author>
<name>Alex Crichton</name>
<email>alex@alexcrichton.com</email>
</author>
<published>2014-06-04T17:54:35+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=0c7c93b8e83544abc7eef5abd76526e5c49882f5'/>
<id>urn:sha1:0c7c93b8e83544abc7eef5abd76526e5c49882f5</id>
<content type='text'>
A few notable improvements were implemented to cut down on the number of aborts
triggered by the standard library when a local task is not found.

* Primarily, the unwinding functionality was restructured to support an unsafe
  top-level function, `try`. This function invokes a closure, capturing any
  failure which occurs inside of it. The purpose of this function is to be as
  lightweight of a "try block" as possible for rust, intended for use when the
  runtime is difficult to set up.

  This function is *not* meant to be used by normal rust code, nor should it be
  consider for use with normal rust code.

* When invoking spawn(), a `fail!()` is triggered rather than an abort.

* When invoking LocalIo::borrow(), which is transitively called by all I/O
  constructors, None is returned rather than aborting to indicate that there is
  no local I/O implementation.

* Invoking get() on a TLD key will return None if no task is available

* Invoking replace() on a TLD key will fail if no task is available.

A test case was also added showing the variety of things that you can do without
a runtime or task set up now. In general, this is just a refactoring to abort
less quickly in the standard library when a local task is not found.
</content>
</entry>
<entry>
<title>Process::new etc should support non-utf8 commands/args</title>
<updated>2014-05-15T05:52:31+00:00</updated>
<author>
<name>Aaron Turon</name>
<email>aturon@mozilla.com</email>
</author>
<published>2014-05-05T21:33:55+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=046062d3bf0597fb2f40f7cacbbe4f438506247d'/>
<id>urn:sha1:046062d3bf0597fb2f40f7cacbbe4f438506247d</id>
<content type='text'>
The existing APIs for spawning processes took strings for the command
and arguments, but the underlying system may not impose utf8 encoding,
so this is overly limiting.

The assumption we actually want to make is just that the command and
arguments are viewable as [u8] slices with no interior NULLs, i.e., as
CStrings. The ToCStr trait is a handy bound for types that meet this
requirement (such as &amp;str and Path).

However, since the commands and arguments are often a mixture of
strings and paths, it would be inconvenient to take a slice with a
single T: ToCStr bound. So this patch revamps the process creation API
to instead use a builder-style interface, called `Command`, allowing
arguments to be added one at a time with differing ToCStr
implementations for each.

The initial cut of the builder API has some drawbacks that can be
addressed once issue #13851 (libstd as a facade) is closed. These are
detailed as FIXMEs.

Closes #11650.

[breaking-change]
</content>
</entry>
<entry>
<title>io: Implement process wait timeouts</title>
<updated>2014-05-14T00:27:42+00:00</updated>
<author>
<name>Alex Crichton</name>
<email>alex@alexcrichton.com</email>
</author>
<published>2014-05-05T23:58:42+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=f09592a5d154177f0c9d739c9fe60742ec4cd951'/>
<id>urn:sha1:f09592a5d154177f0c9d739c9fe60742ec4cd951</id>
<content type='text'>
This implements set_timeout() for std::io::Process which will affect wait()
operations on the process. This follows the same pattern as the rest of the
timeouts emerging in std::io::net.

The implementation was super easy for everything except libnative on unix
(backwards from usual!), which required a good bit of signal handling. There's a
doc comment explaining the strategy in libnative. Internally, this also required
refactoring the "helper thread" implementation used by libnative to allow for an
extra helper thread (not just the timer).

This is a breaking change in terms of the io::Process API. It is now possible
for wait() to fail, and subsequently wait_with_output(). These two functions now
return IoResult&lt;T&gt; due to the fact that they can time out.

Additionally, the wait_with_output() function has moved from taking `&amp;mut self`
to taking `self`. If a timeout occurs while waiting with output, the semantics
are undesirable in almost all cases if attempting to re-wait on the process.
Equivalent functionality can still be achieved by dealing with the output
handles manually.

[breaking-change]

cc #13523
</content>
</entry>
<entry>
<title>Add `stat` method to `std::io::fs::File` to stat without a Path.</title>
<updated>2014-05-13T02:52:29+00:00</updated>
<author>
<name>Yuri Kunde Schlesner</name>
<email>yuriks@yuriks.net</email>
</author>
<published>2014-05-12T05:31:22+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=8c55fcd1f2ef3674d4bda4e38e2e7cacdd7cd5b8'/>
<id>urn:sha1:8c55fcd1f2ef3674d4bda4e38e2e7cacdd7cd5b8</id>
<content type='text'>
The `FileStat` struct contained a `path` field, which was filled by the
`stat` and `lstat` function. Since this field isn't in fact returned by
the operating system (it was copied from the paths passed to the
functions) it was removed, as in the `fstat` case we aren't working with
a `Path`, but directly with a fd.

If your code used the `path` field of `FileStat` you will now have to
manually store the path passed to `stat` along with the returned struct.

[breaking-change]
</content>
</entry>
<entry>
<title>core: Remove the cast module</title>
<updated>2014-05-11T08:13:02+00:00</updated>
<author>
<name>Alex Crichton</name>
<email>alex@alexcrichton.com</email>
</author>
<published>2014-05-09T17:34:51+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=f94d671bfae5d8e9a4a4add310b1c40af0ab62a6'/>
<id>urn:sha1:f94d671bfae5d8e9a4a4add310b1c40af0ab62a6</id>
<content type='text'>
This commit revisits the `cast` module in libcore and libstd, and scrutinizes
all functions inside of it. The result was to remove the `cast` module entirely,
folding all functionality into the `mem` module. Specifically, this is the fate
of each function in the `cast` module.

* transmute - This function was moved to `mem`, but it is now marked as
              #[unstable]. This is due to planned changes to the `transmute`
              function and how it can be invoked (see the #[unstable] comment).
              For more information, see RFC 5 and #12898

* transmute_copy - This function was moved to `mem`, with clarification that is
                   is not an error to invoke it with T/U that are different
                   sizes, but rather that it is strongly discouraged. This
                   function is now #[stable]

* forget - This function was moved to `mem` and marked #[stable]

* bump_box_refcount - This function was removed due to the deprecation of
                      managed boxes as well as its questionable utility.

* transmute_mut - This function was previously deprecated, and removed as part
                  of this commit.

* transmute_mut_unsafe - This function doesn't serve much of a purpose when it
                         can be achieved with an `as` in safe code, so it was
                         removed.

* transmute_lifetime - This function was removed because it is likely a strong
                       indication that code is incorrect in the first place.

* transmute_mut_lifetime - This function was removed for the same reasons as
                           `transmute_lifetime`

* copy_lifetime - This function was moved to `mem`, but it is marked
                  `#[unstable]` now due to the likelihood of being removed in
                  the future if it is found to not be very useful.

* copy_mut_lifetime - This function was also moved to `mem`, but had the same
                      treatment as `copy_lifetime`.

* copy_lifetime_vec - This function was removed because it is not used today,
                      and its existence is not necessary with DST
                      (copy_lifetime will suffice).

In summary, the cast module was stripped down to these functions, and then the
functions were moved to the `mem` module.

    transmute - #[unstable]
    transmute_copy - #[stable]
    forget - #[stable]
    copy_lifetime - #[unstable]
    copy_mut_lifetime - #[unstable]

[breaking-change]
</content>
</entry>
<entry>
<title>Handle fallout in libnative</title>
<updated>2014-05-08T19:06:22+00:00</updated>
<author>
<name>Kevin Ballard</name>
<email>kevin@sb.org</email>
</author>
<published>2014-05-04T07:21:44+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=1d57da783b150a84c7b4ead283483bdd48029abb'/>
<id>urn:sha1:1d57da783b150a84c7b4ead283483bdd48029abb</id>
<content type='text'>
API Changes:

- GetAddrInfoRequest::run() returns Result&lt;Vec&lt;..&gt;, ..&gt;
- Process::spawn() returns Result(.., Vec&lt;..&gt;), ..&gt;
</content>
</entry>
<entry>
<title>Handle fallout in io::net::addrinfo, io::process, and rt::rtio</title>
<updated>2014-05-08T19:06:22+00:00</updated>
<author>
<name>Kevin Ballard</name>
<email>kevin@sb.org</email>
</author>
<published>2014-05-04T05:55:35+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=cc42b619362c344aacdb84ff00243b3e32168cad'/>
<id>urn:sha1:cc42b619362c344aacdb84ff00243b3e32168cad</id>
<content type='text'>
API Changes:

- get_host_addresses() returns IoResult&lt;Vec&lt;IpAddr&gt;&gt;
- Process.extra_io is Vec&lt;Option&lt;io::PipeStream&gt;&gt;
</content>
</entry>
</feed>
