Commit Graph

78405 Commits

Author SHA1 Message Date
kennytm
e6495d12b6
Rollup merge of #50958 - KiChjang:nit-50697, r=pnkfelix
Micro-optimization on PR#50697

We should stop iterating through the indices in the `init_path_map` once we've already found a match for the local.

r? @nikomatsakis or @pnkfelix
2018-05-23 00:26:21 +08:00
kennytm
25a907dfb1
Rollup merge of #50952 - steveklabnik:2018-book, r=alexcrichton
Add the 2018 edition of the book to doc.rust-lang.org

The second edition of the book is on its way to the printers, and as such, is frozen. We've forked off the 2018 edition to add new stuff to; this PR now builds it so that people can read it on doc.rust-lang.org.
2018-05-23 00:26:20 +08:00
kennytm
c717a70a36
Rollup merge of #50947 - QuietMisdreavus:nice-tabs, r=GuillaumeGomez
rustdoc: set tab width in rust source blocks

cc https://github.com/rust-lang/rust/issues/49155 (fixes it?)

This sets the tab width ([in supported browsers](https://developer.mozilla.org/en-US/docs/Web/CSS/tab-size)) in Rust source blocks to 4 spaces wide (instead of the default 8), to correspond with the style guidelines.
2018-05-23 00:26:19 +08:00
kennytm
aa63dce256
Rollup merge of #50946 - alexcrichton:fix-parse-lifetime, r=petrochenkov
rustc: Fix procedural macros generating lifetime tokens

This commit fixes an accidental regression from #50473 where lifetime tokens
produced by procedural macros ended up getting lost in translation in the
compiler and not actually producing parseable code. The issue lies in the fact
that a lifetime's `Ident` is prefixed with `'`. The `glue` implementation for
gluing joint tokens together forgot to take this into account so the lifetime
inside of `Ident` was missing the leading tick!

The `glue` implementation here is updated to create a new `Symbol` in these
situations to manufacture a new `Ident` with a leading tick to ensure it parses
correctly.

Closes #50942
2018-05-23 00:26:18 +08:00
kennytm
98e801ac0b
Rollup merge of #50945 - stjepang:stabilize-from-ref, r=SimonSapin
Stabilize feature from_ref

Function `from_ref_mut` is now renamed to `from_mut`, as discussed in #45703.

Closes #45703.

r? @SimonSapin
2018-05-23 00:26:17 +08:00
kennytm
5b67b13d1e
Rollup merge of #50932 - nnethercote:seen-Predicates, r=eddyb
Optimize seen Predicate filtering.

This speeds up a few rustc-perf benchmark runs, most notably ones
involving 'coercions', the best by 2%.
2018-05-23 00:26:15 +08:00
kennytm
bc76e8b029
Rollup merge of #50931 - nnethercote:inline-try_get, r=michaelwoerister
Inline `try_get`.

This speeds up lots of rustc-perf benchmark runs. The maximum
improvement is 1%, but there are a lot in the 0.5--1.0% range.
2018-05-23 00:26:14 +08:00
kennytm
696b84c883
Rollup merge of #50914 - simartin:issue_50636, r=oli-obk
Issue #50636: Improve error diagnostic with missing commas after struct fields.

Fixes #50636
2018-05-23 00:26:13 +08:00
kennytm
e51b35e26f
Rollup merge of #50913 - d-e-s-o:fix-typo, r=joshtriplett
Fix typo in cell.rs
2018-05-23 00:26:12 +08:00
kennytm
42b4c49b45
Rollup merge of #50875 - QuietMisdreavus:short-features, r=GuillaumeGomez
rustdoc: use "short form" doc(cfg) printing even when combined with other conditionals

Fixes https://github.com/rust-lang/rust/issues/49334

The original "short form" printing was introduced when `target_feature` was added to the `doc(cfg)` handling. However, it didn't properly propagate the "short form" indicator if the cfg was a combination of multiple conditionals, so the linked issue happened. This changes the handling to use a bool in the original `Html` wrapper, rather than a separate wrapper struct that defers to the original one.
2018-05-23 00:26:11 +08:00
kennytm
e7e3261121
Rollup merge of #50863 - oli-obk:const_len, r=SimonSapin,Gankro
Make `[T]::len` and `str::len` const fn

r? @Gankro
2018-05-23 00:26:10 +08:00
kennytm
eb92280287
Rollup merge of #50849 - est31:visit_closure_args, r=michaelwoerister
CheckLoopVisitor: also visit closure arguments

This turns the ICE #50581 in this code:

```rust
fn main() {
    |_: [u8; break]| ();
}
```

from
```
    'assertion failed: self.tcx.sess.err_count() > 0', librustc_typeck/check/mod.rs
```
to
```
    librustc_mir/hair/cx/expr.rs:543: invalid loop id for break: not inside loop scope
```

which is an ICE as well but at a later stage during compilation and most importantly
fixes of bug #50576 will fix this as well.

As this "only" moves an ICE to a later stage, I didn't add any tests.

Now I have manually verified the default impls of the visitor trait to check whether we have missed any other opportunity to visit more stuff and coudln't find anything (except the missing `break` visit I've fixed in #50829 but that one was already r+'d so I didn't want to push more commits).
2018-05-23 00:26:08 +08:00
kennytm
20298a93ab
Rollup merge of #50846 - GuillaumeGomez:add-e0665, r=frewsxcv
Add E0665
2018-05-23 00:26:06 +08:00
steveklabnik
292be70f9d build the 2018 edition 2018-05-22 11:30:15 -04:00
bors
9f80ea3281 Auto merge of #49172 - oli-obk:const_let, r=eddyb
Allow let bindings and destructuring in constants and const fn

r? @eddyb

cc https://github.com/rust-lang/rust/issues/48821
2018-05-22 12:57:06 +00:00
Oliver Schneider
2483c81217
Deduplicate match arms 2018-05-22 13:56:37 +02:00
bors
ff8fa5cc69 Auto merge of #50520 - Zoxc:alloc-misc, r=oli-obk
Misc changes related to Miri allocations

This builds on top of https://github.com/rust-lang/rust/pull/50249

r? @oli-obk
2018-05-22 10:35:59 +00:00
Oliver Schneider
61c58c2f67
Fix a typo in a comment 2018-05-22 10:54:06 +02:00
Oliver Schneider
cfb6816424
Remove now unused error code 2018-05-22 10:54:06 +02:00
Oliver Schneider
8a5eb68958
Report let bindings and statements as unstable 2018-05-22 10:54:05 +02:00
Oliver Schneider
d7bf358dbd
Be more explicit about what's skipped 2018-05-22 10:54:05 +02:00
Oliver Schneider
9872160836
Allow let bindings in const fn and constants 2018-05-22 10:54:05 +02:00
bors
1bbae5f386 Auto merge of #50876 - matthewjasper:rollback-trivial-bounds, r=nikomatsakis
Filter global bounds from ParamEnv again.

This PR adds back the filtering of global bounds from ParamEnv as a temporary solution for #50825.

<details>

Long term, the fix seems like it should be changing the priority in `candidate_should_be_dropped_in_favor_of` so that (global) where clauses aren't considered as highly.

a722296b6e/src/librustc/traits/select.rs (L2017-L2022)

</details>

r? @nikomatsakis
2018-05-22 06:54:34 +00:00
Keith Yeung
1fcb475271 Micro-optimization on PR#50697 2018-05-21 21:45:15 -07:00
bors
6835748725 Auto merge of #50838 - alexcrichton:token-impls, r=eddyb
rustc: Fix joint-ness of stringified token-streams

This commit fixes `StringReader`'s parsing of tokens which have been stringified
through procedural macros. Whether or not a token tree is joint is defined by
span information, but when working with procedural macros these spans are often
dummy and/or overridden which means that they end up considering all operators
joint if they can!

The fix here is to track the raw source span as opposed to the overridden span.
With this information we can more accurately classify `Punct` structs as either
joint or not.

Closes #50700
2018-05-22 04:17:20 +00:00
John Kåre Alsaker
ddc54188fb Introduce AllocType which indicates what AllocIds point to 2018-05-22 04:15:29 +02:00
John Kåre Alsaker
90167500cf Move the allocation interner out of InterpretInternerInner 2018-05-22 04:15:28 +02:00
John Kåre Alsaker
aace842a08 Get rid of literal_alloc_cache 2018-05-22 04:15:28 +02:00
bors
38fd7ea50a Auto merge of #50486 - Manishearth:approx-stab, r=nrc
Stabilize suggestion applicability field in json output

cc @killercup

r? @nrc
2018-05-22 01:53:55 +00:00
bors
65a16c0007 Auto merge of #49283 - varkor:combining-chars-escape_debug, r=SimonSapin
Escape combining characters in char::Debug

Although combining characters are technically printable, they make little sense to print on their own with `Debug`: it'd be better to escape them like non-printable characters.

This is a breaking change, but I imagine the fact `escape_debug` is rare and almost certainly primarily used for debugging that this is an acceptable change.
Resolves #41922.

r? @alexcrichton
cc @clarcharr
2018-05-21 23:26:32 +00:00
QuietMisdreavus
ac383454c3 rustdoc: set tab width in rust source blocks 2018-05-21 16:46:38 -05:00
bors
cb20f68d0f Auto merge of #50812 - kennytm:fix-50756-miri-bad-float-behavior, r=oli-obk
Fix issue #50811 (`NaN > NaN` was true).

Fix #50811

Make sure the float comparison output is consistent with the expected behavior when NaN is involved.

----

Note: This PR is a **BREAKING CHANGE**. If you have used `>` or `>=` to compare floats, and make the result as the length of a fixed array type, like:

```rust
use std::f64::NAN;
let x: [u8; (NAN > NAN) as usize] = [1];
```

then the code will no longer compile. Previously, all float comparison involving NaN will just return "Greater", i.e. `NAN > NAN` would wrongly return `true` during const evaluation. If you need to retain the old behavior (why), you may replace `a > b` with `a != a || b != b || a > b`.
2018-05-21 21:16:16 +00:00
varkor
b6539372e9 Fix tables.rs 2018-05-21 19:12:36 +01:00
varkor
2fa22effb6 Avoid counting characters and add explanatory comment to test 2018-05-21 18:57:54 +01:00
varkor
c51f002802 Only escape extended grapheme characters in the first position 2018-05-21 18:57:54 +01:00
varkor
8c89e7f3d5 Make {char, str}::escape_debug and impl Debug for {char, str} consistent 2018-05-21 18:57:54 +01:00
varkor
d7aa35eb1b Use Grapheme_Extend instead of Mn 2018-05-21 18:57:54 +01:00
varkor
d3c257b0ae Use the correct output directory for downloading Unicode files 2018-05-21 18:57:54 +01:00
varkor
68c4fb8f2f Remove example in test for is_nonspacing_mark because it's currently private 2018-05-21 18:57:54 +01:00
varkor
699a2b5c7e Add test for Debug formatting of char 2018-05-21 18:57:54 +01:00
varkor
4694d20170 Escape combining characters in escape_debug 2018-05-21 18:57:54 +01:00
varkor
b72faf5795 Keep tables.rs copyright notice up to date 2018-05-21 18:57:54 +01:00
varkor
a0b5d3813e Download unicode data files in directory of unicode.py 2018-05-21 18:57:54 +01:00
varkor
f53022f88d Update unicode/tables.rs with Mn 2018-05-21 18:57:54 +01:00
varkor
9802300302 Update .gitignore for libstd_unicode 2018-05-21 18:57:54 +01:00
Manish Goregaokar
b0e66386f7 update tests 2018-05-21 10:48:12 -07:00
Manish Goregaokar
1d8a4d16a7 Remove rustc_serialize_exclude_null 2018-05-21 10:48:12 -07:00
Manish Goregaokar
30bd586bec Stabilize suggestion applicability field in json output 2018-05-21 10:48:12 -07:00
bors
56e541ddf1 Auto merge of #50801 - eddyb:param-things, r=nikomatsakis
Quick refactoring around Substs & friends.

r? @nikomatsakis
2018-05-21 17:19:39 +00:00
Oliver Schneider
2788f66ab0 Add some runtime sanity checks 2018-05-21 19:00:56 +02:00