]> git.lizzy.rs Git - rust.git/log
rust.git
7 years agolibrustc_back: convert fn target() to return Result
Doug Goldstein [Sun, 24 Jul 2016 16:47:39 +0000 (11:47 -0500)]
librustc_back: convert fn target() to return Result

Change all the target generation functions to return a Result<Target,
String> so that targets that are unable to be instantiated can be
expressed as an Err instead of a panic!(). This should improve #33497 as
well.

7 years agolibrustc_back: add ToJson trait to Target
Doug Goldstein [Fri, 8 Apr 2016 03:29:01 +0000 (22:29 -0500)]
librustc_back: add ToJson trait to Target

Target's can already be built up from JSON files as well as built into
librustc_back so this adds the ability to convert any Target back into
JSON.

Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
7 years agolibrustc_back: expose all target options via JSON
Doug Goldstein [Fri, 15 Apr 2016 14:13:28 +0000 (09:13 -0500)]
librustc_back: expose all target options via JSON

Not all TargetOptions are exposed via the JSON interface to create
different targets. This exposes all the missing items and reorders them
to match the structure so that it is easier in the future to identify
missing items.

Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
7 years agoAuto merge of #33363 - japaric:target, r=japaric
bors [Wed, 27 Jul 2016 12:50:27 +0000 (05:50 -0700)]
Auto merge of #33363 - japaric:target, r=japaric

fix built-in target detection

previously the logic was accepting wrong triples (like
`x86_64_unknown-linux-musl`) as valid ones (like `x86_64-unknown-linux-musl`) if
they contained an underscore instead of a dash.

fixes #33329

---

r? @brson

I wanted to use a compile-fail test at first. But, you can't pass an extra `--target` flag to `rustc` for those because they already call `rustc --target $HOST` so you get a `error: Option 'target' given more than once.`. The run-make test used here works fine though.

7 years agoAuto merge of #33312 - Byron:double-ended-iterator-for-args, r=alexcrichton
bors [Wed, 27 Jul 2016 09:26:37 +0000 (02:26 -0700)]
Auto merge of #33312 - Byron:double-ended-iterator-for-args, r=alexcrichton

DoubleEndedIterator for Args

This PR implements the DoubleEndedIterator trait for the `std::env::Args[Os]` structure, as well
as the internal implementations.

It is primarily motivated by me, as I happened to implement a simple `reversor` program many times
now, which so far had to use code like this:

```Rust
for arg in std::env::args().skip(1).collect::<Vec<_>>().iter().rev() {}
```

... even though I would have loved to do this instead:

```Rust
for arg in std::env::args().skip(1).rev() {}
```

The latter is more natural, and I did not find a reason for not implementing it.
After all, on every system, the number of arguments passed to the program are known
at runtime.

To my mind, it follows KISS, and does not try to be smart at all. Also, there are no unit-tests,
primarily as I did not find any existing tests for the `Args` struct either.

The windows implementation is basically a copy-pasted variant of the `next()` method implementation,
and I could imagine sharing most of the code instead. Actually I would be happy if the reviewer would
ask for it.

7 years agoAuto merge of #35053 - steveklabnik:rollup, r=steveklabnik
bors [Wed, 27 Jul 2016 03:52:24 +0000 (20:52 -0700)]
Auto merge of #35053 - steveklabnik:rollup, r=steveklabnik

Rollup of 15 pull requests

- Successful merges: #34461, #34609, #34732, #34850, #34935, #34974, #34990, #34995, #35001, #35009, #35010, #35019, #35028, #35029, #35043
- Failed merges:

7 years agoAuto merge of #35014 - vadimcn:travis-test, r=alexcrichton
bors [Wed, 27 Jul 2016 00:07:08 +0000 (17:07 -0700)]
Auto merge of #35014 - vadimcn:travis-test, r=alexcrichton

Fix Travis tests

r? @vadimcn

7 years agoRollup merge of #35043 - rahiel:patch-1, r=nikomatsakis
Steve Klabnik [Tue, 26 Jul 2016 21:21:14 +0000 (17:21 -0400)]
Rollup merge of #35043 - rahiel:patch-1, r=nikomatsakis

doc/book/trait-objects: remove empty lines at start of examples

I think it looks better without them.

7 years agoRollup merge of #35029 - eulerdisk:fix_missing_comma_in_csv_dumper, r=nrc
Steve Klabnik [Tue, 26 Jul 2016 21:21:14 +0000 (17:21 -0400)]
Rollup merge of #35029 - eulerdisk:fix_missing_comma_in_csv_dumper, r=nrc

Fixed missing comma in the csv dumper.

Added missing comma before `file_line_end`.

r? @nrc

7 years agoRollup merge of #35028 - abhijeetbhagat:patch-6, r=alexcrichton
Steve Klabnik [Tue, 26 Jul 2016 21:21:13 +0000 (17:21 -0400)]
Rollup merge of #35028 - abhijeetbhagat:patch-6, r=alexcrichton

Remove no_stack_check tests (#34915)

Part of fixes for #34915

7 years agoRollup merge of #35019 - frewsxcv:slice-split, r=GuillaumeGomez
Steve Klabnik [Tue, 26 Jul 2016 21:21:13 +0000 (17:21 -0400)]
Rollup merge of #35019 - frewsxcv:slice-split, r=GuillaumeGomez

Rewrite/expansion of `slice::split` doc examples.

None

7 years agoRollup merge of #35010 - GuillaumeGomez:file_doc, r=steveklabnik
Steve Klabnik [Tue, 26 Jul 2016 21:21:13 +0000 (17:21 -0400)]
Rollup merge of #35010 - GuillaumeGomez:file_doc, r=steveklabnik

Improve Open doc

Part of #29356.

r? @steveklabnik

7 years agoRollup merge of #35009 - GuillaumeGomez:dir_entry_doc, r=steveklabnik
Steve Klabnik [Tue, 26 Jul 2016 21:21:13 +0000 (17:21 -0400)]
Rollup merge of #35009 - GuillaumeGomez:dir_entry_doc, r=steveklabnik

Dir entry doc

Part of #29356.

r? @steveklabnik

7 years agoRollup merge of #35001 - rdwilliamson:patch-1, r=alexcrichton
Steve Klabnik [Tue, 26 Jul 2016 21:21:13 +0000 (17:21 -0400)]
Rollup merge of #35001 - rdwilliamson:patch-1, r=alexcrichton

Fix HashMap's values_mut example to use println!

Fix HashMap's values_mut example to use println!

7 years agoRollup merge of #34995 - GuillaumeGomez:dir_builder_doc, r=steveklabnik
Steve Klabnik [Tue, 26 Jul 2016 21:21:12 +0000 (17:21 -0400)]
Rollup merge of #34995 - GuillaumeGomez:dir_builder_doc, r=steveklabnik

Add DirBuilder doc examples

r? @steveklabnik

Part of #29329 and of #29356.

7 years agoRollup merge of #34990 - abhijeetbhagat:patch-3, r=steveklabnik
Steve Klabnik [Tue, 26 Jul 2016 21:21:12 +0000 (17:21 -0400)]
Rollup merge of #34990 - abhijeetbhagat:patch-3, r=steveklabnik

Update underscore usage (#34903)

7 years agoRollup merge of #34974 - abhijeetbhagat:patch-2, r=GuillaumeGomez
Steve Klabnik [Tue, 26 Jul 2016 21:21:12 +0000 (17:21 -0400)]
Rollup merge of #34974 - abhijeetbhagat:patch-2, r=GuillaumeGomez

Update VecDeque documentation to specify direction of index 0 (#34920)

I mentioned the direction for all the methods that work with an index

7 years agoRollup merge of #34935 - GuillaumeGomez:hash_map_doc, r=steveklabnik
Steve Klabnik [Tue, 26 Jul 2016 21:21:12 +0000 (17:21 -0400)]
Rollup merge of #34935 - GuillaumeGomez:hash_map_doc, r=steveklabnik

Add HashMap Entry enums examples

Part of #29348.

r? @steveklabnik

7 years agoRollup merge of #34850 - tshepang:patch-3, r=steveklabnik
Steve Klabnik [Tue, 26 Jul 2016 21:21:11 +0000 (17:21 -0400)]
Rollup merge of #34850 - tshepang:patch-3, r=steveklabnik

doc: add missing pause

7 years agoRollup merge of #34732 - durka:patch-27, r=steveklabnik
Steve Klabnik [Tue, 26 Jul 2016 21:21:11 +0000 (17:21 -0400)]
Rollup merge of #34732 - durka:patch-27, r=steveklabnik

document DoubleEndedIterator::next_back

document DoubleEndedIterator::next_back

fixes #34726

7 years agoRollup merge of #34609 - ubsan:transmute_docs, r=steveklabnik
Steve Klabnik [Tue, 26 Jul 2016 21:21:11 +0000 (17:21 -0400)]
Rollup merge of #34609 - ubsan:transmute_docs, r=steveklabnik

Add more docs - mostly warnings - to std::mem::transmute

7 years agoRollup merge of #34461 - ubsan:master, r=steveklabnik
Steve Klabnik [Tue, 26 Jul 2016 21:21:10 +0000 (17:21 -0400)]
Rollup merge of #34461 - ubsan:master, r=steveklabnik

Fix ABI string docs in reference.md

7 years agoAuto merge of #34983 - alexcrichton:windows-flaky, r=brson
bors [Tue, 26 Jul 2016 20:51:34 +0000 (13:51 -0700)]
Auto merge of #34983 - alexcrichton:windows-flaky, r=brson

std: Ignore tests where threads outlive main

Long ago we discovered that threads which outlive main and then exit while the
rest of the program is exiting causes Windows to hang (#20704). That's what was
happening in this test so let's just not run this test any more.

7 years agoDoubleEndedIterator for Args
Sebastian Thiel [Sat, 30 Apr 2016 14:37:44 +0000 (16:37 +0200)]
DoubleEndedIterator for Args

The number of arguments given to a process is always known, which
makes implementing DoubleEndedIterator possible.

That way, the Iterator::rev() method becomes usable, among others.

Signed-off-by: Sebastian Thiel <byronimo@gmail.com>
Tidy for DoubleEndedIterator

I chose to not create a new feature for it, even though
technically, this makes me lie about the original availability
of the implementation.

Verify with @alexchrichton

Setup feature flag for new std::env::Args iterators

Add test for Args reverse iterator

It's somewhat depending on the input of the test program,
but made in such a way that should be somewhat flexible to changes
to the way it is called.

Deduplicate windows ArgsOS code for DEI

DEI = DoubleEndedIterator

Move env::args().rev() test to run-pass

It must be controlling it's arguments for full isolation.

Remove superfluous feature name

Assert all arguments returned by env::args().rev()

Let's be very sure it works as we expect, why take chances.

Fix rval of os_string_from_ptr

A trait cannot be returned, but only the corresponding object.

Deref pointers to actually operate on the argument

Put unsafe to correct location

7 years agodoc/book/trait-objects: remove empty lines at start of examples
Rahiel Kasim [Tue, 26 Jul 2016 09:14:46 +0000 (11:14 +0200)]
doc/book/trait-objects: remove empty lines at start of examples

7 years agoRewrite/expansion of `slice::split` doc examples.
Corey Farwell [Mon, 25 Jul 2016 02:10:36 +0000 (22:10 -0400)]
Rewrite/expansion of `slice::split` doc examples.

7 years agoLooser LSDA parsing
Vadim Chugunov [Mon, 25 Jul 2016 05:09:56 +0000 (22:09 -0700)]
Looser LSDA parsing

7 years agoFixed missing comma in the csv dumper.
Andrea Pretto [Mon, 25 Jul 2016 09:46:59 +0000 (11:46 +0200)]
Fixed missing comma in the csv dumper.

7 years agoRemove no_stack_check tests (#34915)
abhi [Mon, 25 Jul 2016 09:30:32 +0000 (15:00 +0530)]
Remove no_stack_check tests (#34915)

Part of fixes for #34915

7 years agoadd include ../tools.mk to the Makefile
Jorge Aparicio [Fri, 22 Jul 2016 22:11:38 +0000 (17:11 -0500)]
add include ../tools.mk to the Makefile

7 years agoAuto merge of #35006 - Manishearth:rollup, r=Manishearth
bors [Sun, 24 Jul 2016 18:42:06 +0000 (11:42 -0700)]
Auto merge of #35006 - Manishearth:rollup, r=Manishearth

Rollup of 7 pull requests

- Successful merges: #34965, #34972, #34975, #34976, #34977, #34988, #34989
- Failed merges:

7 years agoImprove Open doc
Guillaume Gomez [Sun, 24 Jul 2016 15:00:49 +0000 (17:00 +0200)]
Improve Open doc

7 years agoAdd DirEntry doc examples
Guillaume Gomez [Sun, 24 Jul 2016 14:52:28 +0000 (16:52 +0200)]
Add DirEntry doc examples

7 years agoAdd missing links
Guillaume Gomez [Sun, 24 Jul 2016 14:07:06 +0000 (16:07 +0200)]
Add missing links

7 years agoRollup merge of #34989 - frewsxcv:fix-set-len-doc-example, r=nagisa
Manish Goregaokar [Sun, 24 Jul 2016 09:48:48 +0000 (15:18 +0530)]
Rollup merge of #34989 - frewsxcv:fix-set-len-doc-example, r=nagisa

Fix incorrect 'memory leak' example for `Vec::set_len`.

Example was written in https://github.com/rust-lang/rust/pull/34911

Issue was brought up in this comment:

https://github.com/rust-lang/rust/commit/a005b2cd2ac679da7393e537aa05e2b7d32d36d5#commitcomment-18346958

7 years agoRollup merge of #34988 - frewsxcv:vec-windows, r=GuillaumeGomez
Manish Goregaokar [Sun, 24 Jul 2016 09:48:48 +0000 (15:18 +0530)]
Rollup merge of #34988 - frewsxcv:vec-windows, r=GuillaumeGomez

Doc example improvements for `slice::windows`.

* Modify existing example to not rely on printing to see results
* Add an example demonstrating when slice is shorter than `size`

7 years agoRollup merge of #34977 - wettowelreactor:patch-3, r=steveklabnik
Manish Goregaokar [Sun, 24 Jul 2016 09:48:48 +0000 (15:18 +0530)]
Rollup merge of #34977 - wettowelreactor:patch-3, r=steveklabnik

Fixed to spelling errors in char.rs

Fixed two small spelling mistakes (interator -> iterator) in the documentation for encode_utf8 and encode_utf16

7 years agoRollup merge of #34976 - GuillaumeGomez:build_hasher_doc, r=steveklabnik
Manish Goregaokar [Sun, 24 Jul 2016 09:48:48 +0000 (15:18 +0530)]
Rollup merge of #34976 - GuillaumeGomez:build_hasher_doc, r=steveklabnik

Add BuildHasher example

r? @steveklabnik

7 years agoRollup merge of #34975 - GuillaumeGomez:random_state_doc, r=steveklabnik
Manish Goregaokar [Sun, 24 Jul 2016 09:48:47 +0000 (15:18 +0530)]
Rollup merge of #34975 - GuillaumeGomez:random_state_doc, r=steveklabnik

Add Random state doc

Last part of #29348.

r? @steveklabnik

7 years agoRollup merge of #34972 - oli-obk:cant_cast_str_to_const_ptr, r=eddyb
Manish Goregaokar [Sun, 24 Jul 2016 09:48:47 +0000 (15:18 +0530)]
Rollup merge of #34972 - oli-obk:cant_cast_str_to_const_ptr, r=eddyb

improve const eval error reporting on "" and b"" casts

r? @eddyb

cc @ubsan

7 years agoRollup merge of #34965 - jonathandturner:multispan_cleanup, r=sanxiyn
Manish Goregaokar [Sun, 24 Jul 2016 09:48:47 +0000 (15:18 +0530)]
Rollup merge of #34965 - jonathandturner:multispan_cleanup, r=sanxiyn

Remove unused methods from MultiSpan

Removed a couple of unused methods from MultiSpan.  I thought about batching this with some other changes but wasn't sure when I'd get around to them, so PR for a tiny fix instead.

This can be rollup'd.

7 years agoFix HashMap's values_mut example to use println!
Robert Williamson [Sat, 23 Jul 2016 22:13:25 +0000 (16:13 -0600)]
Fix HashMap's values_mut example to use println!

7 years agoAuto merge of #34832 - vadimcn:rusty-personality, r=alexcrichton
bors [Sat, 23 Jul 2016 16:35:34 +0000 (09:35 -0700)]
Auto merge of #34832 - vadimcn:rusty-personality, r=alexcrichton

Implement rust_eh_personality in Rust, remove rust_eh_personality_catch.

Well, not quite: ARM EHABI platforms still use the old scheme -- for now.

r? @alexcrichton

7 years agoDoc example improvements for `slice::windows`.
Corey Farwell [Sat, 23 Jul 2016 00:23:25 +0000 (20:23 -0400)]
Doc example improvements for `slice::windows`.

* Modify existing example to not rely on printing to see results
* Add an example demonstrating when slice is shorter than `size`

7 years agoFix incorrect 'memory leak' example for `Vec::set_len`.
Corey Farwell [Sat, 23 Jul 2016 01:43:59 +0000 (21:43 -0400)]
Fix incorrect 'memory leak' example for `Vec::set_len`.

Example was written in https://github.com/rust-lang/rust/pull/34911

Issue was brought up in this comment:

https://github.com/rust-lang/rust/commit/a005b2cd2ac679da7393e537aa05e2b7d32d36d5#commitcomment-18346958

7 years agoAuto merge of #34925 - jseyfried:nested_macros, r=eddyb
bors [Sat, 23 Jul 2016 11:01:05 +0000 (04:01 -0700)]
Auto merge of #34925 - jseyfried:nested_macros, r=eddyb

Support nested `macro_rules!`

Fixes #6994.
r? @eddyb

7 years agoUpdate underscore usage (#34903)
abhi [Sat, 23 Jul 2016 07:45:09 +0000 (13:15 +0530)]
Update underscore usage (#34903)

7 years agoAdd DirBuilder doc examples
Guillaume Gomez [Fri, 22 Jul 2016 23:57:21 +0000 (01:57 +0200)]
Add DirBuilder doc examples

7 years agostd: Ignore tests where threads outlive main
Alex Crichton [Fri, 22 Jul 2016 23:21:51 +0000 (16:21 -0700)]
std: Ignore tests where threads outlive main

Long ago we discovered that threads which outlive main and then exit while the
rest of the program is exiting causes Windows to hang (#20704). That's what was
happening in this test so let's just not run this test any more.

7 years agoImplement rust_eh_personality in Rust, remove rust_eh_personality_catch.
Vadim Chugunov [Fri, 22 Jul 2016 21:57:54 +0000 (14:57 -0700)]
Implement rust_eh_personality in Rust, remove rust_eh_personality_catch.

Well, not quite: ARM EHABI platforms still use the old scheme -- for now.

7 years agoAuto merge of #34924 - cgswords:empty_delim, r=nrc
bors [Fri, 22 Jul 2016 18:30:29 +0000 (11:30 -0700)]
Auto merge of #34924 - cgswords:empty_delim, r=nrc

Added empty CloseDelim to tokens for future use.

Description says it all. I added a new DelimToken type, Empty, to indicate a Delimited tokenstream with no actual delimiters (which are variously useful for constructing macro output).

r? @nrc

7 years agoFixed to spelling errors in char.rs
Camille Roussel [Fri, 22 Jul 2016 14:48:19 +0000 (10:48 -0400)]
Fixed to spelling errors in char.rs

Fixed two small spelling mistakes (interator -> iterator) in the documentation for encode_utf8 and encode_utf16

7 years agoAdd BuildHasher example
ggomez [Fri, 22 Jul 2016 14:38:16 +0000 (16:38 +0200)]
Add BuildHasher example

7 years agoAuto merge of #34917 - michaelwoerister:fix-internalize-symbols, r=eddyb
bors [Fri, 22 Jul 2016 14:25:06 +0000 (07:25 -0700)]
Auto merge of #34917 - michaelwoerister:fix-internalize-symbols, r=eddyb

Fix wrong condition in base::internalize_symbols().

Fix a typo that snuck into https://github.com/rust-lang/rust/pull/34899 (and completely broke `internalize_symbols()`).

7 years agoAdd Random state doc
ggomez [Fri, 22 Jul 2016 12:57:52 +0000 (14:57 +0200)]
Add Random state doc

7 years agoAdd HashMap Entry enums examples
ggomez [Wed, 20 Jul 2016 12:44:15 +0000 (14:44 +0200)]
Add HashMap Entry enums examples

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 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 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 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 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 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 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.