Commit graph

78368 commits

Author SHA1 Message Date
Michael Woerister 599b79ebf5 Make sure that queries have predictable symbol names. 2018-05-22 15:00:50 +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
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
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
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
bors 6e6a4b1957 Auto merge of #50265 - japaric:sz, r=alexcrichton
stabilize opt-level={s,z}

closes #35784
closes #47651

### Rationale

Since the lastest LLVM upgrade rustc / LLVM does more agressive loop unrolling. This results in increased binary size of embedded / no_std programs: a hundreds of bytes increase, or about a 7x increase, in the case of the smallest Cortex-M binary cf. #49260.

As we are shooting for embedded Rust on stable it would be great to also provide a way to optimize for size (which is pretty important for embedded applications that target resource constrained devices) on stable.

Also this has been baking in nightly for a long time.

r? @alexcrichton which team has to sign off this?
2018-05-21 12:33:19 +00:00
Eduard-Mihai Burtescu 73f62106ad rustc: move TypeParamDef's fields into GenericParamDefKind::Type. 2018-05-21 12:13:19 +03:00
Eduard-Mihai Burtescu ba2c5c5288 rustc: use AccumulateVec in Substs::for_item. 2018-05-21 12:13:19 +03:00
Eduard-Mihai Burtescu dce288ec82 rustc: don't expose Substs::fill_item as public. 2018-05-21 12:13:19 +03:00
Eduard-Mihai Burtescu 7e4d8718cb rustc: use intern_* instead of mk_* where possible. 2018-05-21 12:13:19 +03:00
Eduard-Mihai Burtescu 196b2e0d82 rustc: don't call Kind::from directly, use .into() instead. 2018-05-21 12:13:19 +03:00
Eduard-Mihai Burtescu e3df729c25 rustc: make mk_substs_trait take &[Kind] instead of &[Ty]. 2018-05-21 12:13:17 +03:00
Eduard-Mihai Burtescu d47dc98767 rustc: avoid using intern_*(it.collect()) when mk_*(it) works better. 2018-05-21 12:12:40 +03:00
bors 21b5367045 Auto merge of #50898 - shepmaster:typo, r=QuietMisdreavus
UnsafeCell doc typos and minor flow improvements

r? @QuietMisdreavus
2018-05-21 08:33:58 +00:00
bors 98686ca294 Auto merge of #50739 - gnzlbg:vec_reserve, r=sfackler
Switch Vec from doubling size on growth to using RawVec's reserve

On growth, Vec does not require to exactly double its size for correctness,
like, for example, VecDeque does.

Using reserve instead better expresses this intent. It also allows to reuse
Excess capacity on growth and for better growth-policies to be provided by
RawVec.

r? @sfackler
2018-05-21 06:19:44 +00:00
bors ba1363ffe1 Auto merge of #50924 - petrochenkov:spanover, r=alexcrichton
lexer: Fix span override for the first token in a string

Previously due to peculiarities of `StringReader` construction something like `"a b c d".parse::<TokenStream>()` gave you one non-overridden span for `a` and then three correctly overridden spans for `b`, `c` and `d`.
Now all the spans are overridden.
2018-05-21 03:36:30 +00:00
bors 1e508c4209 Auto merge of #50860 - nox:big-niches-for-big-doggos-🐕, r=eddyb
Find the largest niche when computing layouts

Otherwise we end up with `Option<Option<(&(), bool)>>` unnecessarily large.
2018-05-21 01:23:15 +00:00
bors 538fea5757 Auto merge of #50851 - eddyb:the-only-constant, r=nikomatsakis
rustc: introduce {ast,hir}::AnonConst to consolidate so-called "embedded constants".

Previously, constants in array lengths and enum variant discriminants were "merely an expression", and had no separate ID for, e.g. type-checking or const-eval, instead reusing the expression's.

That complicated code working with bodies, because such constants were the only special case where the "owner" of the body wasn't the HIR parent, but rather the same node as the body itself.
Also, if the body happened to be a closure, we had no way to allocate a `DefId` for both the constant *and* the closure, leading to *several* bugs (mostly ICEs where type errors were expected).

This PR rectifies the situation by adding another (`{ast,hir}::AnonConst`) node around every such constant. Also, const generics are expected to rely on the new `AnonConst` nodes, as well (cc @varkor).
* fixes #48838
* fixes #50600
* fixes #50688
* fixes #50689
* obsoletes #50623

r? @nikomatsakis
2018-05-20 22:37:06 +00:00
Vadim Petrochenkov b4714cdf6e lexer: Fix span override for the first token in a string 2018-05-20 23:35:00 +03:00
bors a1d4a9503e Auto merge of #50234 - cramertj:extend, r=alexcrichton
Add implementation of Extend for ()

This is useful in some generic code which wants to collect iterators of items into a result.
2018-05-20 20:29:10 +00:00
bors 2dca249da0 Auto merge of #50719 - frewsxcv:frewsxcv-iterator-zip, r=alexcrichton
Fix incorrect statement about return value for Iterator::zip.

Fixes https://github.com/rust-lang/rust/issues/50225.
2018-05-20 18:18:12 +00:00
bors b438449161 Auto merge of #50908 - petrochenkov:usemacself, r=alexcrichton
resolve: Don't add unnecessary import candidates for `prefix::{self}` imports

Fixes https://github.com/rust-lang/rust/issues/50725
2018-05-20 14:24:14 +00:00
bors 22c25dd737 Auto merge of #50841 - oli-obk:promote_errors_to_panics, r=eddyb
Don't lint numeric overflows in promoteds in release mode

r? @eddyb

mitigates #50814
2018-05-20 11:13:24 +00:00
bors 4c26e2e3fb Auto merge of #50855 - nnethercote:fewer-macro_parser-allocs, r=petrochenkov
Speed up the macro parser

These three commits reduce the number of allocations done by the macro parser, in some cases dramatically. For example, for a clean check builds of html5ever, the number of allocations is reduced by 40%.

Here are the rustc-benchmarks that are sped up by at least 1%.
```
html5ever-check
        avg: -6.6%      min: -10.3%     max: -4.1%
html5ever
        avg: -5.2%      min: -9.5%      max: -2.8%
html5ever-opt
        avg: -4.3%      min: -9.3%      max: -1.6%
crates.io-check
        avg: -1.8%      min: -2.9%      max: -0.6%
crates.io-opt
        avg: -1.0%      min: -2.2%      max: -0.1%
crates.io
        avg: -1.1%      min: -2.2%      max: -0.2%
```
2018-05-20 08:55:50 +00:00
bors ccb5e973f7 Auto merge of #50820 - alexcrichton:no-modules, r=petrochenkov
rustc: Disallow modules and macros in expansions

This commit feature gates generating modules and macro definitions in procedural
macro expansions. Custom derive is exempt from this check as it would be a large
retroactive breaking change (#50587). It's hoped that we can hopefully stem the
bleeding to figure out a better solution here before opening up the floodgates.

The restriction here is specifically targeted at surprising hygiene results [1]
that result in non-"copy/paste" behavior. Hygiene and procedural macros is
intended to be avoided as much as possible for Macros 1.2 by saying everything
is "as if you copy/pasted the code", but modules and macros are sort of weird
exceptions to this rule that aren't fully fleshed out.

[1]: https://github.com/rust-lang/rust/issues/50504#issuecomment-387734625

cc #50504
2018-05-20 05:57:41 +00:00
bors 522aa5e00b Auto merge of #50813 - paoloteti:cortex-r, r=alexcrichton
Add target for Big-endian ARM Cortex-R4F/R5F MCUs

The ARM Real-Time (‘R’) profile provides high-performing processors for safety-critical environments.

Cortex-R has ARM, Thumb instruction whereas Cortex-M makes use of Thumb only.

CI/Dockerfile is intentionally in the `disabled` folder.
2018-05-20 03:29:49 +00:00
Jake Goulding 52249e357d UnsafeCell doc typos and minor flow improvements 2018-05-19 21:10:24 -04:00
bors 21ea121de1 Auto merge of #50803 - varkor:never-transmute-never, r=eddyb
Fix an ICE when attempting to transmute an uninhabited type

Fixes https://github.com/rust-lang/rust/issues/50570.
2018-05-20 00:49:37 +00:00
Vadim Petrochenkov 5fd7d2fc76 resolve: Don't add unnecessary import candidates for prefix::{self} imports 2018-05-20 02:20:05 +03:00
bors 3ea2491589 Auto merge of #50893 - kennytm:rollup, r=kennytm
Rollup of 8 pull requests

Successful merges:

 - #50531 (Cleanup uses of TypeIdHasher and replace them with StableHasher)
 - #50819 (Fix potential divide by zero)
 - #50827 (Update LLVM to 56c931901cfb85cd6f7ed44c7d7520a8de1edf97)
 - #50829 (CheckLoopVisitor: also visit break expressions)
 - #50854 (in which the unused shorthand field pattern debacle/saga continues)
 - #50858 (Reorder description for snippets in rustdoc documentation)
 - #50883 (Fix warning when building stage0 libcore)
 - #50889 (Update clippy)

Failed merges:
2018-05-19 22:33:57 +00:00
kennytm ada5feedda
Rollup merge of #50889 - oli-obk:clippy, r=kennytm
Update clippy


# Conflicts:
#	src/Cargo.lock
2018-05-20 04:21:05 +08:00
kennytm e1f031e5d4
Rollup merge of #50819 - cjkenn:cjkenn/div-by-zero, r=kennytm
Fix potential divide by zero

This should fix #50761

I had trouble reproducing with the provided code, but looking at the stack trace would indicate that this code is the likely cause. I made a number of assumptions here, because I don't have enough context on how the register size is set:

1. I assumed `rest.unit.size.bytes()` can be 0, and it's ok if it's set to 0 before this function is called
2. I assumed that if `rest.unit.size.bytes()` is 0, that we want `rest_count` to also be 0.
2018-05-20 04:17:41 +08:00