]> git.lizzy.rs Git - rust.git/log
rust.git
9 years agoFall out of the std::sync rewrite
Alex Crichton [Mon, 24 Nov 2014 19:16:40 +0000 (11:16 -0800)]
Fall out of the std::sync rewrite

9 years agostd: Rewrite the `sync` module
Alex Crichton [Mon, 24 Nov 2014 19:16:40 +0000 (11:16 -0800)]
std: Rewrite the `sync` module

This commit is a reimplementation of `std::sync` to be based on the
system-provided primitives wherever possible. The previous implementation was
fundamentally built on top of channels, and as part of the runtime reform it has
become clear that this is not the level of abstraction that the standard level
should be providing. This rewrite aims to provide as thin of a shim as possible
on top of the system primitives in order to make them safe.

The overall interface of the `std::sync` module has in general not changed, but
there are a few important distinctions, highlighted below:

* The condition variable type, `Condvar`, has been separated out of a `Mutex`.
  A condition variable is now an entirely separate type. This separation
  benefits users who only use one mutex, and provides a clearer distinction of
  who's responsible for managing condition variables (the application).

* All of `Condvar`, `Mutex`, and `RWLock` are now directly built on top of
  system primitives rather than using a custom implementation. The `Once`,
  `Barrier`, and `Semaphore` types are still built upon these abstractions of
  the system primitives.

* The `Condvar`, `Mutex`, and `RWLock` types all have a new static type and
  constant initializer corresponding to them. These are provided primarily for C
  FFI interoperation, but are often useful to otherwise simply have a global
  lock. The types, however, will leak memory unless `destroy()` is called on
  them, which is clearly documented.

* The `Condvar` implementation for an `RWLock` write lock has been removed. This
  may be added back in the future with a userspace implementation, but this
  commit is focused on exposing the system primitives first.

* The fundamental architecture of this design is to provide two separate layers.
  The first layer is that exposed by `sys_common` which is a cross-platform
  bare-metal abstraction of the system synchronization primitives. No attempt is
  made at making this layer safe, and it is quite unsafe to use! It is currently
  not exported as part of the API of the standard library, but the stabilization
  of the `sys` module will ensure that these will be exposed in time. The
  purpose of this layer is to provide the core cross-platform abstractions if
  necessary to implementors.

  The second layer is the layer provided by `std::sync` which is intended to be
  the thinnest possible layer on top of `sys_common` which is entirely safe to
  use. There are a few concerns which need to be addressed when making these
  system primitives safe:

    * Once used, the OS primitives can never be **moved**. This means that they
      essentially need to have a stable address. The static primitives use
      `&'static self` to enforce this, and the non-static primitives all use a
      `Box` to provide this guarantee.

    * Poisoning is leveraged to ensure that invalid data is not accessible from
      other tasks after one has panicked.

  In addition to these overall blanket safety limitations, each primitive has a
  few restrictions of its own:

    * Mutexes and rwlocks can only be unlocked from the same thread that they
      were locked by. This is achieved through RAII lock guards which cannot be
      sent across threads.

    * Mutexes and rwlocks can only be unlocked if they were previously locked.
      This is achieved by not exposing an unlocking method.

    * A condition variable can only be waited on with a locked mutex. This is
      achieved by requiring a `MutexGuard` in the `wait()` method.

    * A condition variable cannot be used concurrently with more than one mutex.
      This is guaranteed by dynamically binding a condition variable to
      precisely one mutex for its entire lifecycle. This restriction may be able
      to be relaxed in the future (a mutex is unbound when no threads are
      waiting on the condvar), but for now it is sufficient to guarantee safety.

* Condvars now support timeouts for their blocking operations. The
  implementation for these operations is provided by the system.

Due to the modification of the `Condvar` API, removal of the `std::sync::mutex`
API, and reimplementation, this is a breaking change. Most code should be fairly
easy to port using the examples in the documentation of these primitives.

[breaking-change]

Closes #17094
Closes #18003

9 years agoauto merge of #19303 : nodakai/rust/libsyntax-reject-dirs, r=alexcrichton
bors [Fri, 5 Dec 2014 00:22:58 +0000 (00:22 +0000)]
auto merge of #19303 : nodakai/rust/libsyntax-reject-dirs, r=alexcrichton

On *BSD systems, we can `open(2)` a directory and directly `read(2)` from it due to an old tradition.  We should avoid doing so by explicitly calling `fstat(2)` to check the type of the opened file.

Opening a directory as a module file can't always be avoided.  Even when there's no "path" attribute trick involved, there can always be a *directory* named `my_module.rs`.

Incidentally, remove unnecessary mutability of `&self` from `io::fs::File::stat()`.

9 years agoauto merge of #18980 : erickt/rust/reader, r=erickt
bors [Thu, 4 Dec 2014 21:33:07 +0000 (21:33 +0000)]
auto merge of #18980 : erickt/rust/reader, r=erickt

This continues the work @thestinger started in #18885 (which hasn't landed yet, so wait for that to land before landing this one). Instead of adding more methods to `BufReader`, this just allows a `&[u8]` to be used directly as a `Reader`. It also adds an impl of `Writer` for `&mut [u8]`.

9 years agocore: fix a doctest
Erick Tryzelaar [Thu, 4 Dec 2014 15:57:13 +0000 (07:57 -0800)]
core: fix a doctest

9 years agoauto merge of #19170 : erickt/rust/rustup, r=erickt
bors [Thu, 4 Dec 2014 15:03:39 +0000 (15:03 +0000)]
auto merge of #19170 : erickt/rust/rustup, r=erickt

This closes #19168.

Please be careful reviewing this since this gets used all over the place. I've tested all the options and everything appears to be working though.

9 years agoauto merge of #19167 : japaric/rust/rhs-cmp, r=aturon
bors [Thu, 4 Dec 2014 12:02:56 +0000 (12:02 +0000)]
auto merge of #19167 : japaric/rust/rhs-cmp, r=aturon

Comparison traits have gained an `Rhs` input parameter that defaults to `Self`. And now the comparison operators can be overloaded to work between different types. In particular, this PR allows the following operations (and their commutative versions):

- `&str` == `String` == `CowString`
- `&[A]` == `&mut [B]` == `Vec<C>` == `CowVec<D>` == `[E, ..N]` (for `N` up to 32)
- `&mut A` == `&B` (for `Sized` `A` and `B`)

Where `A`, `B`, `C`, `D`, `E` may be different types that implement `PartialEq`. For example, these comparisons are now valid: `string == "foo"`, and `vec_of_strings == ["Hello", "world"]`.

[breaking-change]s

Since the `==` may now work on different types, operations that relied on the old "same type restriction" to drive type inference, will need to be type annotated. These are the most common fallout cases:

- `some_vec == some_iter.collect()`: `collect` needs to be type annotated: `collect::<Vec<_>>()`
- `slice == &[a, b, c]`: RHS doesn't get coerced to an slice, use an array instead `[a, b, c]`
- `lhs == []`: Change expression to `lhs.is_empty()`
- `lhs == some_generic_function()`: Type annotate the RHS as necessary

cc #19148

r? @aturon

9 years agoauto merge of #19449 : nikomatsakis/rust/unboxed-closure-fn-impl, r=pcwalton
bors [Thu, 4 Dec 2014 08:52:47 +0000 (08:52 +0000)]
auto merge of #19449 : nikomatsakis/rust/unboxed-closure-fn-impl, r=pcwalton

Implement the `Fn` trait for bare fn pointers in the compiler rather
than doing it using hard-coded impls. This means that it works also
for more complex fn types involving bound regions.

9 years agoAdjust nits from pcwalton.
Niko Matsakis [Thu, 4 Dec 2014 05:57:38 +0000 (00:57 -0500)]
Adjust nits from pcwalton.

9 years agoAdd a cache so we don't create so many shims.
Niko Matsakis [Thu, 4 Dec 2014 01:23:15 +0000 (20:23 -0500)]
Add a cache so we don't create so many shims.

9 years agoImplement the `Fn` trait for bare fn pointers in the compiler rather than doing it...
Niko Matsakis [Mon, 1 Dec 2014 14:23:40 +0000 (09:23 -0500)]
Implement the `Fn` trait for bare fn pointers in the compiler rather than doing it using hard-coded impls. This means that it works also for more complex fn types involving bound regions. Fixes #19126.

9 years agoauto merge of #18613 : steveklabnik/rust/ownership_guide, r=huonw
bors [Thu, 4 Dec 2014 04:52:37 +0000 (04:52 +0000)]
auto merge of #18613 : steveklabnik/rust/ownership_guide, r=huonw

This is a work in progress, but this should get *extensive* review, so I'm putting it up early and often.

This is the start of a draft of the new 'ownership guide,' which explains ownership, borrowing, etc. I'm feeling better about this framing than last time's, but we'll see.

9 years agolibstd: explicitly disallow io::fs::File to open a directory.
NODA, Kai [Tue, 2 Dec 2014 22:06:59 +0000 (06:06 +0800)]
libstd: explicitly disallow io::fs::File to open a directory.

On *BSD systems, we can open(2) a directory and directly read(2) from
it due to an old tradition.  We should avoid doing so by explicitly
calling fstat(2) to check the type of the opened file.

Opening a directory as a module file can't always be avoided.
Even when there's no "path" attribute trick involved, there can always
be a *directory* named "my_module.rs".

Fix #12460

Signed-off-by: NODA, Kai <nodakai@gmail.com>
9 years agolibstd: io::fs::File::stat() need not to take &mut self.
NODA, Kai [Tue, 25 Nov 2014 14:12:24 +0000 (22:12 +0800)]
libstd: io::fs::File::stat() need not to take &mut self.

The same goes for sys::fs::FileDesc::fstat() on Windows.

Signed-off-by: NODA, Kai <nodakai@gmail.com>
9 years agoauto merge of #18770 : pczarn/rust/hash_map-explicit-shrinking, r=Gankro
bors [Thu, 4 Dec 2014 01:07:48 +0000 (01:07 +0000)]
auto merge of #18770 : pczarn/rust/hash_map-explicit-shrinking, r=Gankro

Part of enforcing capacity-related conventions, for #18424, the collections reform.

Implements `fn shrink_to_fit` for HashMap.
The `reserve` method now takes as an argument the *extra* space to reserve.

9 years agorustup: simplify downloading packages
Erick Tryzelaar [Wed, 3 Dec 2014 23:14:30 +0000 (15:14 -0800)]
rustup: simplify downloading packages

9 years agorustup: extract the tarballs as part of installation
Erick Tryzelaar [Mon, 1 Dec 2014 08:00:43 +0000 (00:00 -0800)]
rustup: extract the tarballs as part of installation

9 years agorustup: rewrite to protect against truncation
Erick Tryzelaar [Mon, 1 Dec 2014 07:34:19 +0000 (23:34 -0800)]
rustup: rewrite to protect against truncation

This closes #19168. It's possible that if the downloading of `rustup.sh`
is interrupted, bad things could happen, such as running a naked
"rm -rf /" instead of "rm -rf /path/to/tmpdir". This wraps rustup.sh's
functionality in a function that gets called at the last time that should
protect us from these truncation errors.

9 years agorustup: factor out installing packages into a function
Erick Tryzelaar [Mon, 1 Dec 2014 04:44:03 +0000 (20:44 -0800)]
rustup: factor out installing packages into a function

9 years agorustup: factor out downloading and extracting the snapshot tarballs
Erick Tryzelaar [Wed, 3 Dec 2014 23:17:32 +0000 (15:17 -0800)]
rustup: factor out downloading and extracting the snapshot tarballs

9 years agoauto merge of #18749 : nikomatsakis/rust/builtin-bounds-like-other-traits, r=pcwalton
bors [Wed, 3 Dec 2014 22:57:40 +0000 (22:57 +0000)]
auto merge of #18749 : nikomatsakis/rust/builtin-bounds-like-other-traits, r=pcwalton

Treat builtin bounds like all other kinds of trait matches. Introduce a simple hashset in the fulfillment context to catch cases where we register the exact same obligation twice. This helps prevent duplicate error reports but also handles the recursive obligations created by builtin bounds.

r? @pcwalton
cc @FlaPer87

9 years agorustup: factor out the install flags into a CFG_INSTALL_FLAGS variable
Erick Tryzelaar [Mon, 1 Dec 2014 04:13:31 +0000 (20:13 -0800)]
rustup: factor out the install flags into a CFG_INSTALL_FLAGS variable

9 years agorustup: rename TMP_DIR to CFG_TMP_DIR
Erick Tryzelaar [Mon, 1 Dec 2014 04:08:06 +0000 (20:08 -0800)]
rustup: rename TMP_DIR to CFG_TMP_DIR

9 years agorustup: add a RUST_ prefix to the rust-specific variables
Erick Tryzelaar [Mon, 1 Dec 2014 04:06:24 +0000 (20:06 -0800)]
rustup: add a RUST_ prefix to the rust-specific variables

9 years agorustup: probe for the existance of tar
Erick Tryzelaar [Mon, 1 Dec 2014 03:51:52 +0000 (19:51 -0800)]
rustup: probe for the existance of tar

9 years agorustup: make rustup executable
Erick Tryzelaar [Mon, 1 Dec 2014 05:17:08 +0000 (21:17 -0800)]
rustup: make rustup executable

9 years agowhitespace cleanup
Erick Tryzelaar [Mon, 1 Dec 2014 03:39:26 +0000 (19:39 -0800)]
whitespace cleanup

9 years agoauto merge of #19502 : alexcrichton/rust/issue-19501, r=sfackler
bors [Wed, 3 Dec 2014 18:52:48 +0000 (18:52 +0000)]
auto merge of #19502 : alexcrichton/rust/issue-19501, r=sfackler

I don't have enough time to investigate this thoroughly, so for now let's get
the queue moving by ignoring this test.

cc #19501

9 years agotest: Ignore issue-19501 pretty for now
Alex Crichton [Wed, 3 Dec 2014 17:22:13 +0000 (09:22 -0800)]
test: Ignore issue-19501 pretty for now

I don't have enough time to investigate this thoroughly, so for now let's get
the queue moving by ignoring this test.

cc #19501

9 years agoDeprecate Equiv
Jorge Aparicio [Thu, 27 Nov 2014 04:50:12 +0000 (23:50 -0500)]
Deprecate Equiv

9 years agoFix fallout
Jorge Aparicio [Fri, 21 Nov 2014 06:20:04 +0000 (01:20 -0500)]
Fix fallout

9 years agoRemove unused transmutes from tests
Jorge Aparicio [Sun, 23 Nov 2014 00:45:35 +0000 (19:45 -0500)]
Remove unused transmutes from tests

9 years agoReplace `equiv` method calls with `==` operator sugar
Jorge Aparicio [Fri, 21 Nov 2014 01:25:27 +0000 (20:25 -0500)]
Replace `equiv` method calls with `==` operator sugar

9 years agoOverload the `==` operator
Jorge Aparicio [Fri, 21 Nov 2014 05:14:05 +0000 (00:14 -0500)]
Overload the `==` operator

- String == &str == CowString
- Vec ==  &[T] ==  &mut [T] == [T, ..N] == CowVec
- InternedString == &str

9 years agoNew Guide: Ownership
Steve Klabnik [Tue, 4 Nov 2014 07:52:36 +0000 (02:52 -0500)]
New Guide: Ownership

This replaces the previous "Lifetimes guide," since we are discussing
things from an owernship perspective now.

9 years agoFIXME(#19481) -- workaround valgrind cleanup failure (but the code is nicer this...
Niko Matsakis [Tue, 25 Nov 2014 12:54:24 +0000 (07:54 -0500)]
FIXME(#19481) -- workaround valgrind cleanup failure (but the code is nicer this way anyhow)

9 years agoCorrect various compile-fail tests. Most of the changes are because we
Niko Matsakis [Sat, 8 Nov 2014 01:23:33 +0000 (20:23 -0500)]
Correct various compile-fail tests. Most of the changes are because we
now don't print duplicate errors within one context, so I sometimes
had to break functions into two functions.

9 years agoTreat builtin bounds like all other kinds of trait matches. Introduce a simple hashse...
Niko Matsakis [Fri, 7 Nov 2014 21:14:32 +0000 (16:14 -0500)]
Treat builtin bounds like all other kinds of trait matches. Introduce a simple hashset in the fulfillment context to catch cases where we register the exact same obligation twice. This helps prevent duplicate error reports but also handles the recursive obligations created by builtin bounds.

9 years agoTest PartialEq multidispatch
Jorge Aparicio [Fri, 21 Nov 2014 00:32:04 +0000 (19:32 -0500)]
Test PartialEq multidispatch

9 years agolibcore: add `Rhs` input parameter to comparison traits
Jorge Aparicio [Thu, 20 Nov 2014 23:17:37 +0000 (18:17 -0500)]
libcore: add `Rhs` input parameter to comparison traits

9 years agoauto merge of #19460 : steveklabnik/rust/conf_fixes, r=alexcrichton
bors [Tue, 2 Dec 2014 17:47:14 +0000 (17:47 +0000)]
auto merge of #19460 : steveklabnik/rust/conf_fixes, r=alexcrichton

9 years agoremove two unneccesary directories from configure
Steve Klabnik [Tue, 2 Dec 2014 14:21:28 +0000 (09:21 -0500)]
remove two unneccesary directories from configure

9 years agoauto merge of #19443 : nodakai/rust/another-missing-extracflags, r=alexcrichton
bors [Tue, 2 Dec 2014 12:02:06 +0000 (12:02 +0000)]
auto merge of #19443 : nodakai/rust/another-missing-extracflags, r=alexcrichton

rust-lang/rust@102b1a5bf1a60eeafb752844e5c98fe5f4e3b992 was not enough!

9 years agoauto merge of #19357 : michaelwoerister/rust/fix-issue-18791, r=alexcrichton
bors [Tue, 2 Dec 2014 10:06:58 +0000 (10:06 +0000)]
auto merge of #19357 : michaelwoerister/rust/fix-issue-18791, r=alexcrichton

One negative side-effect of this change is that there might be quite a bit of copying strings out of the codemap, i.e. one copy for every block that gets translated, just for taking a look at the last character of the block. If this turns out to cause a performance problem then `CodeMap::span_to_snippet()` could be changed return `Option<&str>` instead of `Option<String>`.

Fixes #18791

9 years agoauto merge of #19427 : scialex/rust/doc-attr-macros, r=sfackler
bors [Tue, 2 Dec 2014 07:22:02 +0000 (07:22 +0000)]
auto merge of #19427 : scialex/rust/doc-attr-macros, r=sfackler

this allows one to, for example, use #[doc = $macro_var ] in macros.

9 years agoauto merge of #19450 : jbapple/rust/pq-pop-time, r=Gankro
bors [Tue, 2 Dec 2014 02:52:15 +0000 (02:52 +0000)]
auto merge of #19450 : jbapple/rust/pq-pop-time, r=Gankro

pop calls siftdown, siftdown calls siftdown_range, and siftdown_range
loops on an index that can start as low as 0 and approximately doubles
each iteration.

9 years agoPop on binary heaps does not have constant time complexity.
Jim Apple [Tue, 2 Dec 2014 02:12:48 +0000 (18:12 -0800)]
Pop on binary heaps does not have constant time complexity.

pop calls siftdown, siftdown calls siftdown_range, and siftdown_range
loops on an index that can start as low as 0 and approximately doubles
each iteration.

9 years agodebuginfo: Fix multi-byte character related bug in cleanup scope handling.
Michael Woerister [Thu, 27 Nov 2014 12:54:01 +0000 (13:54 +0100)]
debuginfo: Fix multi-byte character related bug in cleanup scope handling.

Also see issue #18791.

9 years agoauto merge of #19439 : nodakai/rust/liblibc-getsid, r=acrichto
bors [Tue, 2 Dec 2014 00:22:00 +0000 (00:22 +0000)]
auto merge of #19439 : nodakai/rust/liblibc-getsid, r=acrichto

```
#include <unistd.h>

pid_t getsid(pid_t pid);

CONFORMING TO
       SVr4, POSIX.1-2001.
```

9 years agoauto merge of #19405 : jfager/rust/de-match-pyramid, r=bstrie
bors [Mon, 1 Dec 2014 21:56:53 +0000 (21:56 +0000)]
auto merge of #19405 : jfager/rust/de-match-pyramid, r=bstrie

No semantic changes, no enabling `if let` where it wasn't already enabled.

9 years agotest/run-make: another missing $(EXTRACFLAGS).
NODA, Kai [Sun, 23 Nov 2014 13:36:42 +0000 (21:36 +0800)]
test/run-make: another missing $(EXTRACFLAGS).

rust-lang/rust@102b1a5bf1a60eeafb752844e5c98fe5f4e3b992 was not enough!

Signed-off-by: NODA, Kai <nodakai@gmail.com>
9 years agoliblibc: getsid() was missing though setsid() was already there.
NODA, Kai [Mon, 1 Dec 2014 18:39:40 +0000 (02:39 +0800)]
liblibc: getsid() was missing though setsid() was already there.

include <unistd.h>

pid_t getsid(pid_t pid);

CONFORMING TO
       SVr4, POSIX.1-2001.

Signed-off-by: NODA, Kai <nodakai@gmail.com>
9 years agoauto merge of #19436 : lifthrasiir/rust/rustdoc-short-src-paths, r=alexcrichton
bors [Mon, 1 Dec 2014 17:51:55 +0000 (17:51 +0000)]
auto merge of #19436 : lifthrasiir/rust/rustdoc-short-src-paths, r=alexcrichton

Before: `doc/src/collections/home/lifthrasiir/git/rust/src/libcollections/vec.rs.html`
After: `doc/src/collections/vec.rs.html`

If the source code is in the parent dirs relative to the crate root, `..` is replaced with `up` as expected. Any other error like non-UTF-8 paths or drive-relative paths falls back to the absolute path.

There might be a way to improve on false negatives, but this alone should be enough for fixing #18370.

9 years agoadded negative test for macro expansion in attributes
Alexander Light [Mon, 1 Dec 2014 16:08:29 +0000 (11:08 -0500)]
added negative test for macro expansion in attributes

9 years agorustdoc: Use relative paths in source renders.
Kang Seonghoon [Mon, 1 Dec 2014 11:46:51 +0000 (20:46 +0900)]
rustdoc: Use relative paths in source renders.

Before: doc/src/collections/home/lifthrasiir/git/rust/src/libcollections/vec.rs.html
After: doc/src/collections/vec.rs.html

If the source code is in the parent dirs relative to the crate root,
`..` is replaced with `up` as expected. Any other error like non-UTF-8
paths or drive-relative paths falls back to the absolute path.

There might be a way to improve on false negatives, but this alone
should be enough for fixing #18370.

9 years agoauto merge of #19417 : alexcrichton/rust/issue-19383, r=huonw
bors [Mon, 1 Dec 2014 07:11:53 +0000 (07:11 +0000)]
auto merge of #19417 : alexcrichton/rust/issue-19383, r=huonw

We only build LLVM for the host architecture, not the target architecture, so
this was just a minor typo in the parameters uses.

Closes #19383

9 years agoauto merge of #19425 : frewsxcv/rust/patch-1, r=steveklabnik
bors [Mon, 1 Dec 2014 05:11:50 +0000 (05:11 +0000)]
auto merge of #19425 : frewsxcv/rust/patch-1, r=steveklabnik

![](http://img2.wikia.nocookie.net/__cb20140809223829/disney/images/5/56/Darkwing_Duck_Poster_Promo.jpg)

9 years agoAdd test for expanding doc strings in macros.
Alexander Light [Mon, 1 Dec 2014 02:05:32 +0000 (21:05 -0500)]
Add test for expanding doc strings in macros.

9 years agoauto merge of #19418 : P1start/rust/unsafe-extern-trait, r=alexcrichton
bors [Mon, 1 Dec 2014 01:56:52 +0000 (01:56 +0000)]
auto merge of #19418 : P1start/rust/unsafe-extern-trait, r=alexcrichton

Fixes #19398.

9 years agostd: add Reader impl for &[u8]
Erick Tryzelaar [Mon, 1 Dec 2014 00:55:53 +0000 (16:55 -0800)]
std: add Reader impl for &[u8]

9 years agostd: add tests for the Vec<u8> Writer impl
Erick Tryzelaar [Sat, 15 Nov 2014 06:50:47 +0000 (22:50 -0800)]
std: add tests for the Vec<u8> Writer impl

9 years agofix missed switch pointed out in review plus a few others
jfager [Sun, 30 Nov 2014 23:11:40 +0000 (18:11 -0500)]
fix missed switch pointed out in review plus a few others

9 years agostd: Change the behavior of `reserve` for HashMap.
Piotr Czarnecki [Sat, 8 Nov 2014 16:26:52 +0000 (17:26 +0100)]
std: Change the behavior of `reserve` for HashMap.

HashMap's `reserve` method now takes as an argument the *extra* space
to reserve.

[breaking-change]

9 years agostd: Remove implicit shrinking from hash_map.
Piotr Czarnecki [Mon, 17 Nov 2014 13:23:21 +0000 (14:23 +0100)]
std: Remove implicit shrinking from hash_map.

Implements fn shrink_to_fit for HashMap.

9 years agoauto merge of #19415 : P1start/rust/error-message-fixes, r=alexcrichton
bors [Sun, 30 Nov 2014 19:46:53 +0000 (19:46 +0000)]
auto merge of #19415 : P1start/rust/error-message-fixes, r=alexcrichton

This is the style followed by most other error messages.

9 years agoauto merge of #19411 : lifthrasiir/rust/asm-clobbers-expanded, r=alexcrichton
bors [Sun, 30 Nov 2014 17:21:48 +0000 (17:21 +0000)]
auto merge of #19411 : lifthrasiir/rust/asm-clobbers-expanded, r=alexcrichton

I.e. we should not prematurely build operand constraints at the expansion time. Otherwise `--pretty expanded` diverges:

```
$ cat t.rs
#![feature(asm)]

pub fn main() { unsafe { asm!("" : : : "hello", "world") }; }

$ rustc t.rs --pretty
#![feature(asm)]

pub fn main() { unsafe { asm!("" : : : "hello" , "world") }; }

$ rustc t.rs --pretty expanded
#![feature(asm)]
#![feature(phase)]
#![no_std]
#![feature(globs)]
#[phase(plugin, link)]
extern crate "std" as std;
#[prelude_import]
use std::prelude::*;

pub fn main() { unsafe { asm!("":  :  : "~{hello},~{world}") }; }
```

(The last code *does* compile, but won't do the expected thing.)

9 years agoallow macro expansions in attributes
Alexander Light [Sun, 30 Nov 2014 14:51:15 +0000 (09:51 -0500)]
allow macro expansions in attributes

9 years agoFix typo in tests makefile
Corey Farwell [Sun, 30 Nov 2014 14:07:36 +0000 (09:07 -0500)]
Fix typo in tests makefile

9 years agoauto merge of #19369 : seanmonstar/rust/cow-str, r=alexcrichton
bors [Sun, 30 Nov 2014 10:21:49 +0000 (10:21 +0000)]
auto merge of #19369 : seanmonstar/rust/cow-str, r=alexcrichton

This implementation existed on MaybeOwned, but has been lost in the
transition to Cows. Let's put it back.

@aturon r?

9 years agotrans: Eliminated redundant allocations.
Kang Seonghoon [Sun, 30 Nov 2014 09:52:44 +0000 (18:52 +0900)]
trans: Eliminated redundant allocations.

9 years agoFix the ordering of `unsafe` and `extern` in methods
P1start [Sun, 30 Nov 2014 08:33:04 +0000 (21:33 +1300)]
Fix the ordering of `unsafe` and `extern` in methods

This breaks code that looks like this:

    trait Foo {
        extern "C" unsafe fn foo();
    }

    impl Foo for Bar {
        extern "C" unsafe fn foo() { ... }
    }

Change such code to look like this:

    trait Foo {
        unsafe extern "C" fn foo();
    }

    impl Foo for Bar {
        unsafe extern "C" fn foo() { ... }
    }

Fixes #19398.

[breaking-change]

9 years agomk: Use host llvm linkage paths, not target ones
Alex Crichton [Sun, 30 Nov 2014 08:01:19 +0000 (00:01 -0800)]
mk: Use host llvm linkage paths, not target ones

We only build LLVM for the host architecture, not the target architecture, so
this was just a minor typo in the parameters uses.

Closes #19383

9 years agoAdjust some error messages to start with a lowercase letter and not finish with a...
P1start [Fri, 28 Nov 2014 06:01:41 +0000 (19:01 +1300)]
Adjust some error messages to start with a lowercase letter and not finish with a full stop

9 years agoauto merge of #19365 : frewsxcv/rust/getopts-cleanup, r=alexcrichton
bors [Sun, 30 Nov 2014 06:56:41 +0000 (06:56 +0000)]
auto merge of #19365 : frewsxcv/rust/getopts-cleanup, r=alexcrichton

* Remove public reexports, as a part of #19253
* Rename getopts::Fail_ to getopts::Fail
 * Didn't see a reason for the suffixed '_'
* Removed getopts::FailType
 * Looked like it was only beings used for tests; refactored the tests
   to stop requiring it
* A few other non-breaking trivial refactoring changes

[breaking-change]

9 years agosyntax: Make `asm!` clobbers a proper vector.
Kang Seonghoon [Sun, 30 Nov 2014 02:56:31 +0000 (11:56 +0900)]
syntax: Make `asm!` clobbers a proper vector.

Otherwise `--pretty expanded` diverges.

9 years agoauto merge of #19392 : murarth/rust/rustc-compile-twice, r=nick29581
bors [Sat, 29 Nov 2014 21:51:34 +0000 (21:51 +0000)]
auto merge of #19392 : murarth/rust/rustc-compile-twice, r=nick29581

Closes #19371

9 years agoReplace some verbose match statements with their `if let` equivalent.
jfager [Sat, 29 Nov 2014 21:41:21 +0000 (16:41 -0500)]
Replace some verbose match statements with their `if let` equivalent.

No semantic changes, no enabling `if let` where it wasn't already enabled.

9 years agoauto merge of #19401 : MatejLach/rust/guide_are_fix, r=steveklabnik
bors [Sat, 29 Nov 2014 17:31:32 +0000 (17:31 +0000)]
auto merge of #19401 : MatejLach/rust/guide_are_fix, r=steveklabnik

Fixes a small omission of `are` in the sentence:
`There also a few things you can do with a tuple as a whole, without...`
r @steveklabnik?

9 years agoFix rustc panic on second compile_input
Murarth [Sat, 29 Nov 2014 04:56:09 +0000 (21:56 -0700)]
Fix rustc panic on second compile_input

9 years agoFix a simple typo
Matej Lach [Sat, 29 Nov 2014 13:26:32 +0000 (13:26 +0000)]
Fix a simple typo

9 years agoauto merge of #19345 : steveklabnik/rust/gh19344, r=alexcrichton
bors [Fri, 28 Nov 2014 15:11:24 +0000 (15:11 +0000)]
auto merge of #19345 : steveklabnik/rust/gh19344, r=alexcrichton

Fixes #19344

9 years agoreword faq to remove reference to indexing strings
Steve Klabnik [Wed, 26 Nov 2014 21:48:06 +0000 (16:48 -0500)]
reword faq to remove reference to indexing strings

Fixes #19344

9 years agoauto merge of #19366 : liigo/rust/mipsel-linux, r=alexcrichton
bors [Fri, 28 Nov 2014 11:31:22 +0000 (11:31 +0000)]
auto merge of #19366 : liigo/rust/mipsel-linux, r=alexcrichton

Since #19076 was merged, I believe mipsel + linux maybe need add to the list here, too.

9 years agoauto merge of #19363 : michaelwoerister/rust/support-unboxed-closures, r=alexcrichton
bors [Fri, 28 Nov 2014 09:31:24 +0000 (09:31 +0000)]
auto merge of #19363 : michaelwoerister/rust/support-unboxed-closures, r=alexcrichton

This PR lets `rustc` generate debuginfo for variables captured by unboxed closures.

Fixes #19356

@nikomatsakis This PR will probably conflict with #19338. If this gets merged before, you should be able to just leave the test case as it is (maybe remove the `#![feature(unboxed_closures)]` directive).

9 years agoauto merge of #19360 : olivren/rust/master, r=Gankro
bors [Fri, 28 Nov 2014 07:31:26 +0000 (07:31 +0000)]
auto merge of #19360 : olivren/rust/master, r=Gankro

The previous code was giving an incorrect result (not x/3).

Also, this function does not work with signed integers. It now accepts `u32` instead of `i32`.

9 years agoimpl Str for CowString
Sean McArthur [Fri, 28 Nov 2014 03:21:38 +0000 (19:21 -0800)]
impl Str for CowString

This implementation existed on MaybeOwned, but has been lost in the
transition to Cows. Let's put it back.

9 years agoauto merge of #19355 : vhbit/rust/ios-backtrace-fix, r=alexcrichton
bors [Fri, 28 Nov 2014 02:46:24 +0000 (02:46 +0000)]
auto merge of #19355 : vhbit/rust/ios-backtrace-fix, r=alexcrichton

9 years agolibrustrt: stack_overflow support mipsel linux
Liigo Zhuang [Tue, 25 Nov 2014 11:16:08 +0000 (19:16 +0800)]
librustrt: stack_overflow support mipsel linux

9 years agoauto merge of #19354 : barosl/rust/strconv-doc-fix, r=steveklabnik
bors [Fri, 28 Nov 2014 00:01:23 +0000 (00:01 +0000)]
auto merge of #19354 : barosl/rust/strconv-doc-fix, r=steveklabnik

- `int_to_str_bytes_common()` doesn't have a return value.
- `float_to_str_bytes_common()` has an old-style doc comment.

9 years agoauto merge of #19349 : tomjakubowski/rust/rustdoc-struct-variant-vis, r=sfackler
bors [Thu, 27 Nov 2014 21:46:24 +0000 (21:46 +0000)]
auto merge of #19349 : tomjakubowski/rust/rustdoc-struct-variant-vis, r=sfackler

Teach rustdoc that struct variant fields have inherited visibility.

Fix #19048

9 years agogetopts: cleanup, renames, remove reexports
Corey Farwell [Thu, 27 Nov 2014 19:39:50 +0000 (14:39 -0500)]
getopts: cleanup, renames, remove reexports

* Remove public reexports, as a part of #19253
* Rename getopts::Fail_ to getopts::Fail
 * Didn't see a reason for the suffixed '_'
* Removed getopts::FailType
 * Looked like it was only beings used for tests; refactored the tests
   to stop requiring it
* A few other non-breaking trivial refactoring changes

[breaking-change]

9 years agoauto merge of #19112 : steveklabnik/rust/doc_rc, r=Gankro
bors [Thu, 27 Nov 2014 17:26:22 +0000 (17:26 +0000)]
auto merge of #19112 : steveklabnik/rust/doc_rc, r=Gankro

9 years agodebuginfo: Make variables captured in unboxed closures available in debuginfo.
Michael Woerister [Thu, 27 Nov 2014 14:52:16 +0000 (15:52 +0100)]
debuginfo: Make variables captured in unboxed closures available in debuginfo.

9 years agoFix example code for unreachable!
olivren [Thu, 27 Nov 2014 14:25:29 +0000 (15:25 +0100)]
Fix example code for unreachable!

The previous code was giving an incorrect result (not x/3).

9 years agoauto merge of #19348 : SimonSapin/rust/patch-9, r=huonw
bors [Thu, 27 Nov 2014 10:11:19 +0000 (10:11 +0000)]
auto merge of #19348 : SimonSapin/rust/patch-9, r=huonw

9 years agoFixed iOS build after Iter stab
Valerii Hiora [Thu, 27 Nov 2014 09:33:56 +0000 (11:33 +0200)]
Fixed iOS build after Iter stab

9 years agoDocumentation fix for std::num::strconv
Barosl Lee [Thu, 27 Nov 2014 08:04:31 +0000 (17:04 +0900)]
Documentation fix for std::num::strconv

- int_to_str_bytes_common() doesn't have a return value.
- float_to_str_bytes_common() has an old-style doc comment.

9 years agoauto merge of #19343 : sfackler/rust/less-special-attrs, r=alexcrichton
bors [Thu, 27 Nov 2014 06:41:17 +0000 (06:41 +0000)]
auto merge of #19343 : sfackler/rust/less-special-attrs, r=alexcrichton

Descriptions and licenses are handled by Cargo now, so there's no reason
to keep these attributes around.

9 years agoauto merge of #19342 : alexcrichton/rust/rollup, r=alexcrichton
bors [Thu, 27 Nov 2014 04:32:12 +0000 (04:32 +0000)]
auto merge of #19342 : alexcrichton/rust/rollup, r=alexcrichton

9 years agoMore test fixes and rebase conflicts!
Alex Crichton [Wed, 26 Nov 2014 19:17:23 +0000 (11:17 -0800)]
More test fixes and rebase conflicts!