Commit Graph

75700 Commits

Author SHA1 Message Date
kennytm
23e2e3a431
Rollup merge of #49096 - alanhdu:master, r=alexcrichton
Update rustfmt to 0.4.1
2018-03-20 07:15:20 +08:00
kennytm
7bc9fe3250
Rollup merge of #49092 - mark-i-m:deptrack_readme, r=nikomatsakis
Replace many of the last references to readmes

In particular, this removes the dep track readme, so it should not be merged before https://github.com/rust-lang-nursery/rustc-guide/pull/92

Fix #47935

cc #48478

r? @nikomatsakis
2018-03-20 07:15:19 +08:00
kennytm
28eced1cb5
Rollup merge of #49004 - wesleywiser:incr_specialization_graph_query, r=michaelwoerister
Cache the specialization_graph query

Fixes #48987

r? @michaelwoerister
2018-03-20 07:15:18 +08:00
kennytm
7aa66515f6
Rollup merge of #48902 - csmoe:refactor_BorrowckErrors_fn_self, r=nikomatsakis
refactor the `BorrowckErrors` trait to take `fn(self)`

Fixes #48783
2018-03-20 07:15:16 +08:00
kennytm
49b584ce60
Rollup merge of #48834 - ysiraichi:suggest-remove-ref, r=estebank
Suggest removing `&`s

This implements the error message discussed in #47744.
We check whether removing each `&` yields a type that satisfies the requested obligation.
Also, it was created a new `NodeId` field in `ObligationCause` in order to iterate through the `&`s. The way it's implemented now, it iterates through the obligation snippet and counts the number of `&`.

r? @estebank
2018-03-20 07:15:15 +08:00
kennytm
5d5f5a08b8
Rollup merge of #48810 - Phlosioneer:32463-impl-integer-for-wrapping, r=dtolnay
Implement Integer methods for Wrapping

Wrapping<T> now implements:

count_ones, count_zeros, leading_zeros,
trailing_zeros, rotate_left, rotate_right, swap_bytes, from_be,
from_le, to_be, to_le, and pow

where T is:

u8, u16, u32, u64, usize, i8, i16, i32, i64, or isize.

Docs were written for all these methods, as well as examples. The
examples mirror the ones on u8, u16, etc... for consistency.

Closes #32463
2018-03-20 07:15:14 +08:00
kennytm
f32f810e6e
Rollup merge of #46518 - partim:asref-borrow-doc, r=dtolnay
Improve documentation for Borrow

This is the first step in improving the documentation for all the reference conversion traits. It proposes new text for the trait documentation of `Borrow`. Since I feel it is a somewhat radical rewrite and includes a stricter contract for `Borrow` then the previous text—namely that *all* shared traits need to behave the same, not just a select few—, I wanted to get some feedback before continuing.

Apart from the ‘normative’ description, the new text also includes a fairly extensive explanation of how the trait is used in the examples section. I included it because every time I look at how `HashMap` uses the trait, I need to think for a while as the use is a bit twisted. So, I thought having this thinking written down as part of the trait itself might be useful. One could argue that this should go into The Book, and, while I really like having everything important in the docs, I can see the text moved there, too.

So, before I move on: is this new text any good? Do we feel it is correct, useful, comprehensive, and understandable?

(This PR is in response to #44868 and #24140.)
2018-03-20 07:15:12 +08:00
Alan Du
253ade5b31 Update rustfmt to 0.4.1 2018-03-19 10:14:13 -04:00
bors
a04b88d194 Auto merge of #49079 - oli-obk:cross_miri, r=michaelwoerister
Cleanup metadata and incremental cache processing of constants

fixes #49033
fixes #49081

we really need tests for this. do we have any cross compilation tests? I couldn't find any
2018-03-19 10:39:26 +00:00
bors
aafe7d89f0 Auto merge of #49108 - SimonSapin:sip, r=TimNN
Remove or hide deprecated unstable SipHasher{13,24}

Deprecated since Rust 1.13.0.
2018-03-19 07:49:32 +00:00
Phlosioneer
bf101a5759 Fix trailing whitespace 2018-03-19 01:39:39 -04:00
Phlosioneer
5258af398a Make Wrapping::pow use wrapping_pow, add example 2018-03-19 01:39:38 -04:00
Phlosioneer
612c4a95bc Impl Integer methods for Wrapping
Wrapping<T> now implements:

count_ones, count_zeros, leading_zeros,
trailing_zeros, rotate_left, rotate_right, swap_bytes, from_be,
from_le, to_be, to_le, and pow

where T is:

u8, u16, u32, u64, usize, i8, i16, i32, i64, or isize.

Docs were written for all these methods, as well as examples. The
examples mirror the ones on u8, u16, etc... for consistency.

Closes #32463
2018-03-19 01:39:37 -04:00
bors
15add366fa Auto merge of #49091 - nikomatsakis:issue-49043-ty-infer-hash, r=michaelwoerister
extend stable hasher to support `CanonicalTy`

Fixes #49043

r? @michaelwoerister
2018-03-19 05:07:27 +00:00
bors
152217d29c Auto merge of #48978 - SimonSapin:debug-hex, r=KodrAus
Add hexadecimal formatting of integers with fmt::Debug

This can be used for integers within a larger types which implements Debug (possibly through derive) but not fmt::UpperHex or fmt::LowerHex.

```rust
assert!(format!("{:02x?}", b"Foo\0") == "[46, 6f, 6f, 00]");
assert!(format!("{:02X?}", b"Foo\0") == "[46, 6F, 6F, 00]");
```

RFC: https://github.com/rust-lang/rfcs/pull/2226

The new formatting string syntax (`x?` and `X?`) is insta-stable in this PR because I don’t know how to change a built-in proc macro’s behavior based of a feature gate. I can look into adding that, but I also strongly suspect that keeping this feature unstable for a time period would not be useful as possibly no-one would use it during that time.

This PR does not add the new (public) `fmt::Formatter` proposed in the API because:

* There was some skepticism on response to this part of the RFC
* It is not possible to implement as-is without larger changes to `fmt`, because `Formatter` at the moment has no easy way to tell apart for example `Octal` from `Binary`: it only has a function pointer for the relevant `fmt()` method.

If some integer-like type outside of `std` want to implement this behavior, another RFC will likely need to propose a different public API for `Formatter`.
2018-03-19 02:38:19 +00:00
bors
c2f4744d2d Auto merge of #49095 - alexcrichton:debug-asmjs, r=kennytm
Try to reduce amount of time on the asmjs builder

This PR has two commits for two separate strategies:

* First it disables optimizations for all tests, hopefully saving time by not optimizing the test code. This caused a number of run-pass tests to fail which are switched to being ignored here.
* Next it disables a number of test suites which aren't asm.js specific and already run elsewhere

cc #48826
2018-03-19 00:02:32 +00:00
Yukio Siraichi
736ba433ac Cleaned comments and extras s. 2018-03-18 20:58:56 -03:00
Yukio Siraichi
0b36b20651 CodeMap functions refactored.
- Using `span_take_while` to implement others.
2018-03-18 20:46:29 -03:00
Yukio Siraichi
74a4928ed4 Review fixes.
- `span_suggestion` changed to `span_suggestion_short`;
- `Span` used changed to contain only `&` refs;
- Tests passing.
2018-03-18 20:46:28 -03:00
Yukio Siraichi
c1ba5ac62c Reporting with span_suggestion_short. 2018-03-18 20:46:28 -03:00
Yukio Siraichi
f6bffd16d1 Rebased with master. 2018-03-18 20:46:28 -03:00
Yukio Siraichi
52cd07aef7 Created multiple line test. 2018-03-18 20:46:28 -03:00
Yukio Siraichi
f41dc775a3 Keeping code formatting.
Suggesting snippet without changing the original formatting of the code.
2018-03-18 20:46:27 -03:00
Yukio Siraichi
97b66d2987 Review fixes.
- `suggest_snippet` handling space between refs;
- Suggest message changing according to the number of refs that should
be removed.
2018-03-18 20:46:27 -03:00
Yukio Siraichi
f44b945e0e New test added. 2018-03-18 20:46:27 -03:00
Yukio Siraichi
e0fb0132c1 Test added. 2018-03-18 20:46:27 -03:00
Yukio Siraichi
4dd45069fe Refactored with high-order functions. 2018-03-18 20:46:24 -03:00
bors
5508b27145 Auto merge of #49134 - oli-obk:clippy, r=kennytm
Update clippy and RLS

r? @Manishearth
2018-03-18 17:22:17 +00:00
kennytm
8501e95023
Update RLS. 2018-03-18 22:26:57 +08:00
Oliver Schneider
5904543234
Update clippy 2018-03-18 13:29:57 +01:00
csmoe
55116243e7 remove unneeded where clause 2018-03-18 20:18:21 +08:00
Martin Hoffmann
13d94d666e Fix formatting. 2018-03-18 13:05:00 +01:00
bors
8aa27ee309 Auto merge of #48986 - matklad:update-cargo, r=alexcrichton
Update Cargo

r? @alexcrichton

Let's put new clap argument parsing in production to see if anything dies in flames :)
2018-03-18 10:03:18 +00:00
bors
7c396ebd0b Auto merge of #48985 - scalexm:lowering, r=nikomatsakis
MVP for chalkification

r? @nikomatsakis
2018-03-18 07:35:43 +00:00
bors
5e3ecdce4e Auto merge of #48917 - petrochenkov:import, r=oli-obk
syntax: Make imports in AST closer to the source and cleanup their parsing

This is a continuation of https://github.com/rust-lang/rust/pull/45846 in some sense.
2018-03-18 01:50:52 +00:00
bors
ca6a984261 Auto merge of #48842 - petrochenkov:under, r=nikomatsakis
syntax: Make `_` a reserved identifier

Why:
- Lexically `_` is an identifier.
- Internally it makes implementation of `use Trait as _;` (https://github.com/rust-lang/rust/issues/48216) and some other things cleaner.
- We prevent the externally observable effect of `_` being accepted by macros expecting `ident` by treating `_` specially in the `ident` matcher:
```rust
macro_rules! m {
    ($i: ident) => { let $i = 10; }
}

m!(_); // Still an error
```
2018-03-17 23:22:57 +00:00
Vadim Petrochenkov
a02b1d7e2b Add some docs + Fix rebase 2018-03-17 22:29:15 +03:00
Vadim Petrochenkov
636357b09a Cleanup import parsing
Fix spans of root segments
2018-03-17 22:12:21 +03:00
Vadim Petrochenkov
f88162654d Rename Span::empty to Span::shrink_to_lo, add Span::shrink_to_hi 2018-03-17 22:12:21 +03:00
Vadim Petrochenkov
e5fb13897d AST: Keep distinction between path and ::path in imports and visibilities
Add the root segment for name resolution purposes only
2018-03-17 22:12:21 +03:00
Vadim Petrochenkov
b057c554ab AST: Make renames in imports closer to the source
Fix `unused_import_braces` lint false positive on `use prefix::{self as rename}`
2018-03-17 22:12:21 +03:00
Vadim Petrochenkov
c6c6cf9515 AST/HIR: Clarify what the optional name in extern crate items mean 2018-03-17 22:12:21 +03:00
Vadim Petrochenkov
ed5ea5c705 Reject _ in ident matcher 2018-03-17 22:08:18 +03:00
Vadim Petrochenkov
5d06c890fe syntax: Make _ an identifier 2018-03-17 22:08:07 +03:00
Yukio Siraichi
fab7020bd9 Add span_suggestion while removing TyRefs based on the snippet String. 2018-03-17 15:53:33 -03:00
bors
adf2135adc Auto merge of #48936 - Zoxc:cstore, r=michaelwoerister
Make CrateMetadata and CStore thread-safe

r? @michaelwoerister
2018-03-17 17:30:14 +00:00
Martin Hoffmann
d664b8954e Rewrite the documentation for BorrowMut. 2018-03-17 14:09:45 +01:00
Martin Hoffmann
5bef034b19 Bring back the phrase 'borrowing as' for what Borrow does. 2018-03-17 14:05:24 +01:00
Simon Sapin
89ecb0d542 Mark deprecated unstable SipHasher13 as a doc-hidden impl detail of HashMap.
It stays in libcore rather than being private in HashMap’s module
because it shares code with the deprecated *stable* `SipHasher` type.
2018-03-17 13:04:13 +01:00
bors
61b6bf54fd Auto merge of #49106 - kennytm:rollup, r=kennytm
Rollup of 8 pull requests

- Successful merges: #48943, #48960, #48983, #49055, #49057, #49077, #49082, #49083
- Failed merges:
2018-03-17 11:39:38 +00:00