Commit graph

78562 commits

Author SHA1 Message Date
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
Benjamin Lamowski f6df1740b6 rust-gdb: work around the re-used -d argument in cgdb
Use --directory= instead of -d, because cgdb reuses the short option.
2018-05-21 20:58:19 -04: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
Eduard-Mihai Burtescu da579ef75e rustc_codegen_llvm: remove closure env alloca hack around upvar debuginfo. 2018-05-21 20:39:59 +03:00
Eduard-Mihai Burtescu a8ceab9cd7 rustc_codegen_llvm: remove debuginfo::VariableKind::CapturedVariable. 2018-05-21 20:39:59 +03: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
Oliver Schneider d6fc3e176e Make [T]::len and str::len const fn 2018-05-21 18:59:09 +02:00
Oliver Schneider 5a7fc9b33a Satisfy tidy 2018-05-21 18:43:11 +02:00
Alex Crichton 3b8f791bf6 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-21 09:35:15 -07:00
Stjepan Glavina 26d62f55a4 Stabilize feature from_ref 2018-05-21 18:16:08 +02:00
Oliver Schneider af75ebdc3a Improve the diagnostic around impl Trait <-> generic param mismatch 2018-05-21 18:06:28 +02:00
Guillaume Gomez 8c004b8308 Add E0665 2018-05-21 15:41:19 +02: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
Nicholas Nethercote 2ff632484c Optimize seen Predicate filtering.
This speeds up a few rustc-perf benchmark runs, most notably ones
involving 'coercions', the best by 2%.
2018-05-21 18:43:25 +10:00
Nicholas Nethercote 95120164b0 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-21 18:35:47 +10: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
Oliver Schneider 00842d10cd Move a test to ui tests so we can observe the output changes better 2018-05-21 09:59:37 +02:00
Oliver Schneider 0874ba0fe5 Typo caused the wrong "cannot find" error 2018-05-21 09:56:52 +02: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