Commit Graph

80283 Commits

Author SHA1 Message Date
Vadim Petrochenkov
554b4282d8 incremental: Do not hash spans for things that didn't have spans previously 2018-06-28 11:04:51 +03:00
Vadim Petrochenkov
d5e9dffddf Support delegation in stable hashing macros 2018-06-28 11:04:50 +03:00
Vadim Petrochenkov
f0622dfe5d Use Idents for associated item definitions in HIR
Remove emulation of hygiene with gensyms
2018-06-28 11:04:50 +03:00
Vadim Petrochenkov
c6ca1e4abd Use Idents in a number of structures in HIR
Namely: labels, type parameters, bindings in patterns, parameter names in functions without body.
All of these do not need hygiene after lowering to HIR, only span locations.
2018-06-28 11:04:50 +03:00
Vadim Petrochenkov
e8215a4f6f Use Idents for path segments in HIR 2018-06-28 11:04:50 +03:00
Vadim Petrochenkov
1fe9b4d763 Use Idents for associated type bindings in HIR 2018-06-28 11:04:50 +03:00
Vadim Petrochenkov
c5454c04bc Use Idents for lifetimes in HIR 2018-06-28 11:04:50 +03:00
bors
ba196bdcb1 Auto merge of #51444 - estebank:impl-static, r=nikomatsakis
Suggestion for 'static impl Trait return

When encountering a named or anonymous sup requirement (for example,
`&'a self`) and a `'static` impl Trait return type, suggest adding the
`'_` lifetime constraing to the return type.

Fix #43719, #51282.

```
error: cannot infer an appropriate lifetime
  --> $DIR/static-return-lifetime-infered.rs:17:16
   |
LL |     fn iter_values_anon(&self) -> impl Iterator<Item=u32> {
   |                                   ----------------------- this return type evaluates to the `'static` lifetime...
LL |         self.x.iter().map(|a| a.0)
   |         ------ ^^^^
   |         |
   |         ...but this borrow...
   |
note: ...can't outlive the anonymous lifetime #1 defined on the method body at 16:5
  --> $DIR/static-return-lifetime-infered.rs:16:5
   |
LL | /     fn iter_values_anon(&self) -> impl Iterator<Item=u32> {
LL | |         self.x.iter().map(|a| a.0)
LL | |     }
   | |_____^
help: you can add a constraint to the return type to make it last less than `'static` and match the anonymous lifetime #1 defined on the method body at 16:5
   |
LL |     fn iter_values_anon(&self) -> impl Iterator<Item=u32> + '_ {
   |                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
```
2018-06-28 03:57:28 +00:00
bors
99a9d6806d Auto merge of #51538 - nikomatsakis:nll-perf-examination, r=eddyb
convert NLL ops to caches

This is a extension of <https://github.com/rust-lang/rust/pull/51460>. It uses a lot more caching than we used to do. This caching is not yet as efficient as it could be, but I'm curious to see the current perf results.

This is the high-level idea: in the MIR type checker, use [canonicalized queries](https://rust-lang-nursery.github.io/rustc-guide/traits/canonical-queries.html) for all the major operations. This is helpful because the MIR type check is operating in a context where all types are fully known (mostly, anyway) but regions are completely renumbered. This means we often wind up with duplicate queries like `Foo<'1, '2> :Bar` and `Foo<'3, '4>: Bar`. Canonicalized queries let us re-use the results. By the final commit in this PR, we can essentially just "read off" the resulting region relations and add them to the NLL type check.
2018-06-28 01:41:40 +00:00
Guillaume Gomez
6a86ee7328 Prevent some markdown transformation on short docblocks 2018-06-28 01:55:43 +02:00
bors
266afeb17c Auto merge of #51859 - kennytm:rollup, r=kennytm
Rollup of 7 pull requests

Successful merges:

 - #49987 (Add str::split_ascii_whitespace.)
 - #50342 (Document round-off error in `.mod_euc()`-method, see issue #50179)
 - #51658 (Only do sanity check with debug assertions on)
 - #51799 (Lower case some feature gate error messages)
 - #51800 (Add a compiletest header for edition)
 - #51824 (Fix the error reference for LocalKey::try_with)
 - #51842 (Document that Layout::from_size_align does not allow align=0)

Failed merges:

r? @ghost
2018-06-27 23:41:23 +00:00
Wesley Wiser
429bc8d0cc Inline all methods on abi::Size
This save 3 seconds on the test program.
2018-06-27 19:34:42 -04:00
kennytm
99a0d6bf0e
Rollup merge of #51842 - rust-lang:align-is-nonzero, r=cramertj
Document that Layout::from_size_align does not allow align=0

This was already implied since zero is not a power of two, but maybe worth pointing out.
2018-06-28 06:15:43 +08:00
kennytm
7f4347f8e2
Rollup merge of #51824 - vorner:thread-local-try-with-doc, r=kennytm
Fix the error reference for LocalKey::try_with

There's no such thing as `ThreadLocalError` and the method obviously returns `AccessError`, so adjusting (probably only outdated docs).
2018-06-28 06:15:42 +08:00
kennytm
700a2f799a
Rollup merge of #51800 - mark-i-m:edition2018compiletest, r=nikomatsakis
Add a compiletest header for edition

r? @nikomatsakis

Are the `-Zunstable-options` options needed in these tests? It looks like they aren't. If not, I can remove them.
2018-06-28 06:15:41 +08:00
kennytm
770d0fba63
Rollup merge of #51799 - mark-i-m:lower_case_feature_gate, r=mark-i-m
Lower case some feature gate error messages
2018-06-28 06:15:40 +08:00
kennytm
1ebd9adef4
Rollup merge of #51658 - oli-obk:unregress_perf, r=nikomatsakis
Only do sanity check with debug assertions on

r? @nnethercote

I'm slighty confused. These changes address code that the `unused-warnings` benchmark doesn't go through, yet I see a 5% improvement to nightly on the `check` run, and no improvement on the other runs.

Maybe this change allows unrelated code in the same function to be better optimized?
2018-06-28 06:15:39 +08:00
kennytm
63531f515d
Rollup merge of #50342 - fkjogu:euclidean, r=BurntSushi
Document round-off error in `.mod_euc()`-method, see issue #50179

Due to a round-off error the method `.mod_euc()` of both `f32` and `f64` can produce mathematical invalid outputs. If `self` in magnitude is much small than the modulus `rhs` and negative, `self + rhs` in the first branch cannot be represented in the given precision and results into `rhs`. In the mathematical strict sense, this breaks the definition. But given the limitation of floating point arithmetic it can be thought of the closest representable value to the true result, although it is not strictly in the domain `[0.0, rhs)` of the function. It is rather the left side asymptotical limit. It would be desirable that it produces the mathematical more sound approximation of `0.0`, the right side asymptotical limit. But this breaks the property, that `self == self.div_euc(rhs) * rhs + a.mod_euc(rhs)`.

The discussion in issue #50179 did not find an satisfying conclusion to which property is deemed more important. But at least we can document the behaviour. Which this pull request does.
2018-06-28 06:15:38 +08:00
kennytm
e5462b82e3
Rollup merge of #49987 - clarcharr:split_ascii_whitespace, r=SimonSapin
Add str::split_ascii_whitespace.

As mentioned in #48656.

While `str::split_whitespace` now works in `libcore`, it still makes sense to offer this method, considering how it is still more performant in cases where only ASCII is necessary.
2018-06-28 06:15:37 +08:00
Clar Charr
b5cee029a5 Add str::split_ascii_whitespace. 2018-06-27 17:54:27 -04:00
Matthew Jasper
2cb0a0631a Update tests for grouped nll move errors 2018-06-27 22:46:58 +01:00
Matthew Jasper
0193d1f736 Group move errors before reporting, add suggestions 2018-06-27 22:46:58 +01:00
bors
cd494c1f09 Auto merge of #51139 - vakaras:issue-50716, r=nikomatsakis
Fix NLL issue 50716 and add a regression test.

Fix for NLL issue #50716.

r? @nikomatsakis
2018-06-27 21:32:44 +00:00
Matthew Jasper
43fce075d3 Update MIR opt tests 2018-06-27 22:06:21 +01:00
Matthew Jasper
9185bb3061 Generate a direct assignment in MIR for let x = y; 2018-06-27 22:04:45 +01:00
Niko Matsakis
1523de34a2 rustfmt various files 2018-06-27 16:30:38 -04:00
Niko Matsakis
9b1d2229ff change the enter_canonical_trait_query method to give a fulfill cx 2018-06-27 16:04:32 -04:00
Niko Matsakis
f0fdce31d9 update comments 2018-06-27 15:45:53 -04:00
Niko Matsakis
5fd3b26280 rename prequery to try_fast_path 2018-06-27 15:45:53 -04:00
Niko Matsakis
0a0dae0964 pull out ParamEnvAnd and remove QueryKey 2018-06-27 15:45:49 -04:00
bors
23b55161ab Auto merge of #51852 - oli-obk:miri_fix, r=Zoxc
Don't use `ParamEnv::reveal_all()` if there is a real one available

fixes #51841

r? @Zoxc
2018-06-27 19:30:14 +00:00
Josef Reinhard Brandl
30d825ce72 Fix doc links 2018-06-27 20:22:49 +02:00
Niko Matsakis
5c06b23025 run rustfmt 2018-06-27 13:32:00 -04:00
bors
4aff10bb1b Auto merge of #51850 - abarth:draw_again, r=cramertj
[fuchsia] Update zx_cprng_draw to target semantics

This change is the final step in improving the semantics of
zx_cprng_draw. Now the syscall always generates the requested number of
bytes. If the syscall would have failed to generate the requested number
of bytes, the syscall either terminates the entire operating system or
terminates the calling process, depending on whether the error is a
result of the kernel misbehaving or the userspace program misbehaving.
2018-06-27 17:20:27 +00:00
Niko Matsakis
497273620b don't use Iterator and zip but just invoke next manually
This micro-optimizes some if checks away; the compiler may already
have been doing it, not sure.
2018-06-27 13:01:23 -04:00
Oliver Schneider
89d8e0a260 Don't use ParamEnv::reveal_all() if there is a real one available 2018-06-27 18:24:24 +02:00
Vytautas Astrauskas
03ecd982bf Fix the error of selecting obligation by not running the borrow checker. 2018-06-27 18:14:00 +02:00
Felix S. Klock II
f288b87c23 Move regression test from compile-fail/ to ui/ test directory. 2018-06-27 18:13:43 +02:00
Vytautas Astrauskas
8b1ea84265 Fix the regression test for issue 50716. 2018-06-27 18:13:43 +02:00
Vytautas Astrauskas
612eeb1df7 Fix NLL issue 50716 and add a regression test. 2018-06-27 18:13:43 +02:00
Adam Barth
a9f7cc3b49 [fuchsia] Update zx_cprng_draw to target semantics
This change is the final step in improving the semantics of
zx_cprng_draw. Now the syscall always generates the requested number of
bytes. If the syscall would have failed to generate the requested number
of bytes, the syscall either terminates the entire operating system or
terminates the calling process, depending on whether the error is a
result of the kernel misbehaving or the userspace program misbehaving.
2018-06-27 08:56:19 -07:00
Niko Matsakis
e10414e055 avoid use of vectors etc 2018-06-27 11:47:58 -04:00
Niko Matsakis
edf14d1884 extract places_conflict into its own module 2018-06-27 11:47:58 -04:00
bors
ed0350e945 Auto merge of #51356 - Zoxc:encode-cleanup, r=michaelwoerister
Make opaque::Encoder append-only and make it infallible
2018-06-27 14:25:52 +00:00
Niko Matsakis
b2e899f843 move into provide methods 2018-06-27 09:42:21 -04:00
Niko Matsakis
c3f7e02fb6 rename to shrink_to_tcx_lifetime 2018-06-27 09:27:07 -04:00
Simon Sapin
1565fc2120 Document that Layout::from_size_align does not allow align=0
This was already implied since zero is not a power of two, but maybe
worth pointing out.
2018-06-27 15:07:42 +02:00
Niko Matsakis
c2f7757bc5 extend comment to note complications around lifetimes 2018-06-27 08:55:41 -04:00
Michael Woerister
ba30c1dac9 syntax_pos: Store multibyte char size as u8 instead of u32. 2018-06-27 14:00:34 +02:00
Michael Woerister
ba1d18fe29 Add comments to analzye_filemap(). 2018-06-27 14:00:34 +02:00