Commit Graph

52 Commits

Author SHA1 Message Date
bors
ffd9966c79 auto merge of #15591 : aturon/rust/box-cell-stability, r=alexcrichton
This PR is the outcome of the library stabilization meeting for the
`liballoc::owned` and `libcore::cell` modules.

Aside from the stability attributes, there are a few breaking changes:

* The `owned` modules is now named `boxed`, to better represent its
  contents. (`box` was unavailable, since it's a keyword.) This will
  help avoid the misconception that `Box` plays a special role wrt
  ownership.

* The `AnyOwnExt` extension trait is renamed to `BoxAny`, and its `move`
  method is renamed to `downcast`, in both cases to improve clarity.

* The recently-added `AnySendOwnExt` extension trait is removed; it was
  not being used and is unnecessary.

[breaking-change]
2014-07-13 21:01:28 +00:00
Aaron Turon
e0ede9c6b3 Stabilization for owned (now boxed) and cell
This PR is the outcome of the library stabilization meeting for the
`liballoc::owned` and `libcore::cell` modules.

Aside from the stability attributes, there are a few breaking changes:

* The `owned` modules is now named `boxed`, to better represent its
  contents. (`box` was unavailable, since it's a keyword.) This will
  help avoid the misconception that `Box` plays a special role wrt
  ownership.

* The `AnyOwnExt` extension trait is renamed to `BoxAny`, and its `move`
  method is renamed to `downcast`, in both cases to improve clarity.

* The recently-added `AnySendOwnExt` extension trait is removed; it was
  not being used and is unnecessary.

[breaking-change]
2014-07-13 12:52:51 -07:00
Brian Anderson
fa2d220567 Update doc URLs for version bump 2014-07-11 11:21:57 -07:00
Aaron Turon
bfa853f8ed io::process::Command: add fine-grained env builder
This commit changes the `io::process::Command` API to provide
fine-grained control over the environment:

* The `env` method now inserts/updates a key/value pair.
* The `env_remove` method removes a key from the environment.
* The old `env` method, which sets the entire environment in one shot,
  is renamed to `env_set_all`. It can be used in conjunction with the
  finer-grained methods. This renaming is a breaking change.

To support these new methods, the internal `env` representation for
`Command` has been changed to an optional `HashMap` holding owned
`CString`s (to support non-utf8 data). The `HashMap` is only
materialized if the environment is updated. The implementation does not
try hard to avoid allocation, since the cost of launching a process will
dwarf any allocation cost.

This patch also adds `PartialOrd`, `Eq`, and `Hash` implementations for
`CString`.

[breaking-change]
2014-07-10 12:16:16 -07:00
Alex Crichton
0c71e0c596 Register new snapshots
Closes #15544
2014-07-09 10:57:58 -07:00
Richo Healey
12c334a77b std: Rename the ToStr trait to ToString, and to_str to to_string.
[breaking-change]
2014-07-08 13:01:43 -07:00
Alex Crichton
e44c2b9bbc Add #[crate_name] attributes as necessary 2014-07-05 12:45:42 -07:00
bors
5b11610ced auto merge of #15343 : alexcrichton/rust/0.11.0-release, r=brson 2014-07-04 01:21:19 +00:00
Joseph Crail
e3fa23bcb6 Fix spelling errors. 2014-07-03 12:54:51 -07:00
Alex Crichton
ff1dd44b40 Merge remote-tracking branch 'origin/master' into 0.11.0-release
Conflicts:
	src/libstd/lib.rs
2014-07-02 11:08:21 -07:00
OGINO Masanori
dfdce47988 Rename recvfrom -> recv_from, sendto -> send_to.
POSIX has recvfrom(2) and sendto(2), but their name seem not to be
suitable with Rust. We already renamed getpeername(2) and
getsockname(2), so I think it makes sense.

Alternatively, `receive_from` would be fine. However, we have `.recv()`
so I chose `recv_from`.

Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
2014-07-02 08:21:42 +09:00
Patrick Walton
a5bb0a3a45 librustc: Remove the fallback to int for integers and f64 for
floating point numbers for real.

This will break code that looks like:

    let mut x = 0;
    while ... {
        x += 1;
    }
    println!("{}", x);

Change that code to:

    let mut x = 0i;
    while ... {
        x += 1;
    }
    println!("{}", x);

Closes #15201.

[breaking-change]
2014-06-29 11:47:58 -07:00
Huon Wilson
569f13a521 c_str: move .unwrap & document it more clearly.
This should be called rarely, but it was placed first in the list of
methods, making it very tempting to call.
2014-06-29 21:15:26 +10:00
Huon Wilson
d4d4bc4fe9 c_str: replace .with_ref with .as_ptr throughout the codebase. 2014-06-29 21:15:26 +10:00
Huon Wilson
2c9aada10c c_str: add .as_ptr & .as_mut_ptr to replace .with_[mut_]ref.
These forms return the pointer directly, rather than the added
indirection, indentation, and inefficiencies of the closures in
`.with_ref` and `.with_mut_ref`. The two closure functions are
deprecated.

Replace

    foo(c_str.with_ref(|p| p))

    c_str.with_ref(|p| {
        foo(p);
        bar(p);
    })

with

    foo(c_str.as_ptr())

    let p = c_str.as_ptr();
    foo(p);
    bar(p);

This change does mean that one has to be careful to avoid writing `let p
= x.to_c_str().as_ptr();` since the `CString` will be freed at the end
of the statement. Previously, `with_ref` was used (and `as_ptr` avoided)
for this reason, but Rust has strongly moved away from closures to more
RAII-style code, and most uses of `.with_ref` where in the form
`.with_ref(|p| p)` anyway, that is, they were exactly `.as_ptr`.

[breaking-change]
2014-06-29 21:15:26 +10:00
bors
fe8bc17801 auto merge of #15208 : alexcrichton/rust/snapshots, r=pcwalton
This change registers new snapshots, allowing `*T` to be removed from the language. This is a large breaking change, and it is recommended that if compiler errors are seen that any FFI calls are audited to determine whether they should be actually taking `*mut T`.
2014-06-28 20:11:34 +00:00
Alex Crichton
0dfc90ab15 Rename all raw pointers as necessary 2014-06-28 11:53:58 -07:00
Alex Crichton
aa1163b92d Update to 0.11.0 2014-06-27 12:50:16 -07:00
Alex Crichton
7d756e44a9 rustrt: Reorganize task usage
Most of the comments are available on the Task structure itself, but this commit
is aimed at making FFI-style usage of Rust tasks a little nicer.

Primarily, this commit enables re-use of tasks across multiple invocations. The
method `run` will no longer unconditionally destroy the task itself. Rather, the
task will be internally re-usable if the closure specified did not fail. Once a
task has failed once it is considered poisoned and it can never be used again.

Along the way I tried to document shortcomings of the current method of tearing
down a task, opening a few issues as well. For now none of the behavior is a
showstopper, but it's useful to acknowledge it. Also along the way I attempted
to remove as much `unsafe` code as possible, opting for safer abstractions.
2014-06-26 12:40:27 -07:00
Alex Crichton
2823be08b7 Register new snapshots
This change starts denying `*T` in the parser. All code using `*T` should ensure
that the FFI call does indeed take `const T*` on the other side before renaming
the type to `*const T`.

Otherwise, all code can rename `*T` to `*const T`.

[breaking-change]
2014-06-25 12:47:56 -07:00
Steve Klabnik
d58412bfa1 Add more description to c_str::unwrap().
It's unclear what you are supposed to do with this memory.
Let's make that more clear.
2014-06-24 17:19:17 -07:00
Niko Matsakis
9e3d0b002a librustc: Remove the fallback to int from typechecking.
This breaks a fair amount of code. The typical patterns are:

* `for _ in range(0, 10)`: change to `for _ in range(0u, 10)`;

* `println!("{}", 3)`: change to `println!("{}", 3i)`;

* `[1, 2, 3].len()`: change to `[1i, 2, 3].len()`.

RFC #30. Closes #6023.

[breaking-change]
2014-06-24 17:18:48 -07:00
bors
82ec1aef29 auto merge of #14963 : w3ln4/rust/master, r=alexcrichton
The aim of these changes is not working out a generic bi-endianness architectures support but to allow people develop for little endian MIPS machines (issue #7190).
2014-06-24 13:46:54 +00:00
Pawel Olzacki
34a384a128 Added Mipsel architecture support 2014-06-24 11:12:10 +02:00
Patrick Walton
5466d13d43 librustc: Feature gate lang items and intrinsics.
If you define lang items in your crate, add `#[feature(lang_items)]`.

If you define intrinsics (`extern "rust-intrinsic"`), add
`#[feature(intrinsics)]`.

Closes #12858.

[breaking-change]
2014-06-23 23:28:28 -07:00
Alex Crichton
70d4b50071 Register new snapshots 2014-06-22 21:16:11 -07:00
Patrick Walton
dcbf4ec2a1 librustc: Put #[unsafe_destructor] behind a feature gate.
Closes #8142.

This is not the semantics we want long-term. You can continue to use
`#[unsafe_destructor]`, but you'll need to add
`#![feature(unsafe_destructor)]` to the crate attributes.

[breaking-change]
2014-06-20 14:24:31 -07:00
Simon Sapin
108b8b6dc7 Deprecate the bytes!() macro.
Replace its usage with byte string literals, except in `bytes!()` tests.
Also add a new snapshot, to be able to use the new b"foo" syntax.

The src/etc/2014-06-rewrite-bytes-macros.py script automatically
rewrites `bytes!()` invocations into byte string literals.
Pass it filenames as arguments to generate a diff that you can inspect,
or `--apply` followed by filenames to apply the changes in place.
Diffs can be piped into `tip` or `pygmentize -l diff` for coloring.
2014-06-18 17:02:22 -07:00
Brian Anderson
f4ae8a83f9 Update repo location 2014-06-16 18:16:36 -07:00
bors
7ec78053ec auto merge of #14900 : alexcrichton/rust/snapshots, r=huonw
Closes #14898
Closes #14918
2014-06-16 08:16:49 +00:00
bors
2ef910f71a auto merge of #14715 : vhbit/rust/ios-pr2, r=alexcrichton 2014-06-16 06:32:03 +00:00
Alex Crichton
89b0e6e12b Register new snapshots 2014-06-15 23:30:24 -07:00
Alex Crichton
ade807c6dc rustc: Obsolete the @ syntax entirely
This removes all remnants of `@` pointers from rustc. Additionally, this removes
the `GC` structure from the prelude as it seems odd exporting an experimental
type in the prelude by default.

Closes #14193
[breaking-change]
2014-06-14 10:45:37 -07:00
Alex Crichton
f20b1293fc Register new snapshots 2014-06-14 10:28:09 -07:00
Alex Crichton
ac7b9ddc54 Audit usage of NativeMutex
Once a native mutex has been used once, it is never allowed to be moved again.
This is because some pthreads implementations take pointers inside the mutex
itself.

This commit adds stern wording around the methods on native mutexes, and fixes
one use case in the codebase. The Mutex type in libsync was susceptible to
movement, so the inner static mutex is now boxed to ensure that the address of
the native mutex is constant.
2014-06-13 13:53:34 -07:00
Valerii Hiora
ebc6474668 Cosmetic fixes & comments 2014-06-13 10:18:12 +03:00
Valerii Hiora
a49b765f9a Basic iOS support 2014-06-12 21:15:14 +03:00
Valerii Hiora
d730ae2fb0 Runtime support for arm on iOS 2014-06-12 20:24:08 +03:00
Alex Crichton
3316b1eb7c rustc: Remove ~[T] from the language
The following features have been removed

* box [a, b, c]
* ~[a, b, c]
* box [a, ..N]
* ~[a, ..N]
* ~[T] (as a type)
* deprecated_owned_vector lint

All users of ~[T] should move to using Vec<T> instead.
2014-06-11 15:02:17 -07:00
bors
f9260d41d6 auto merge of #14746 : alexcrichton/rust/libsync, r=brson
This commit is the final step in the libstd facade, #13851. The purpose of this
commit is to move libsync underneath the standard library, behind the facade.
This will allow core primitives like channels, queues, and atomics to all live
in the same location.

There were a few notable changes and a few breaking changes as part of this
movement:

* The `Vec` and `String` types are reexported at the top level of libcollections
* The `unreachable!()` macro was copied to libcore
* The `std::rt::thread` module was moved to librustrt, but it is still
  reexported at the same location.
* The `std::comm` module was moved to libsync
* The `sync::comm` module was moved under `sync::comm`, and renamed to `duplex`.
  It is now a private module with types/functions being reexported under
  `sync::comm`. This is a breaking change for any existing users of duplex
  streams.
* All concurrent queues/deques were moved directly under libsync. They are also
  all marked with #![experimental] for now if they are public.
* The `task_pool` and `future` modules no longer live in libsync, but rather
  live under `std::sync`. They will forever live at this location, but they may
  move to libsync if the `std::task` module moves as well.

[breaking-change]
2014-06-11 11:47:04 -07:00
Alex Crichton
b1c9ce9c6f sync: Move underneath libstd
This commit is the final step in the libstd facade, #13851. The purpose of this
commit is to move libsync underneath the standard library, behind the facade.
This will allow core primitives like channels, queues, and atomics to all live
in the same location.

There were a few notable changes and a few breaking changes as part of this
movement:

* The `Vec` and `String` types are reexported at the top level of libcollections
* The `unreachable!()` macro was copied to libcore
* The `std::rt::thread` module was moved to librustrt, but it is still
  reexported at the same location.
* The `std::comm` module was moved to libsync
* The `sync::comm` module was moved under `sync::comm`, and renamed to `duplex`.
  It is now a private module with types/functions being reexported under
  `sync::comm`. This is a breaking change for any existing users of duplex
  streams.
* All concurrent queues/deques were moved directly under libsync. They are also
  all marked with #![experimental] for now if they are public.
* The `task_pool` and `future` modules no longer live in libsync, but rather
  live under `std::sync`. They will forever live at this location, but they may
  move to libsync if the `std::task` module moves as well.

[breaking-change]
2014-06-11 10:00:43 -07:00
bors
db9e0a1142 auto merge of #14787 : alexcrichton/rust/issue-14784, r=pcwalton
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-11 04:22:02 -07:00
bors
b1302f9c4f auto merge of #14764 : jbcrail/rust/fix-more-comments, r=alexcrichton 2014-06-10 15:17:01 -07:00
bors
9bb8f88d3a auto merge of #14696 : jakub-/rust/dead-struct-fields, r=alexcrichton
This uncovered some dead code, most notably in middle/liveness.rs, which I think suggests there must be something fishy with that part of the code.

The #[allow(dead_code)] annotations on some of the fields I am not super happy about but as I understand, marker type may disappear at some point.
2014-06-10 09:49:29 -07:00
Joseph Crail
c2c9946372 Fix more misspelled comments and strings. 2014-06-10 11:24:17 -04: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
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
Jakub Wieczorek
8e34f647ee Add missing repr(C) annotations to mutex.rs 2014-06-09 22:14:51 +02: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
Jakub Wieczorek
f7d86b2f4a Remove the dead code identified by the new lint 2014-06-08 13:36:28 +02:00