]> git.lizzy.rs Git - rust.git/log
rust.git
7 years agoUpdate VecDeque documentation to specify direction of index 0 (#34920)
abhi [Fri, 22 Jul 2016 12:20:54 +0000 (17:50 +0530)]
Update VecDeque documentation to specify direction of index 0 (#34920)

7 years agotry to recover the non-matching types in projection errors
Ariel Ben-Yehuda [Wed, 20 Jul 2016 23:13:14 +0000 (02:13 +0300)]
try to recover the non-matching types in projection errors

The type equation in projection takes place under a binder and a snapshot, which
we can't easily take types out of. Instead, when encountering a projection error,
try to re-do the projection and find the type error then.

This fails to produce a sane type error when the failure was a "leak_check" failure.
I can't think of a sane way to show *these*, so I just left them use the old crappy
representation, and added a test to make sure we don't break them.

7 years agoremove the now-unused multiline error code
Ariel Ben-Yehuda [Mon, 18 Jul 2016 22:10:19 +0000 (01:10 +0300)]
remove the now-unused multiline error code

7 years agorefactor constant evaluation error reporting
Ariel Ben-Yehuda [Tue, 19 Jul 2016 21:02:56 +0000 (00:02 +0300)]
refactor constant evaluation error reporting

Refactor constant evaluation to use a single error reporting function
that reports a type-error-like message.

Also, unify all error codes with the "constant evaluation error" message
to just E0080, and similarly for a few other duplicate codes. The old
situation was a total mess, and now that we have *something* we can
further iterate on the UX.

7 years agoswitch projection errors to use the new type error messages
Ariel Ben-Yehuda [Mon, 18 Jul 2016 22:02:47 +0000 (01:02 +0300)]
switch projection errors to use the new type error messages

Unfortunately, projection errors do not come with a nice set of
mismatched types. This is because the type equality check occurs
within a higher-ranked context. Therefore, only the type error
is reported. This is ugly but was always the situation.

I will introduce better errors for the lower-ranked case in
another commit.

Fixes the last known occurence of #31173

7 years agoswitch compare_method to new-style trait error reporting
Ariel Ben-Yehuda [Mon, 18 Jul 2016 20:13:34 +0000 (23:13 +0300)]
switch compare_method to new-style trait error reporting

7 years agorefactor type error reporting
Ariel Ben-Yehuda [Sat, 16 Jul 2016 20:18:20 +0000 (23:18 +0300)]
refactor type error reporting

7 years agoremove rustc_typeck::same_type_err
Ariel Ben-Yehuda [Sat, 16 Jul 2016 16:38:17 +0000 (19:38 +0300)]
remove rustc_typeck::same_type_err

7 years agoremove never-called type-error reporting functions
Ariel Ben-Yehuda [Fri, 8 Jul 2016 19:51:29 +0000 (22:51 +0300)]
remove never-called type-error reporting functions

7 years agoAuto merge of #34771 - murarth:string-insert-str, r=alexcrichton
bors [Fri, 22 Jul 2016 08:36:22 +0000 (01:36 -0700)]
Auto merge of #34771 - murarth:string-insert-str, r=alexcrichton

Add method `String::insert_str`

7 years agoimprove const eval error reporting on "" and b"" casts
Oliver Schneider [Fri, 22 Jul 2016 07:34:44 +0000 (09:34 +0200)]
improve const eval error reporting on "" and b"" casts

7 years agoAuto merge of #34724 - mitchmindtree:mpsc_receiver_try_recv, r=alexcrichton
bors [Fri, 22 Jul 2016 05:39:48 +0000 (22:39 -0700)]
Auto merge of #34724 - mitchmindtree:mpsc_receiver_try_recv, r=alexcrichton

Add a method to the mpsc::Receiver for producing a non-blocking iterator

Currently, the `mpsc::Receiver` offers methods for receiving values in both blocking (`recv`) and non-blocking (`try_recv`) flavours. However only blocking iteration over values is supported. This PR adds a non-blocking iterator to complement the `try_recv` method, just as the blocking iterator complements the `recv` method.

Use-case
-------------

I predominantly use rust in my work on real-time systems and in particular real-time audio generation/processing. I use `mpsc::channel`s to communicate between threads in a purely non-blocking manner. I.e. I might send messages from the GUI thread to the audio thread to update the state of the dsp-graph, or from the audio thread to the GUI thread to display the RMS of each node. These are just a couple examples (I'm probably using 30+ channels across my various projects). I almost exclusively use the `mpsc::Receiver::try_recv` method to avoid blocking any of the real-time threads and causing unwanted glitching/stuttering. Now that I mention it, I can't think of a single time that I personally have used the `recv` method (though I can of course see why it would be useful, and perhaps the common case for many people).

As a result of this experience, I can't help but feel there is a large hole in the `Receiver` API.

| blocking | non-blocking |
|------------|--------------------|
| `recv` | `try_recv` |
| `iter` | ðŸ™€   |

For the most part, I've been working around this using `while let Ok(v) = r.try_recv() { ... }`, however as nice as this is, it is clearly no match for the Iterator API.

As an example, in the majority of my channel use cases I only want to check for *n* number of messages before breaking from the loop so that I don't miss the audio IO callback or hog the GUI thread for too long when an unexpectedly large number of messages are sent. Currently, I have to write something like this:

```rust
let mut take = 100;
while let Ok(msg) = rx.try_recv() {
    // Do stuff with msg
    if take == 0 {
        break;
    }
    take -= 1;
}
```

or wrap the `try_recv` call in a `Range<usize>`/`FilterMap` iterator combo.

On the other hand, this PR would allow for the following:

```rust
for msg in rx.try_iter().take(100) {
    // Do stuff with msg
}
```

I imagine this might also be useful to game devs, embedded or anyone doing message passing across real-time threads.

7 years agoReadding lifetime parameters and removing allocation
Thomas Garcia [Fri, 22 Jul 2016 03:55:19 +0000 (20:55 -0700)]
Readding lifetime parameters and removing allocation

7 years agoAuto merge of #34715 - scottcarr:mir-test, r=nikomatsakis
bors [Fri, 22 Jul 2016 02:44:59 +0000 (19:44 -0700)]
Auto merge of #34715 - scottcarr:mir-test, r=nikomatsakis

Add MIR Optimization Tests

I've starting working on the infrastructure for testing MIR optimizations.

The plan now is to have a set of test cases (written in Rust), compile them with -Z dump-mir, and check the MIR before and after each pass.

7 years agoAuto merge of #34544 - 3Hren:issue/xx/reinterpret-format-precision-for-strings, r...
bors [Thu, 21 Jul 2016 23:19:54 +0000 (16:19 -0700)]
Auto merge of #34544 - 3Hren:issue/xx/reinterpret-format-precision-for-strings, r=alexcrichton

feat: reinterpret `precision` field for strings

This commit changes the behavior of formatting string arguments with both width and precision fields set.

Documentation says that the `width` field is the "minimum width" that the format should take up. If the value's string does not fill up this many characters, then the padding specified by fill/alignment will be used to take up the required space.

This is true for all formatted types except string, which is truncated down to `precision` number of chars and then all of `fill`, `align` and `width` fields are completely ignored.

For example: `format!("{:/^10.8}", "1234567890);` emits "12345678". In the contrast Python version works as the expected:
```python
>>> '{:/^10.8}'.format('1234567890')
'/12345678/'
```

This commit gives back the `Python` behavior by changing the `precision` field meaning to the truncation and nothing more. The result string *will* be prepended/appended up to the `width` field with the proper `fill` char.

__However, this is the breaking change, I admit.__ Feel free to close it, but otherwise it should be mentioned in the `std::fmt` documentation somewhere near of `fill/align/width` fields description.

7 years agoAvoid processing `feature`s on unconfigured crates.
Jeffrey Seyfried [Thu, 21 Jul 2016 23:02:46 +0000 (23:02 +0000)]
Avoid processing `feature`s on unconfigured crates.

7 years agoswitch mipsel-musl to soft float
Tim Neumann [Thu, 21 Jul 2016 20:58:54 +0000 (22:58 +0200)]
switch mipsel-musl to soft float

7 years agoFix nits
ubsan [Thu, 21 Jul 2016 19:57:42 +0000 (12:57 -0700)]
Fix nits

7 years agoRemove unused methods from MultiSpan
Jonathan Turner [Thu, 21 Jul 2016 19:38:15 +0000 (12:38 -0700)]
Remove unused methods from MultiSpan

7 years agodoc: add missing pause
Tshepang Lekhonkhobe [Sat, 16 Jul 2016 09:18:53 +0000 (11:18 +0200)]
doc: add missing pause

7 years agoFix ICE happening when unresolved imports are used in patterns
Vadim Petrochenkov [Sat, 16 Jul 2016 21:15:15 +0000 (00:15 +0300)]
Fix ICE happening when unresolved imports are used in patterns

7 years agoAuto merge of #34939 - GuillaumeGomez:rollup, r=GuillaumeGomez
bors [Thu, 21 Jul 2016 11:05:34 +0000 (04:05 -0700)]
Auto merge of #34939 - GuillaumeGomez:rollup, r=GuillaumeGomez

Rollup of 7 pull requests

- Successful merges: #34854, #34855, #34880, #34895, #34911, #34921, #34930
- Failed merges: #33951, #34850

7 years agoFix issue in receiver_try_iter test where response sender would panic instead of...
mitchmindtree [Thu, 21 Jul 2016 09:32:24 +0000 (19:32 +1000)]
Fix issue in receiver_try_iter test where response sender would panic instead of break from the loop

7 years agoRollup merge of #34937 - GuillaumeGomez:hash_map_entry_debug, r=apasel422
Guillaume Gomez [Thu, 21 Jul 2016 09:27:01 +0000 (11:27 +0200)]
Rollup merge of #34937 - GuillaumeGomez:hash_map_entry_debug, r=apasel422

Add debug for hash_map::{Entry, VacantEntry, OccupiedEntry}

r? @alexcrichton

7 years agoRollup merge of #34930 - frewsxcv:vec-as-slice, r=steveklabnik
Guillaume Gomez [Thu, 21 Jul 2016 09:27:01 +0000 (11:27 +0200)]
Rollup merge of #34930 - frewsxcv:vec-as-slice, r=steveklabnik

Add doc examples for `Vec::{as_slice,as_mut_slice}`.

None

7 years agoRollup merge of #34921 - GuillaumeGomez:css_fix, r=steveklabnik
Guillaume Gomez [Thu, 21 Jul 2016 09:27:01 +0000 (11:27 +0200)]
Rollup merge of #34921 - GuillaumeGomez:css_fix, r=steveklabnik

[CSS] Fix unwanted top margin for toggle wrapper

Fixes top margin.

Before:

![before](https://cloud.githubusercontent.com/assets/3050060/16950833/72b2b956-4dc2-11e6-9d27-24507871b5a8.png)

After (check "A view into a single entry in map" toggle wrapper more precisely):

![after](https://cloud.githubusercontent.com/assets/3050060/16950839/7835c6fc-4dc2-11e6-901a-ae8c4191baca.png)

r? @steveklabnik

7 years agoRollup merge of #34919 - GuillaumeGomez:btree_map_doc, r=steveklabnik
Guillaume Gomez [Thu, 21 Jul 2016 09:27:01 +0000 (11:27 +0200)]
Rollup merge of #34919 - GuillaumeGomez:btree_map_doc, r=steveklabnik

Add doc for btree_map types

Part of #29348.

r? @steveklabnik

7 years agoRollup merge of #34911 - frewsxcv:vec-set-len, r=steveklabnik
Guillaume Gomez [Thu, 21 Jul 2016 09:27:00 +0000 (11:27 +0200)]
Rollup merge of #34911 - frewsxcv:vec-set-len, r=steveklabnik

Rewrite/expand doc examples for `Vec::set_len`.

None

7 years agoRollup merge of #34910 - alexcrichton:hard-float-mips, r=brson
Guillaume Gomez [Thu, 21 Jul 2016 09:27:00 +0000 (11:27 +0200)]
Rollup merge of #34910 - alexcrichton:hard-float-mips, r=brson

rustc: Remove soft-float from MIPS targets

Right now two MIPS targets in the compiler, `mips-unknown-linux-{gnu,musl}` both
generate object files using the soft-float ABI through LLVM by default. This is
also expressed as the `-C soft-float` codegen option and otherwise isn't used
for any other target in the compiler. This option was added quite some time ago
(back in #9617), and nowadays it's more appropriate to be done through a codegen
option.

This is motivated by #34743 which necessitated an upgrade in the CMake
installation on our bots which necessitated an upgrade in the Ubuntu version
which invalidated the MIPS compilers we were using. The new MIPS compilers
(coming from Debian I believe) all have hard float enabled by default and soft
float support not built in. This meant that we couldn't upgrade the bots
until #34841 landed because otherwise we would fail to compile C code as the
`-msoft-float` option wouldn't work.

Unfortunately, though, this means that once we upgrade the bots the C code we're
compiling will be compiled for hard float and the Rust code will be compiled
for soft float, a bad mismatch! This PR remedies the situation such that Rust
will compile with hard float as well.

If this lands it will likely produce broken nightlies for a day or two while we
get around to upgrading the bots because the current C toolchain only produces
soft-float binaries, and now rust will be hard-float. Hopefully, though, the
upgrade can go smoothly!

7 years agoRollup merge of #34895 - mark-buer:patch-1, r=steveklabnik
Guillaume Gomez [Thu, 21 Jul 2016 09:27:00 +0000 (11:27 +0200)]
Rollup merge of #34895 - mark-buer:patch-1, r=steveklabnik

Remove rustdoc reference to `walk_dir`

7 years agoRollup merge of #34890 - oconnor663:addassign, r=brson
Guillaume Gomez [Thu, 21 Jul 2016 09:27:00 +0000 (11:27 +0200)]
Rollup merge of #34890 - oconnor663:addassign, r=brson

implement AddAssign for String

Currently `String` implements `Add` but not `AddAssign`. This PR fills in that gap.

I played around with having `AddAssign` (and `Add` and `push_str`) take `AsRef<str>` instead of `&str`, but it looks like that breaks arguments that implement `Deref<Target=str>` and not `AsRef<str>`. Comments in [`libcore/convert.rs`](https://github.com/rust-lang/rust/blob/master/src/libcore/convert.rs#L207-L213) make it sound like we could fix this with a blanket impl eventually. Does anyone know what's blocking that?

7 years agoRollup merge of #34880 - xitep:master, r=steveklabnik
Guillaume Gomez [Thu, 21 Jul 2016 09:27:00 +0000 (11:27 +0200)]
Rollup merge of #34880 - xitep:master, r=steveklabnik

Make .enumerate() example self-explanatory

Should resolve #34624

7 years agoRollup merge of #34855 - GuillaumeGomez:vec_deque_doc, r=steveklabnik
Guillaume Gomez [Thu, 21 Jul 2016 09:26:59 +0000 (11:26 +0200)]
Rollup merge of #34855 - GuillaumeGomez:vec_deque_doc, r=steveklabnik

Add examples for VecDeque

Part of #29348.

r? @steveklabnik

7 years agoRollup merge of #34854 - GuillaumeGomez:linked_list_doc, r=steveklabnik
Guillaume Gomez [Thu, 21 Jul 2016 09:26:58 +0000 (11:26 +0200)]
Rollup merge of #34854 - GuillaumeGomez:linked_list_doc, r=steveklabnik

Add examples for LinkedList

Part of #29348.

r? @steveklabnik

7 years agoRollup merge of #34828 - seanmonstar:into-opton, r=alexcrichton
Guillaume Gomez [Thu, 21 Jul 2016 09:26:57 +0000 (11:26 +0200)]
Rollup merge of #34828 - seanmonstar:into-opton, r=alexcrichton

core: impl From<T> for Option<T>

First, the semantics of this `impl` seem spot on. If I have a value `T`, and I wish to make a `Option<T>`, then `Option::from(val)` should always give `Some(val)`.

Second, this allows improvement for several APIs that currently take `Option<T>` as arguments. Consider:

```rust
fn set_read_timeout(&mut self, timeout: Option<u32>) {
    // ...
}

x.set_read_timeout(Some(30));
x.set_read_timeout(Some(10));
x.set_read_timeout(None);
```

With this `impl`:

```rust
fn set_read_timeout<T: Into<Option<u32>>>(&mut self, timeout: T) {
    let timeout = timeout.into();
    // ...
}

x.set_read_timeout(30);
x.set_read_timeout(10);
x.set_read_timeout(Some(10)); // backwards compatible
x.set_read_timeout(None);
```

The change to those methods aren't included, but could be modified later.

r? @sfackler

7 years agoMake vec::Drain and binary_heap::Drain covariant
Thomas Garcia [Thu, 21 Jul 2016 08:03:40 +0000 (01:03 -0700)]
Make vec::Drain and binary_heap::Drain covariant

7 years agoadd mir optimization tests, dump-mir-dir option
Scott A Carr [Thu, 7 Jul 2016 23:40:01 +0000 (16:40 -0700)]
add mir optimization tests, dump-mir-dir option

7 years agoAuto merge of #34873 - alexcrichton:down-with-compiler-rt-for-good, r=brson
bors [Thu, 21 Jul 2016 02:02:00 +0000 (19:02 -0700)]
Auto merge of #34873 - alexcrichton:down-with-compiler-rt-for-good, r=brson

mk: Stop using cmake for compiler-rt

The compiler-rt build system has been a never ending cause of pain for Rust
unfortunately:

* The build system is very difficult to invoke and configure to only build
  compiler-rt, especially across platforms.
* The standard build system doesn't actually do what we want, not working for
  some of our platforms and requiring a significant number of patches on our end
  which are difficult to apply when updating compiler-rt.
* Compiling compiler-rt requires LLVM to be compiled, which... is a big
  dependency! This also means that over time compiler-rt is not guaranteed to
  build against older versions of LLVM (or newer versions), and we often want to
  work with multiple versions of LLVM simultaneously.

The makefiles and rustbuild already know how to compile C code, the code here is
far from the *only* C code we're compiling. This patch jettisons all logic to
work with compiler-rt's build system and just goes straight to the source. We
just list all files manually (copied from compiler-rt's
lib/builtins/CMakeLists.txt) and compile them into an archive.

It's likely that this means we'll fail to pick up new files when we upgrade
compiler-rt, but that seems like a much less significant cost to pay than what
we're currently paying.

cc #34400, first steps towards that

7 years agostd: Fix usage of SOCK_CLOEXEC
Alex Crichton [Thu, 21 Jul 2016 00:26:12 +0000 (17:26 -0700)]
std: Fix usage of SOCK_CLOEXEC

This code path was intended to only get executed on Linux, but unfortunately the
`cfg!` was malformed so it actually never got executed.

7 years agocore: impl From<T> for Option<T>
Sean McArthur [Thu, 14 Jul 2016 19:17:39 +0000 (12:17 -0700)]
core: impl From<T> for Option<T>

7 years agomk: Stop using cmake for compiler-rt
Alex Crichton [Sat, 16 Jul 2016 22:08:25 +0000 (15:08 -0700)]
mk: Stop using cmake for compiler-rt

The compiler-rt build system has been a never ending cause of pain for Rust
unfortunately:

* The build system is very difficult to invoke and configure to only build
  compiler-rt, especially across platforms.
* The standard build system doesn't actually do what we want, not working for
  some of our platforms and requiring a significant number of patches on our end
  which are difficult to apply when updating compiler-rt.
* Compiling compiler-rt requires LLVM to be compiled, which... is a big
  dependency! This also means that over time compiler-rt is not guaranteed to
  build against older versions of LLVM (or newer versions), and we often want to
  work with multiple versions of LLVM simultaneously.

The makefiles and rustbuild already know how to compile C code, the code here is
far from the *only* C code we're compiling. This patch jettisons all logic to
work with compiler-rt's build system and just goes straight to the source. We
just list all files manually (copied from compiler-rt's
lib/builtins/CMakeLists.txt) and compile them into an archive.

It's likely that this means we'll fail to pick up new files when we upgrade
compiler-rt, but that seems like a much less significant cost to pay than what
we're currently paying.

cc #34400, first steps towards that

7 years agoAuto merge of #34113 - srinivasreddy:deriving_rustfmt, r=brson
bors [Wed, 20 Jul 2016 18:24:12 +0000 (11:24 -0700)]
Auto merge of #34113 - srinivasreddy:deriving_rustfmt, r=brson

run rustfmt on libsyntax_ext/deriving folder

7 years agotrans: Make base::internalize_symbols() respect explicit linkage directives.
Michael Woerister [Wed, 20 Jul 2016 11:55:45 +0000 (07:55 -0400)]
trans: Make base::internalize_symbols() respect explicit linkage directives.

7 years agoAuto merge of #34694 - mathphreak:master, r=alexcrichton
bors [Wed, 20 Jul 2016 14:10:09 +0000 (07:10 -0700)]
Auto merge of #34694 - mathphreak:master, r=alexcrichton

Add IpAddr common methods

Per https://github.com/rust-lang/rfcs/pull/1668#issuecomment-230867962 no RFC is needed here.

The generated documentation for these methods is being weird. It shows a deprecation message referencing #27709 for each of them even though two of the referenced methods were stabilized as part of that issue. I don't know how best to address that.

7 years agoAdd doc for btree_map types
ggomez [Tue, 19 Jul 2016 12:40:42 +0000 (14:40 +0200)]
Add doc for btree_map types

7 years agoAuto merge of #33526 - steveklabnik:gh21889, r=alexcrichton
bors [Wed, 20 Jul 2016 07:48:21 +0000 (00:48 -0700)]
Auto merge of #33526 - steveklabnik:gh21889, r=alexcrichton

Add some warnings to std::env::current_exe

/cc #21889 @rust-lang/libs @semarie

I started writing this up. I'm not sure if we want to go into other things and in what depth; we don't currently have a lot of security-specific documentation to model after.

Thoughts?

7 years agoAdd the missing tracking issue field for #34931 to the receiver_try_iter stability...
mitchmindtree [Wed, 20 Jul 2016 04:49:40 +0000 (14:49 +1000)]
Add the missing tracking issue field for #34931 to the receiver_try_iter stability attributes

7 years agoAdd doc examples for `Vec::{as_slice,as_mut_slice}`.
Corey Farwell [Wed, 20 Jul 2016 00:38:35 +0000 (20:38 -0400)]
Add doc examples for `Vec::{as_slice,as_mut_slice}`.

7 years agoIntroduced `NoDelim` and modified the compiler to support it.
cgswords [Tue, 19 Jul 2016 20:00:45 +0000 (13:00 -0700)]
Introduced `NoDelim` and modified the compiler to support it.

7 years agoAdd regression test.
Jeffrey Seyfried [Tue, 19 Jul 2016 20:16:23 +0000 (20:16 +0000)]
Add regression test.

7 years agoSupport nested `macro_rules!`.
Jeffrey Seyfried [Tue, 19 Jul 2016 20:01:54 +0000 (20:01 +0000)]
Support nested `macro_rules!`.

7 years agoAuto merge of #34885 - GuillaumeGomez:btree_map_debug, r=alexcrichton
bors [Tue, 19 Jul 2016 19:50:15 +0000 (12:50 -0700)]
Auto merge of #34885 - GuillaumeGomez:btree_map_debug, r=alexcrichton

Add debug for btree_map::{Entry, VacantEntry, OccupiedEntry}

7 years agoRun rustfmt on libsyntax_ext/deriving folder
Srinivas Reddy Thatiparthy [Tue, 19 Jul 2016 17:32:06 +0000 (23:02 +0530)]
Run rustfmt on libsyntax_ext/deriving folder

7 years agore-work example
Steve Klabnik [Tue, 19 Jul 2016 16:32:56 +0000 (12:32 -0400)]
re-work example

7 years agoRewrite/expand doc examples for `Vec::set_len`.
Corey Farwell [Tue, 19 Jul 2016 02:29:05 +0000 (22:29 -0400)]
Rewrite/expand doc examples for `Vec::set_len`.

7 years ago[CSS] Fix unwanted top margin for toggle wrapper
ggomez [Tue, 19 Jul 2016 13:03:32 +0000 (15:03 +0200)]
[CSS] Fix unwanted top margin for toggle wrapper

7 years agoAuto merge of #34898 - sanxiyn:rollup, r=sanxiyn
bors [Tue, 19 Jul 2016 12:12:51 +0000 (05:12 -0700)]
Auto merge of #34898 - sanxiyn:rollup, r=sanxiyn

Rollup of 5 pull requests

- Successful merges: #34807, #34853, #34875, #34884, #34889
- Failed merges:

7 years agoAdd codegen test to make sure that closures are 'internalized' properly.
Michael Woerister [Tue, 19 Jul 2016 10:22:35 +0000 (06:22 -0400)]
Add codegen test to make sure that closures are 'internalized' properly.

7 years agoAdd debug for btree_map::{Entry, VacantEntry, OccupiedEntry}
Guillaume Gomez [Sun, 17 Jul 2016 15:28:00 +0000 (17:28 +0200)]
Add debug for btree_map::{Entry, VacantEntry, OccupiedEntry}

7 years agoFix wrong condition in base::internalize_symbols().
Michael Woerister [Tue, 19 Jul 2016 09:47:28 +0000 (05:47 -0400)]
Fix wrong condition in base::internalize_symbols().

7 years agoAuto merge of #33974 - habnabit:eintr-retry-for-read-iterators, r=alexcrichton
bors [Tue, 19 Jul 2016 08:20:50 +0000 (01:20 -0700)]
Auto merge of #33974 - habnabit:eintr-retry-for-read-iterators, r=alexcrichton

Retry on EINTR in Bytes and Chars.

>Since Bytes and Chars called directly into Read::read, they didn't use any of the retrying wrappers. This allows both iterator types to retry.

7 years agomk: Remove -Wall -Werror everywhere
Alex Crichton [Sat, 16 Jul 2016 22:07:35 +0000 (15:07 -0700)]
mk: Remove -Wall -Werror everywhere

We're not writing C code, so there's not really much of a reason for us to get
warnings and errors from code we haven't written!

7 years agorustc: Remove soft-float from MIPS targets
Alex Crichton [Mon, 18 Jul 2016 23:25:11 +0000 (16:25 -0700)]
rustc: Remove soft-float from MIPS targets

Right now two MIPS targets in the compiler, `mips-unknown-linux-{gnu,musl}` both
generate object files using the soft-float ABI through LLVM by default. This is
also expressed as the `-C soft-float` codegen option and otherwise isn't used
for any other target in the compiler. This option was added quite some time ago
(back in #9617), and nowadays it's more appropriate to be done through a codegen
option.

This is motivated by #34743 which necessitated an upgrade in the CMake
installation on our bots which necessitated an upgrade in the Ubuntu version
which invalidated the MIPS compilers we were using. The new MIPS compilers
(coming from Debian I believe) all have hard float enabled by default and soft
float support not built in. This meant that we couldn't upgrade the bots
until #34841 landed because otherwise we would fail to compile C code as the
`-msoft-float` option wouldn't work.

Unfortunately, though, this means that once we upgrade the bots the C code we're
compiling will be compiled for hard float and the Rust code will be compiled
for soft float, a bad mismatch! This PR remedies the situation such that Rust
will compile with hard float as well.

If this lands it will likely produce broken nightlies for a day or two while we
get around to upgrading the bots because the current C toolchain only produces
soft-float binaries, and now rust will be hard-float. Hopefully, though, the
upgrade can go smoothly!

7 years agoAuto merge of #34879 - petrochenkov:fnptr, r=alexcrichton
bors [Tue, 19 Jul 2016 01:09:25 +0000 (18:09 -0700)]
Auto merge of #34879 - petrochenkov:fnptr, r=alexcrichton

Implement traits for variadic function pointers

Closes https://github.com/rust-lang/rust/issues/34874
cc https://github.com/rust-lang/rust/pull/28268

r? @alexcrichton

7 years agoAuto merge of #34357 - tbu-:pr_exact_size_is_empty, r=brson
bors [Mon, 18 Jul 2016 21:26:22 +0000 (14:26 -0700)]
Auto merge of #34357 - tbu-:pr_exact_size_is_empty, r=brson

Add `is_empty` function to `ExactSizeIterator`

All other types implementing a `len` functions have `is_empty` already.

7 years agoAuto merge of #34899 - michaelwoerister:always_internalize_symbols, r=eddyb
bors [Mon, 18 Jul 2016 18:29:25 +0000 (11:29 -0700)]
Auto merge of #34899 - michaelwoerister:always_internalize_symbols, r=eddyb

Run base::internalize_symbols() even for single-codegen-unit crates.

The initial linkage-assignment (especially for closures) is a conservative one that makes some symbols more visible than they need to be. While this is not a correctness problem, it does force the LLVM inliner to be more conservative too, which results in poor performance. Once translation is based solely on MIR, it will be easier to also make the initial linkage assignment a better fitting one. Until then `internalize_symbols()` does a good job of preventing most performance regressions.

This should solve the regressions reported in https://github.com/rust-lang/rust/issues/34891 and maybe also those in https://github.com/rust-lang/rust/issues/34831.

As a side-effect, this will also solve most of the problematic cases described in https://github.com/rust-lang/rust/issues/34793. Not reliably so, however. For that, we still need a solution like the one implement in https://github.com/rust-lang/rust/pull/34830.

cc @rust-lang/compiler

7 years agouse a new feature name for String AddAssign
Jack O'Connor [Mon, 18 Jul 2016 18:27:17 +0000 (14:27 -0400)]
use a new feature name for String AddAssign

7 years agoupdate the since field to 1.12.0 for String AddAssign
Jack O'Connor [Mon, 18 Jul 2016 18:00:35 +0000 (14:00 -0400)]
update the since field to 1.12.0 for String AddAssign

7 years agoFix doctest of `ExactSizeIterator::is_empty`
Tobias Bucher [Mon, 18 Jul 2016 10:08:37 +0000 (12:08 +0200)]
Fix doctest of `ExactSizeIterator::is_empty`

7 years agoRun base::internalize_symbols() even for single-codegen-unit crates.
Michael Woerister [Mon, 18 Jul 2016 14:16:19 +0000 (10:16 -0400)]
Run base::internalize_symbols() even for single-codegen-unit crates.

The initial linkage-assignment (especially for closures) is a conservative one that makes some symbols more visible than they need to be. While this is not a correctness problem, it does force the LLVM inliner to be more conservative too, which results in poor performance. Once translation is based solely on MIR, it will be easier to also make the initial linkage assignment a better fitting one. Until then `internalize_symbols()` does a good job of preventing most performance regressions.

7 years agoRollup merge of #34889 - infinity0:master, r=sanxiyn
Seo Sanghyeon [Mon, 18 Jul 2016 13:44:57 +0000 (22:44 +0900)]
Rollup merge of #34889 - infinity0:master, r=sanxiyn

Test fixes for ARM64

When these changes are applied, rustc 1.10.0 tests pass successfully on [asachi.debian.org](https://db.debian.org/machines.cgi?host=asachi).

7 years agoRollup merge of #34884 - shepmaster:from_raw_parts_doc, r=@nagisa
Seo Sanghyeon [Mon, 18 Jul 2016 13:44:56 +0000 (22:44 +0900)]
Rollup merge of #34884 - shepmaster:from_raw_parts_doc, r=@nagisa

Improve {String,Vec}::from_raw_parts documentation

7 years agoRollup merge of #34875 - frewsxcv:std-slice-struct, r=GuillaumeGomez
Seo Sanghyeon [Mon, 18 Jul 2016 13:44:56 +0000 (22:44 +0900)]
Rollup merge of #34875 - frewsxcv:std-slice-struct, r=GuillaumeGomez

Indicate where `std::slice` structs originate from.

None

7 years agoRollup merge of #34853 - frewsxcv:vec-truncate, r=GuillaumeGomez
Seo Sanghyeon [Mon, 18 Jul 2016 13:44:56 +0000 (22:44 +0900)]
Rollup merge of #34853 - frewsxcv:vec-truncate, r=GuillaumeGomez

Partial rewrite/expansion of `Vec::truncate` documentation.

None

7 years agoRollup merge of #34807 - sanxiyn:dump-mir, r=nagisa
Seo Sanghyeon [Mon, 18 Jul 2016 13:44:56 +0000 (22:44 +0900)]
Rollup merge of #34807 - sanxiyn:dump-mir, r=nagisa

Remove extra newlines in MIR dump

7 years agoAdd `librustc_driver::driver::reset_thread_local_state` and
Jeffrey Seyfried [Sat, 16 Jul 2016 16:12:56 +0000 (16:12 +0000)]
Add `librustc_driver::driver::reset_thread_local_state` and
remove the thread local state reset at the beginning of `phase_1_parse_input`.

7 years agoAuto merge of #34886 - jseyfried:improve_stmt_matchers, r=eddyb
bors [Mon, 18 Jul 2016 08:40:23 +0000 (01:40 -0700)]
Auto merge of #34886 - jseyfried:improve_stmt_matchers, r=eddyb

macros: fix bug in `stmt` matchers

Today, `stmt` matchers stop too early when parsing expression statements that begin with non-braced macro invocations. For example,
```rust
fn main() {
    macro_rules! m { ($s:stmt;) => { $s } }
    id!(vec![].push(0););
    //^ Before this PR, the `stmt` matcher only consumes "vec![]", so this is an error.
    //| After this PR, the `stmt` matcher consumes "vec![].push(0)", so this compiles.
}
```
This change is backwards compatible due to the follow set for `stmt`.

r? @eddyb

7 years agoRemove rustdoc reference to `walk_dir`
Mark Buer [Mon, 18 Jul 2016 08:24:15 +0000 (17:54 +0930)]
Remove rustdoc reference to `walk_dir`

7 years agoAuto merge of #34860 - jseyfried:encapsulate_hygiene, r=nrc
bors [Mon, 18 Jul 2016 05:12:59 +0000 (22:12 -0700)]
Auto merge of #34860 - jseyfried:encapsulate_hygiene, r=nrc

Clean up and encapsulate `syntax::ext::mtwt`, rename `mtwt` to `hygiene`

r? @nrc

7 years agoAdd debug for hash_map::{Entry, VacantEntry, OccupiedEntry}
ggomez [Wed, 20 Jul 2016 13:02:33 +0000 (15:02 +0200)]
Add debug for hash_map::{Entry, VacantEntry, OccupiedEntry}

7 years agoRemove extraneous words
Jake Goulding [Sun, 17 Jul 2016 14:55:00 +0000 (10:55 -0400)]
Remove extraneous words

7 years agoDocument from_raw_parts involves ownership transfer
Jake Goulding [Sun, 17 Jul 2016 14:52:59 +0000 (10:52 -0400)]
Document from_raw_parts involves ownership transfer

7 years agoimplement AddAssign for String
Jack O'Connor [Sun, 17 Jul 2016 15:31:44 +0000 (11:31 -0400)]
implement AddAssign for String

7 years agoAuto merge of #34876 - frewsxcv:vec-as-mut-slice, r=alexcrichton
bors [Sun, 17 Jul 2016 19:04:51 +0000 (12:04 -0700)]
Auto merge of #34876 - frewsxcv:vec-as-mut-slice, r=alexcrichton

Remove unnecessary indexing and deref in `Vec::as_mut_slice`.

None

7 years agodoc/book: fix tests for non-x86 architectures, such as aarch64
Ximin Luo [Sun, 17 Jul 2016 19:00:24 +0000 (21:00 +0200)]
doc/book: fix tests for non-x86 architectures, such as aarch64

`rustdoc --test` gets confused when "main" exists for some architectures but not others.

7 years agotest: disable more stdcall tests for ARM arches. temp workaround for #24958
Ximin Luo [Sun, 17 Jul 2016 18:57:54 +0000 (20:57 +0200)]
test: disable more stdcall tests for ARM arches. temp workaround for #24958

7 years agoRemove some unit tests and that are redundant with `run-pass/hygiene.rs`
Jeffrey Seyfried [Sat, 16 Jul 2016 19:26:16 +0000 (19:26 +0000)]
Remove some unit tests and that are redundant with `run-pass/hygiene.rs`
and that would be painful to rewrite.

7 years agoRename `mtwt` to `hygiene`
Jeffrey Seyfried [Sat, 16 Jul 2016 19:11:28 +0000 (19:11 +0000)]
Rename `mtwt` to `hygiene`

7 years agoClean up and encapsulate `syntax::ext::mtwt`
Jeffrey Seyfried [Wed, 22 Jun 2016 08:03:42 +0000 (08:03 +0000)]
Clean up and encapsulate `syntax::ext::mtwt`

7 years agoAdd regression test
Jeffrey Seyfried [Sun, 17 Jul 2016 15:46:21 +0000 (15:46 +0000)]
Add regression test

7 years agoAuto merge of #34871 - petrochenkov:inherent, r=jseyfried
bors [Sun, 17 Jul 2016 16:07:50 +0000 (09:07 -0700)]
Auto merge of #34871 - petrochenkov:inherent, r=jseyfried

Do not resolve inherent static methods from other crates prematurely

Under some specific circumstances paths like `Type::method` can be resolved early in rustc_resolve instead of type checker. `Type` must be defined in another crate, it should be an enum or a trait object (i.e. a type that acts as a "module" in resolve), and `method` should be an inherent static method.
As a result, such paths don't go through `resolve_ufcs`, may be resolved incorrectly and break some invariants in type checker. This patch removes special treatment of such methods.

The removed code was introduced in https://github.com/rust-lang/rust/commit/2bd46e767c0fe5b6188df61cb9daf8f2e65a3ed0 to fix a problem that no longer exists.

r? @jseyfried

7 years agomacros: Fix bug in statement matchers
Jeffrey Seyfried [Sat, 16 Jul 2016 20:41:43 +0000 (20:41 +0000)]
macros: Fix bug in statement matchers

7 years agoIndicate where `std::slice` structs originate from.
Corey Farwell [Sun, 17 Jul 2016 01:42:11 +0000 (21:42 -0400)]
Indicate where `std::slice` structs originate from.

7 years agoMake .enumerate() example self-explanatory
Novotnik, Petr [Sun, 17 Jul 2016 10:06:10 +0000 (12:06 +0200)]
Make .enumerate() example self-explanatory

7 years agoAuto merge of #34829 - cgswords:tstream, r=nrc
bors [Sun, 17 Jul 2016 10:05:08 +0000 (03:05 -0700)]
Auto merge of #34829 - cgswords:tstream, r=nrc

Added tokenstream parser procedure

A tiny PR that simply adds a procedure for parsing `TokenStream`s to the parser in `src/libsyntax`. This is to ease using `TokenStream`s with the current (old) procedural macro system.

7 years agoImplement traits for variadic function pointers
Vadim Petrochenkov [Sat, 16 Jul 2016 21:15:15 +0000 (00:15 +0300)]
Implement traits for variadic function pointers

7 years agoAuto merge of #34789 - jonathandturner:simplify_liberror, r=alexcrichton
bors [Sun, 17 Jul 2016 07:06:29 +0000 (00:06 -0700)]
Auto merge of #34789 - jonathandturner:simplify_liberror, r=alexcrichton

Simplify librustc_errors

This is part 2 of the error crate refactor, starting with #34403.

In this refactor, I focused on slimming down the error crate to fewer moving parts.  As such, I've removed quite a few parts and replaced the with simpler, straight-line code.  Specifically, this PR:

* Removes BasicEmitter
* Remove emit from emitter, leaving emit_struct
* Renames emit_struct to emit
* Removes CoreEmitter and focuses on a single Emitter
* Implements the latest changes to error format RFC (#1644)
* Removes (now-unused) code in emitter.rs and snippet.rs
* Moves more tests to the UI tester, removing some duplicate tests in the process

There is probably more that could be done with some additional refactoring, but this felt like it was getting to a good state.

r? @alexcrichton   cc: @Manishearth (as there may be breaking changes in stuff I removed/changed)

7 years agoAuto merge of #34606 - mathstuf:llvm-with-ninja, r=alexcrichton
bors [Sun, 17 Jul 2016 04:09:15 +0000 (21:09 -0700)]
Auto merge of #34606 - mathstuf:llvm-with-ninja, r=alexcrichton

llvm, rt: build using the Ninja generator if available

The Ninja generator generally builds much faster than make. It may also
be used on Windows to have a vast speed improvement over the Visual
Studio generators.

Currently hidden behind an `--enable-ninja` flag because it does not
obey the top-level `-j` or `-l` flags given to `make`.

7 years agoRemove unnecessary indexing and deref in `Vec::as_mut_slice`.
Corey Farwell [Sun, 17 Jul 2016 02:09:55 +0000 (22:09 -0400)]
Remove unnecessary indexing and deref in `Vec::as_mut_slice`.

7 years agoAdd examples for LinkedList
Guillaume Gomez [Sat, 16 Jul 2016 15:27:55 +0000 (17:27 +0200)]
Add examples for LinkedList