Commit Graph

55307 Commits

Author SHA1 Message Date
Evgeny Safronov
ede39aeb33
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.

Also updated `std::fmt` docs about string precision.

Signed-off-by: Evgeny Safronov <division494@gmail.com>
2016-07-06 00:01:14 +03:00
Loïc Damien
51e89ab08b Use lazy range in gdb pretty printers 2016-07-05 19:57:44 +02:00
Alex Burka
74e96299a2 show both forms of empty struct declaration 2016-07-05 13:46:06 -04:00
ubsan
7ec44e6c7b Fix tests 2016-07-05 10:40:59 -07:00
Kaivo Anastetiks
159d1ab540 Add a section about crate documentation. 2016-07-05 13:17:16 -04:00
Alex Crichton
1d9284664f Bump version to 1.12.0
Beta's now in the forge, let's start working on 1.12.0!
2016-07-05 08:34:58 -07:00
bors
ec58d0c997 Auto merge of #34412 - gnzlbg:document_platform_intrinsics_generate, r=alexcrichton
Add x86 intrinsics for bit manipulation (BMI 1.0, BMI 2.0, and TBM).

This PR adds the LLVM x86 intrinsics for the bit manipulation instruction sets (BMI 1.0, BMI 2.0, and TBM).

The objective of this pull-request is to allow building a library that implements all the algorithms offered by those instruction sets, using compiler intrinsics for the targets that support them (by means of `target_feature`).

The target features added are:

- `bmi`: Bit Manipulation Instruction Set 1.0, available in Intel >= Haswell and AMD's >= Jaguar/Piledriver,
- `bmi2`: Bit Manipulation Instruction Set 2.0, available in Intel >= Haswell and AMD's >= Excavator,
- `tbm`: Trailing Bit Manipulation, available only in AMD's Piledriver (won't be available in newer CPUs).

The intrinsics added are:

- BMI 1.0:
  - `bextr`: Bit field extract (with register).
- BMI 2.0:
  - `bzhi`: Zero high bits starting with specified bit position.
  - `pdep`: Parallel bits deposit.
  - `pext`: Parallel bits extract.
- TBM:
 - `bextri`: Bit field extract (with immediate).
2016-07-05 08:25:37 -07:00
Kaivo Anastetiks
6a85183e6f Replace it's by its. 2016-07-05 07:26:38 -04:00
bors
cd0ea60502 Auto merge of #34647 - TimNN:compiler-rt-ios-workaround, r=alexcrichton
Update compiler-rt with iOS linking warnings workaround

Closes #34617.

r? @alexcrichton
2016-07-05 04:06:50 -07:00
Jeffrey Seyfried
6e0bd44fa3 Add method with_module_lexical_scope to Resolver. 2016-07-05 08:50:43 +00:00
Luqman Aden
fd3b4646cc Just pass in NodeId to FunctionContext::new instead of looking it up. 2016-07-05 03:48:12 -04:00
Oliver Schneider
e7b083aeae
don't const eval constants during MIR creation
this didn't work very well anyway, because const_eval can't eval all kinds of constants.
2016-07-05 08:20:02 +02:00
Jeffrey Seyfried
bf4911b956 Add regression test 2016-07-05 05:59:46 +00:00
bors
499e6f8844 Auto merge of #34594 - willcrichton:master, r=nrc
Move LLVM cleanup so modules are accessible during `after_llvm` phase

Fix for #34432. Also added a new phase controller `after_compilation_done` that gets called at the very end (i.e. after linking) at the suggestion of @nrc. The added test will segfault if the modules get deallocated too early, so it ensures the LLVM is not prematurely cleaned up.

r? @nrc
2016-07-04 22:24:08 -07:00
bors
0f4c4f8c29 Auto merge of #34646 - michaelwoerister:warn-blacklisted-lldb, r=alexcrichton
Make rust-lldb warn about unsupported versions of LLDB

r? @alexcrichton
2016-07-04 17:59:14 -07:00
Jeffrey Seyfried
c454c1d4ac Strip unconfigured items from MultiModifier-expanded AST 2016-07-05 00:14:41 +00:00
Jeffrey Seyfried
547a930835 Revert "Change fold_tt and fold_tts to take token trees by value (instead of by reference)"
This reverts commit 5bf7970ac7.
2016-07-04 23:42:35 +00:00
Michael Woerister
6be6289338 Make rust-lldb warn about unsupported versions of LLDB 2016-07-04 19:37:36 -04:00
bors
d7ef1ac0d0 Auto merge of #34639 - dzamlo:master, r=michaelwoerister
Use lazy iterator in vec/slice gdb pretty printers
2016-07-04 15:09:36 -07:00
Loïc Damien
5de76afcfd Use lazy iterator in vec/slice gdb pretty printers 2016-07-04 20:22:10 +02:00
Eduard Burtescu
0ec3d98702 Revert "Revert "Remove the return_address intrinsic.""
This reverts commit f698cd3a36.
2016-07-04 21:06:50 +03:00
Tim Neumann
103d9625b1 update compiler-rt with iOS linking warnings workaround
closes #34617.
2016-07-04 19:11:03 +02:00
bors
e7cf491d22 Auto merge of #34602 - Xmasreturns:patch-4, r=steveklabnik
Update glossary.md

Added a brief description of Combinators
2016-07-04 09:57:02 -07:00
Ximin Luo
ab5309e9e8 Avoid redundant downloads when bootstrapping
If the local file is available, then verify it against the hash we just
downloaded, and if it matches then we don't need to download it again.
2016-07-04 16:37:46 +02:00
bors
acfa113c12 Auto merge of #34590 - pwlandoll:master, r=apasel422
Issue #34076: Removing reference to removed path.prefix() function

In the documentation for `std::path::Path`, there is a [reference](https://doc.rust-lang.org/std/path/struct.Path.html#method.is_absolute) to the `path.prefix()` function which has since been removed. The offending reference is now also removed.

First pull request, feedback welcome!

r? @steveklabnik
2016-07-04 05:03:04 -07:00
bors
d508de6cf7 Auto merge of #34638 - zackmdavis:if_let_over_none_empty_block_arm, r=jseyfried
prefer `if let` to match with `None => {}` arm in some places

This is a spiritual succesor to #34268 / 8531d581, in which we replaced a
number of matches of None to the unit value with `if let` conditionals
where it was judged that this made for clearer/simpler code (as would be
recommended by Manishearth/rust-clippy's `single_match` lint). The same
rationale applies to matches of None to the empty block.

----

r? @jseyfried
2016-07-04 02:18:46 -07:00
Will Crichton
5b0f334c6b Renamed phase to compilation_done 2016-07-04 02:47:53 -04:00
Will Crichton
eaf31099ed Added new compilation phase and test 2016-07-04 02:47:19 -04:00
Will Crichton
ce1146ac5f Moved LLVM cleanup to after after_llvm phase 2016-07-04 02:47:19 -04:00
bors
d98da85c5c Auto merge of #34550 - cynicaldevil:master, r=Manishearth
Added a pretty printer for &mut slices

Fixes #30232
I have added a test which checks for correctness in gdb, but I need some help to do the same for lldb.

r? @Manishearth
2016-07-03 23:17:50 -07:00
bors
bbdbe99c7a Auto merge of #34480 - jseyfried:remove_entry_points, r=nrc
Remove redundant `CompileController` entry points

Remove the `after_expand` and `after_write_deps` `CompileController` entry points.

The only things that separate these entry points from `after_hir_lowering` are dep-info generation and HIR map construction, neither of which is computationally intensive or has the potential to error.

r? @nrc
2016-07-03 18:17:36 -07:00
Zack M. Davis
d37edef9dd prefer if let to match with None => {} arm in some places
This is a spiritual succesor to #34268/8531d581, in which we replaced a
number of matches of None to the unit value with `if let` conditionals
where it was judged that this made for clearer/simpler code (as would be
recommended by Manishearth/rust-clippy's `single_match` lint). The same
rationale applies to matches of None to the empty block.
2016-07-03 16:27:02 -07:00
bors
696b703b5a Auto merge of #34530 - alexcrichton:stabilize-1.11, r=aturon
std: Stabilize APIs for the 1.11.0 release

Although the set of APIs being stabilized this release is relatively small, the
trains keep going! Listed below are the APIs in the standard library which have
either transitioned from unstable to stable or those from unstable to
deprecated.

Stable

* `BTreeMap::{append, split_off}`
* `BTreeSet::{append, split_off}`
* `Cell::get_mut`
* `RefCell::get_mut`
* `BinaryHeap::append`
* `{f32, f64}::{to_degrees, to_radians}` - libcore stabilizations mirroring past
  libstd stabilizations
* `Iterator::sum`
* `Iterator::product`

Deprecated

* `{f32, f64}::next_after`
* `{f32, f64}::integer_decode`
* `{f32, f64}::ldexp`
* `{f32, f64}::frexp`
* `num::One`
* `num::Zero`

Added APIs (all unstable)

* `iter::Sum`
* `iter::Product`
* `iter::Step` - a few methods were added to accomodate deprecation of One/Zero

Removed APIs

* `From<Range<T>> for RangeInclusive<T>` - everything about `RangeInclusive` is
  unstable

Closes #27739
Closes #27752
Closes #32526
Closes #33444
Closes #34152
cc #34529 (new tracking issue)
2016-07-03 14:33:55 -07:00
Tshepang Lekhonkhobe
5efc780e14 doc: fix and shorten comment 2016-07-03 22:03:45 +02:00
Nikhil Shagrithaya
036b08917d Added a pretty printer for &mut slices 2016-07-04 00:04:19 +05:30
Alex Crichton
3016626c3a std: Stabilize APIs for the 1.11.0 release
Although the set of APIs being stabilized this release is relatively small, the
trains keep going! Listed below are the APIs in the standard library which have
either transitioned from unstable to stable or those from unstable to
deprecated.

Stable

* `BTreeMap::{append, split_off}`
* `BTreeSet::{append, split_off}`
* `Cell::get_mut`
* `RefCell::get_mut`
* `BinaryHeap::append`
* `{f32, f64}::{to_degrees, to_radians}` - libcore stabilizations mirroring past
  libstd stabilizations
* `Iterator::sum`
* `Iterator::product`

Deprecated

* `{f32, f64}::next_after`
* `{f32, f64}::integer_decode`
* `{f32, f64}::ldexp`
* `{f32, f64}::frexp`
* `num::One`
* `num::Zero`

Added APIs (all unstable)

* `iter::Sum`
* `iter::Product`
* `iter::Step` - a few methods were added to accomodate deprecation of One/Zero

Removed APIs

* `From<Range<T>> for RangeInclusive<T>` - everything about `RangeInclusive` is
  unstable

Closes #27739
Closes #27752
Closes #32526
Closes #33444
Closes #34152
cc #34529 (new tracking issue)
2016-07-03 10:49:01 -07:00
bors
eebfcb8bf4 Auto merge of #34540 - jupp0r:patch-1, r=steveklabnik
Improve code example for try!

This change improves the code example for try!,
avoiding to use try! in the example code that shows
what code constructs try! can replace.
2016-07-03 10:39:53 -07:00
bors
5e858f34df Auto merge of #34532 - jonmarkprice:master, r=steveklabnik
Book: Small grammatical and stylistic edits to book

I've been reading [the book](https://doc.rust-lang.org/book/) and noticed a few small grammatical and stylistic issues which I've rolled into this pull request.

I'm not sure if I should do so many small, unrelated edits in a single pull request but it seems like a lot of overhead for each small edit. Maybe one commit per edit but one pull request per file/section? Feedback is very much appreciated as this is my first pull request ever!

r? @steveklabnik rollup
2016-07-03 07:47:36 -07:00
bors
20183f498f Auto merge of #34504 - retep998:patch-1, r=alexcrichton
Instructions on how to build Rust with rustbuild

This is a much simpler option for those on Windows who use msvc.
2016-07-03 05:02:51 -07:00
bors
da099c2322 Auto merge of #34614 - cynicaldevil:build-time, r=alexcrichton
Build: Shows total time taken to build the compiler

Fixes #34600
Prints the total time taken to build rustc by executing `src/bootstrap/bootstrap.py`; also includes time taken to download `stage0` compiler and deps.

r? @alexcrichton
2016-07-03 02:17:58 -07:00
Sylvestre Ledru
3fcb649277 Fix a few typos in the doc 2016-07-03 10:02:38 +02:00
Sylvestre Ledru
872d107dea Fix a few typos in the code 2016-07-03 10:02:24 +02:00
Jared Manning
5dfd79a8e6 Fix spacing in for loop enumeration example
Add a space between the comma and j in (i, j) to make it look nice.
2016-07-03 03:01:18 -05:00
bors
d9e8a67894 Auto merge of #34597 - CensoredUsername:bootstrap-fix, r=alexcrichton
Support more python 2.7 versions in bootstrap.py

It seems python broke compatability between 2.7.9  and 2.7.12 as on the former a WindowsError was raised while on the latter a subprocess.CalledProcessError was raised while testing for the existence of uname.

As a WindowsError being thrown obviously indicates we're running on windows, this should probably be accepted too.
2016-07-02 23:33:54 -07:00
ubsan
9e94ebf268 Make sure the documentation compiles 2016-07-02 22:55:30 -07:00
bors
ecbfa4749a Auto merge of #34591 - brson:relnotes, r=alexcrichton
Release notes for 1.10.0

[Rundered](https://github.com/brson/rust/tree/relnotes/RELEASES.md).

To me highlights look like panic hooks, unix sockets, cargo, and usability improvements.

f? @rust-lang/core @rust-lang/lang @rust-lang/compiler @rust-lang/tools @bstrie
2016-07-02 20:09:13 -07:00
Kaivo Anastetiks
df93e18418 Clarifies the meaning of the external mutability. 2016-07-02 20:39:21 -04:00
bors
45c3a50f39 Auto merge of #34580 - eddyb:two-steps-forward-one-step-backwards, r=nagisa
Revert "Remove the return_address intrinsic."

This reverts commit b30134dbc3.

Servo might want this merged if they don't merge servo/servo#11872 soon.

cc @pnkfelix @jdm
2016-07-02 17:25:05 -07:00
Corey Farwell
c6a04d9ba4 Fix broken markdown link in README. 2016-07-02 20:15:28 -04:00
bors
1ab87b65a2 Auto merge of #34605 - arielb1:bug-in-the-jungle, r=eddyb
fail obligations that depend on erroring obligations

Fix a bug where an obligation that depend on an erroring obligation would
be regarded as successful, leading to global cache pollution and random
lossage.

Fixes #33723.
Fixes #34503.

r? @eddyb since @nikomatsakis is on vacation

beta-nominating because of the massive lossage potential (e.g. with `Copy` this could lead to random memory leaks), plus this is a regression.
2016-07-02 12:25:29 -07:00