]> git.lizzy.rs Git - rust.git/log
rust.git
6 years agoRollup merge of #51765 - jonas-schievink:patch-1, r=KodrAus
Mark Rousskov [Thu, 28 Jun 2018 22:07:12 +0000 (16:07 -0600)]
Rollup merge of #51765 - jonas-schievink:patch-1, r=KodrAus

Use assert_eq! in copy_from_slice

This will print both lengths when the assertion fails instead of just saying that they're different.

Output of current stable and nightly (modulo the exact line number):
```
thread 'main' panicked at 'destination and source slices have different lengths', libcore/slice/mod.rs:1645:9
```

Output after this PR:
```
thread 'main' panicked at 'assertion failed: `(left == right)`
  left: `123`,
 right: `456`: destination and source slices have different lengths', libcore/slice/mod.rs:1645:9
```

Note that I have not run the tests locally.

6 years agoRollup merge of #51636 - oli-obk:const_diagnostics, r=eddyb
Mark Rousskov [Thu, 28 Jun 2018 22:07:10 +0000 (16:07 -0600)]
Rollup merge of #51636 - oli-obk:const_diagnostics, r=eddyb

Refactor error reporting of constants

cc @eddyb

This PR should not change any behaviour. It solely simplifies the internal handling of the errors

6 years agoAuto merge of #51687 - japaric:gh51671, r=alexcrichton
bors [Thu, 28 Jun 2018 15:34:17 +0000 (15:34 +0000)]
Auto merge of #51687 - japaric:gh51671, r=alexcrichton

translate / export weak lang items

see #51671 for details

fixes #51671
fixes #51342

r? @michaelwoerister or @alexcrichton

6 years agoAuto merge of #51630 - joshlf:map-split-perf, r=dtolnay
bors [Thu, 28 Jun 2018 13:23:07 +0000 (13:23 +0000)]
Auto merge of #51630 - joshlf:map-split-perf, r=dtolnay

Optimize RefCell refcount tracking

Address the performance concern raised in https://github.com/rust-lang/rust/pull/51466#issuecomment-398255276

cc @dtolnay  @nnethercote @rust-lang/wg-compiler-performance

cc @RalfJung @jhjourdan for soundness concerns

Can somebody kick off a perf run on this? I'm not sure how that's done, but I understand it has to be started manually.

The idea of this change is to switch to representing mutable refcount as values below 0 to eliminate some branching that was required with the old algorithm.

6 years agoAuto merge of #50997 - michaelwoerister:pre-analyze-filemaps, r=Mark-Simulacrum
bors [Thu, 28 Jun 2018 11:20:41 +0000 (11:20 +0000)]
Auto merge of #50997 - michaelwoerister:pre-analyze-filemaps, r=Mark-Simulacrum

 Make FileMap::{lines, multibyte_chars, non_narrow_chars} non-mutable.

This PR removes most of the interior mutability from `FileMap`, which should be beneficial, especially in a multithreaded setting. This is achieved by initializing the state in question when the filemap is constructed instead of during lexing. Hopefully this doesn't degrade performance.

cc @wesleywiser

6 years agoRebase fallout
Oliver Schneider [Thu, 28 Jun 2018 09:19:45 +0000 (11:19 +0200)]
Rebase fallout

6 years agoAuto merge of #51492 - petrochenkov:hirident, r=eddyb
bors [Thu, 28 Jun 2018 09:16:10 +0000 (09:16 +0000)]
Auto merge of #51492 - petrochenkov:hirident, r=eddyb

Use `Ident`s in HIR and remove emulation of hygiene with gensyms

continuation of https://github.com/rust-lang/rust/pull/51072, part of https://github.com/rust-lang/rust/issues/49300

Not all `Name`s in HIR are replaced with `Ident`s, only those needed for hygiene or already having attached spans.

6 years agoTurn the use of erroneous constants into errors again
Oliver Schneider [Wed, 27 Jun 2018 12:55:06 +0000 (14:55 +0200)]
Turn the use of erroneous constants into errors again

6 years agoDon't const propagate the body of constants
Oliver Schneider [Wed, 27 Jun 2018 11:36:30 +0000 (13:36 +0200)]
Don't const propagate the body of constants

6 years agoMerge `ConstVal` and `ConstValue`
Oliver Schneider [Mon, 25 Jun 2018 18:53:02 +0000 (20:53 +0200)]
Merge `ConstVal` and `ConstValue`

6 years agoFixup
Oliver Schneider [Mon, 25 Jun 2018 16:48:11 +0000 (18:48 +0200)]
Fixup

6 years agoMove everything over from `middle::const_val` to `mir::interpret`
Oliver Schneider [Mon, 25 Jun 2018 16:46:02 +0000 (18:46 +0200)]
Move everything over from `middle::const_val` to `mir::interpret`

6 years agoMove the Lrc outside the error type and name the fields
Oliver Schneider [Mon, 25 Jun 2018 15:41:20 +0000 (17:41 +0200)]
Move the Lrc outside the error type and name the fields

6 years agoRemove unused type
Oliver Schneider [Mon, 25 Jun 2018 13:10:33 +0000 (15:10 +0200)]
Remove unused type

6 years agoAddress review comments
Oliver Schneider [Mon, 25 Jun 2018 13:08:05 +0000 (15:08 +0200)]
Address review comments

6 years agoEliminate old CTFE's `ErrKind`
Oliver Schneider [Tue, 19 Jun 2018 14:40:53 +0000 (16:40 +0200)]
Eliminate old CTFE's `ErrKind`

6 years agoSimplify const error reporting
Oliver Schneider [Thu, 14 Jun 2018 23:26:56 +0000 (01:26 +0200)]
Simplify const error reporting

6 years agoFix FileMap::line_begin_pos().
Michael Woerister [Thu, 28 Jun 2018 08:45:57 +0000 (10:45 +0200)]
Fix FileMap::line_begin_pos().

The method relied on the FileMap still being under construction in
order for it to do what the name promises. It's now independent of
the current state.

6 years agoFix rebase
Vadim Petrochenkov [Wed, 27 Jun 2018 21:12:17 +0000 (00:12 +0300)]
Fix rebase

6 years agoincremental: Do not hash spans for things that didn't have spans previously
Vadim Petrochenkov [Sat, 16 Jun 2018 16:44:12 +0000 (19:44 +0300)]
incremental: Do not hash spans for things that didn't have spans previously

6 years agoSupport delegation in stable hashing macros
Vadim Petrochenkov [Sat, 16 Jun 2018 14:09:42 +0000 (17:09 +0300)]
Support delegation in stable hashing macros

6 years agoUse `Ident`s for associated item definitions in HIR
Vadim Petrochenkov [Sun, 10 Jun 2018 19:24:24 +0000 (22:24 +0300)]
Use `Ident`s for associated item definitions in HIR

Remove emulation of hygiene with gensyms

6 years agoUse `Ident`s in a number of structures in HIR
Vadim Petrochenkov [Sun, 10 Jun 2018 16:33:30 +0000 (19:33 +0300)]
Use `Ident`s 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.

6 years agoUse `Ident`s for path segments in HIR
Vadim Petrochenkov [Sun, 10 Jun 2018 14:40:45 +0000 (17:40 +0300)]
Use `Ident`s for path segments in HIR

6 years agoUse `Ident`s for associated type bindings in HIR
Vadim Petrochenkov [Sun, 10 Jun 2018 12:55:48 +0000 (15:55 +0300)]
Use `Ident`s for associated type bindings in HIR

6 years agoUse `Ident`s for lifetimes in HIR
Vadim Petrochenkov [Sat, 9 Jun 2018 20:25:33 +0000 (23:25 +0300)]
Use `Ident`s for lifetimes in HIR

6 years agoAuto merge of #51444 - estebank:impl-static, r=nikomatsakis
bors [Thu, 28 Jun 2018 03:57:28 +0000 (03:57 +0000)]
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> + '_ {
   |                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
```

6 years agoAuto merge of #51538 - nikomatsakis:nll-perf-examination, r=eddyb
bors [Thu, 28 Jun 2018 01:41:40 +0000 (01:41 +0000)]
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.

6 years agoAuto merge of #51859 - kennytm:rollup, r=kennytm
bors [Wed, 27 Jun 2018 23:41:23 +0000 (23:41 +0000)]
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

6 years agoRollup merge of #51842 - rust-lang:align-is-nonzero, r=cramertj
kennytm [Wed, 27 Jun 2018 22:15:43 +0000 (06:15 +0800)]
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.

6 years agoRollup merge of #51824 - vorner:thread-local-try-with-doc, r=kennytm
kennytm [Wed, 27 Jun 2018 22:15:42 +0000 (06:15 +0800)]
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).

6 years agoRollup merge of #51800 - mark-i-m:edition2018compiletest, r=nikomatsakis
kennytm [Wed, 27 Jun 2018 22:15:41 +0000 (06:15 +0800)]
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.

6 years agoRollup merge of #51799 - mark-i-m:lower_case_feature_gate, r=mark-i-m
kennytm [Wed, 27 Jun 2018 22:15:40 +0000 (06:15 +0800)]
Rollup merge of #51799 - mark-i-m:lower_case_feature_gate, r=mark-i-m

Lower case some feature gate error messages

6 years agoRollup merge of #51658 - oli-obk:unregress_perf, r=nikomatsakis
kennytm [Wed, 27 Jun 2018 22:15:39 +0000 (06:15 +0800)]
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?

6 years agoRollup merge of #50342 - fkjogu:euclidean, r=BurntSushi
kennytm [Wed, 27 Jun 2018 22:15:38 +0000 (06:15 +0800)]
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.

6 years agoRollup merge of #49987 - clarcharr:split_ascii_whitespace, r=SimonSapin
kennytm [Wed, 27 Jun 2018 22:15:37 +0000 (06:15 +0800)]
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.

6 years agoAdd str::split_ascii_whitespace.
Clar Charr [Sat, 5 May 2018 04:33:20 +0000 (00:33 -0400)]
Add str::split_ascii_whitespace.

6 years agoAuto merge of #51139 - vakaras:issue-50716, r=nikomatsakis
bors [Wed, 27 Jun 2018 21:32:44 +0000 (21:32 +0000)]
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

6 years agorustfmt various files
Niko Matsakis [Wed, 27 Jun 2018 20:17:49 +0000 (16:17 -0400)]
rustfmt various files

6 years agochange the `enter_canonical_trait_query` method to give a fulfill cx
Niko Matsakis [Wed, 27 Jun 2018 20:04:32 +0000 (16:04 -0400)]
change the `enter_canonical_trait_query` method to give a fulfill cx

6 years agoupdate comments
Niko Matsakis [Wed, 27 Jun 2018 19:43:23 +0000 (15:43 -0400)]
update comments

6 years agorename `prequery` to `try_fast_path`
Niko Matsakis [Wed, 27 Jun 2018 19:39:20 +0000 (15:39 -0400)]
rename `prequery` to `try_fast_path`

6 years agopull out `ParamEnvAnd` and remove `QueryKey`
Niko Matsakis [Wed, 27 Jun 2018 19:17:03 +0000 (15:17 -0400)]
pull out `ParamEnvAnd` and remove `QueryKey`

6 years agoAuto merge of #51852 - oli-obk:miri_fix, r=Zoxc
bors [Wed, 27 Jun 2018 19:30:14 +0000 (19:30 +0000)]
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

6 years agoAuto merge of #51850 - abarth:draw_again, r=cramertj
bors [Wed, 27 Jun 2018 17:20:27 +0000 (17:20 +0000)]
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.

6 years agoDon't use `ParamEnv::reveal_all()` if there is a real one available
Oliver Schneider [Wed, 27 Jun 2018 16:24:24 +0000 (18:24 +0200)]
Don't use `ParamEnv::reveal_all()` if there is a real one available

6 years agoFix the error of selecting obligation by not running the borrow checker.
Vytautas Astrauskas [Tue, 26 Jun 2018 15:00:39 +0000 (17:00 +0200)]
Fix the error of selecting obligation by not running the borrow checker.

6 years agoMove regression test from `compile-fail/` to `ui/` test directory.
Felix S. Klock II [Wed, 30 May 2018 14:23:54 +0000 (16:23 +0200)]
Move regression test from `compile-fail/` to `ui/` test directory.

6 years agoFix the regression test for issue 50716.
Vytautas Astrauskas [Tue, 29 May 2018 07:13:49 +0000 (09:13 +0200)]
Fix the regression test for issue 50716.

6 years agoFix NLL issue 50716 and add a regression test.
Vytautas Astrauskas [Mon, 28 May 2018 13:21:47 +0000 (15:21 +0200)]
Fix NLL issue 50716 and add a regression test.

6 years ago[fuchsia] Update zx_cprng_draw to target semantics
Adam Barth [Wed, 27 Jun 2018 15:56:19 +0000 (08:56 -0700)]
[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.

6 years agoAuto merge of #51356 - Zoxc:encode-cleanup, r=michaelwoerister
bors [Wed, 27 Jun 2018 14:25:52 +0000 (14:25 +0000)]
Auto merge of #51356 - Zoxc:encode-cleanup, r=michaelwoerister

Make opaque::Encoder append-only and make it infallible

6 years agomove into `provide` methods
Niko Matsakis [Wed, 27 Jun 2018 13:42:00 +0000 (09:42 -0400)]
move into `provide` methods

6 years agorename to `shrink_to_tcx_lifetime`
Niko Matsakis [Wed, 27 Jun 2018 13:27:07 +0000 (09:27 -0400)]
rename to `shrink_to_tcx_lifetime`

6 years agoDocument that Layout::from_size_align does not allow align=0
Simon Sapin [Wed, 27 Jun 2018 13:04:49 +0000 (15:04 +0200)]
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.

6 years agoextend comment to note complications around lifetimes
Niko Matsakis [Wed, 27 Jun 2018 12:55:41 +0000 (08:55 -0400)]
extend comment to note complications around lifetimes

6 years agosyntax_pos: Store multibyte char size as u8 instead of u32.
Michael Woerister [Tue, 26 Jun 2018 13:37:09 +0000 (15:37 +0200)]
syntax_pos: Store multibyte char size as u8 instead of u32.

6 years agoAdd comments to analzye_filemap().
Michael Woerister [Fri, 1 Jun 2018 10:54:15 +0000 (12:54 +0200)]
Add comments to analzye_filemap().

6 years agoAdd SSE2 accelerated version of FileMap analysis.
Michael Woerister [Tue, 29 May 2018 15:50:13 +0000 (17:50 +0200)]
Add SSE2 accelerated version of FileMap analysis.

6 years agoUse u32 instead of usize of encoding byte count of multi-byte chars.
Michael Woerister [Tue, 29 May 2018 15:49:35 +0000 (17:49 +0200)]
Use u32 instead of usize of encoding byte count of multi-byte chars.

6 years agoUpdate CodeMap tests after changing FileMap construction.
Michael Woerister [Thu, 24 May 2018 09:30:30 +0000 (11:30 +0200)]
Update CodeMap tests after changing FileMap construction.

6 years agoRemove the now redundant CodeMap::new_filemap_with_lines() method.
Michael Woerister [Wed, 23 May 2018 14:19:20 +0000 (16:19 +0200)]
Remove the now redundant CodeMap::new_filemap_with_lines() method.

6 years agoMake FileMap::{lines, multibyte_chars, non_narrow_chars} non-mutable.
Michael Woerister [Wed, 23 May 2018 13:59:42 +0000 (15:59 +0200)]
Make FileMap::{lines, multibyte_chars, non_narrow_chars} non-mutable.

6 years agopacify the mercilous tidy
Niko Matsakis [Wed, 27 Jun 2018 11:28:25 +0000 (07:28 -0400)]
pacify the mercilous tidy

6 years agoimprove comments on `dropck_outlives`
Niko Matsakis [Wed, 27 Jun 2018 11:26:29 +0000 (07:26 -0400)]
improve comments on `dropck_outlives`

6 years agoAuto merge of #51496 - petrochenkov:mhelper2, r=nikomatsakis
bors [Wed, 27 Jun 2018 11:20:16 +0000 (11:20 +0000)]
Auto merge of #51496 - petrochenkov:mhelper2, r=nikomatsakis

Implement `#[macro_export(local_inner_macros)]` (a solution for the macro helper import problem)

Implement a solution for the macro helper issue discussed in https://github.com/rust-lang/rust/issues/35896 as described in https://github.com/rust-lang/rust/issues/35896#issuecomment-395977901.

Macros exported from libraries can be marked with `#[macro_export(local_inner_macros)]` and this annotation changes how nested macros in them are resolved.

If we have a fn-like macro call `ident!(...)` and `ident` comes from a `macro_rules!` macro marked with  `#[macro_export(local_inner_macros)]` then it's replaced with `$crate::ident!(...)` and resolved as such (`$crate` gets the same context as `ident`).

6 years agoimprove comment on instantiate NLL query result fn
Niko Matsakis [Wed, 27 Jun 2018 11:19:17 +0000 (07:19 -0400)]
improve comment on instantiate NLL query result fn

6 years agoremove `either` dependency we are not using
Niko Matsakis [Wed, 27 Jun 2018 11:05:40 +0000 (07:05 -0400)]
remove `either` dependency we are not using

6 years agorename `upcast` to `cast_to_tcx_lifetime` and improve comment
Niko Matsakis [Wed, 27 Jun 2018 11:02:37 +0000 (07:02 -0400)]
rename `upcast` to `cast_to_tcx_lifetime` and improve comment

6 years agofix wrong query description
Niko Matsakis [Wed, 27 Jun 2018 10:57:20 +0000 (06:57 -0400)]
fix wrong query description

6 years agomerge all the `type_op_foo` modules into one as they are so trivial
Niko Matsakis [Wed, 27 Jun 2018 10:53:23 +0000 (06:53 -0400)]
merge all the `type_op_foo` modules into one as they are so trivial

6 years agouse query boiler plate for `normalize_projection_ty` too
Niko Matsakis [Wed, 27 Jun 2018 10:47:55 +0000 (06:47 -0400)]
use query boiler plate for `normalize_projection_ty` too

6 years agouse query boilerplate for prove-predicate -- slightly inefficient
Niko Matsakis [Wed, 27 Jun 2018 10:49:05 +0000 (06:49 -0400)]
use query boilerplate for prove-predicate -- slightly inefficient

This requires us to allocate a single entry vector we didn't use to
allocate. I doubt this makes a difference in practice, as this only
occurs for cache misses.

6 years agouse query boilerplate for subtype
Niko Matsakis [Wed, 27 Jun 2018 10:48:52 +0000 (06:48 -0400)]
use query boilerplate for subtype

6 years agouse query boilerplate for `normalize`
Niko Matsakis [Wed, 27 Jun 2018 10:48:43 +0000 (06:48 -0400)]
use query boilerplate for `normalize`

6 years agoextract out query boilerplate and use for `Eq`
Niko Matsakis [Wed, 27 Jun 2018 10:48:32 +0000 (06:48 -0400)]
extract out query boilerplate and use for `Eq`

6 years agoImplement `#[macro_export(local_inner_macros)]`
Vadim Petrochenkov [Mon, 11 Jun 2018 11:21:36 +0000 (14:21 +0300)]
Implement `#[macro_export(local_inner_macros)]`

6 years agonit: don't import Debug directly
Niko Matsakis [Wed, 27 Jun 2018 10:01:19 +0000 (06:01 -0400)]
nit: don't import Debug directly

6 years agoMake opaque::Encoder append-only and make it infallible
John Kåre Alsaker [Mon, 4 Jun 2018 20:14:02 +0000 (22:14 +0200)]
Make opaque::Encoder append-only and make it infallible

6 years agoAuto merge of #51835 - tmccombs:stable-int-to-from-bytes, r=joshtriplett
bors [Wed, 27 Jun 2018 09:21:34 +0000 (09:21 +0000)]
Auto merge of #51835 - tmccombs:stable-int-to-from-bytes, r=joshtriplett

Stabilize to_bytes and from_bytes for integers.

Fixes #49792

6 years agoAuto merge of #51815 - oli-obk:lowering_cleanups2, r=nikomatsakis
bors [Wed, 27 Jun 2018 07:16:13 +0000 (07:16 +0000)]
Auto merge of #51815 - oli-obk:lowering_cleanups2, r=nikomatsakis

Lowering cleanups [2/N]

Double indirections are unnecessary

6 years agoOptimize RefCell refcount tracking
Joshua Liebow-Feeser [Wed, 27 Jun 2018 07:07:18 +0000 (00:07 -0700)]
Optimize RefCell refcount tracking

6 years agoStabilize to_bytes and from_bytes for integers.
Thayne McCombs [Wed, 27 Jun 2018 05:17:56 +0000 (23:17 -0600)]
Stabilize to_bytes and from_bytes for integers.

Fixes #49792

6 years agoFix the error reference for LocalKey::try_with
Michal 'vorner' Vaner [Tue, 26 Jun 2018 20:58:25 +0000 (22:58 +0200)]
Fix the error reference for LocalKey::try_with

6 years agoAuto merge of #51598 - Pazzaz:master, r=sfackler
bors [Wed, 27 Jun 2018 04:02:05 +0000 (04:02 +0000)]
Auto merge of #51598 - Pazzaz:master, r=sfackler

Optimize sum of Durations by using custom function

The current `impl Sum for Duration` uses `fold` to perform several `add`s (or really `checked_add`s) of durations. In doing so, it has to guarantee the number of nanoseconds is valid after every addition. If you squeese the current implementation into a single function it looks kind of like this:
````rust
fn sum<I: Iterator<Item = Duration>>(iter: I) -> Duration {
    let mut sum = Duration::new(0, 0);
    for rhs in iter {
        if let Some(mut secs) = sum.secs.checked_add(rhs.secs) {
            let mut nanos = sum.nanos + rhs.nanos;
            if nanos >= NANOS_PER_SEC {
                nanos -= NANOS_PER_SEC;
                if let Some(new_secs) = secs.checked_add(1) {
                    secs = new_secs;
                } else {
                    panic!("overflow when adding durations");
                }
            }
            sum = Duration { secs, nanos }
        } else {
            panic!("overflow when adding durations");
        }
    }
    sum
}
````
We only need to check if `nanos` is in the correct range when giving our final answer so we can have a more optimized version like so:
````rust
fn sum<I: Iterator<Item = Duration>>(iter: I) -> Duration {
    let mut total_secs: u64 = 0;
    let mut total_nanos: u64 = 0;

    for entry in iter {
        total_secs = total_secs
            .checked_add(entry.secs)
            .expect("overflow in iter::sum over durations");
        total_nanos = match total_nanos.checked_add(entry.nanos as u64) {
            Some(n) => n,
            None => {
                total_secs = total_secs
                    .checked_add(total_nanos / NANOS_PER_SEC as u64)
                    .expect("overflow in iter::sum over durations");
                (total_nanos % NANOS_PER_SEC as u64) + entry.nanos as u64
            }
        };
    }
    total_secs = total_secs
        .checked_add(total_nanos / NANOS_PER_SEC as u64)
        .expect("overflow in iter::sum over durations");
    total_nanos = total_nanos % NANOS_PER_SEC as u64;
    Duration {
        secs: total_secs,
        nanos: total_nanos as u32,
    }
}
````
We now only convert `total_nanos` to `total_secs` (1) if `total_nanos` overflows and (2) at the end of the function when we have to output a valid `Duration`. This gave a 5-22% performance improvement when I benchmarked it, depending on how big the `nano` value of the `Duration`s in `iter` were.

6 years agoAuto merge of #51773 - oli-obk:cleanup_impl_trait, r=nikomatsakis
bors [Wed, 27 Jun 2018 01:49:56 +0000 (01:49 +0000)]
Auto merge of #51773 - oli-obk:cleanup_impl_trait, r=nikomatsakis

Don't inspect the generated existential type items

r? @nikomatsakis

My debugging led me to the `hir::ItemExistential(..)` checks, which are entirely unnecessary because we never use the items directly. The issue was that items were iterated over in a random order (due to hashmaps), so if you checked the `ItemExistential` before the function that has the actual return `impl Trait`, you'd run into those ICEs you encountered.

6 years agoadd edition compiletest header + fix tests
mark [Tue, 26 Jun 2018 03:04:08 +0000 (22:04 -0500)]
add edition compiletest header + fix tests

6 years agolower case some feature gate messages
mark [Tue, 26 Jun 2018 02:29:13 +0000 (21:29 -0500)]
lower case some feature gate messages

6 years agoAuto merge of #51149 - zackmdavis:․․․_to_․․=, r=nikomatsakis
bors [Tue, 26 Jun 2018 23:15:30 +0000 (23:15 +0000)]
Auto merge of #51149 - zackmdavis:․․․_to_․․=, r=nikomatsakis

lint to favor `..=` over `...` range patterns; migrate to `..=` throughout codebase

We probably need an RFC to actually deprecate the `...` syntax, but here's a candidate implementation for the lint considered in #51043. (My local build is super flaky, but hopefully I got all of the test revisions.)

6 years agoAuto merge of #51814 - MajorBreakfast:local-task-obj, r=cramertj
bors [Tue, 26 Jun 2018 21:09:52 +0000 (21:09 +0000)]
Auto merge of #51814 - MajorBreakfast:local-task-obj, r=cramertj

Add `LocalTaskObj` to `core::task`

- Splits `libcore/task.rs` into submodules
- Adds `LocalTaskObj` and `SpawnLocalObjError` (-> [Commit for this](https://github.com/rust-lang/rust/commit/433e6b31a75eea5ce45493acc63eae462d740338))

Note: To make reviewing easy, both actions have their own commit

r? @cramertj

6 years agoMove spawn errors into executor.rs
Josef Reinhard Brandl [Tue, 26 Jun 2018 19:13:36 +0000 (21:13 +0200)]
Move spawn errors into executor.rs

6 years agoNested `LocalTaskObj` in `TaskObj`, remove `SpawnErrorObj` conversions
Josef Reinhard Brandl [Tue, 26 Jun 2018 19:06:20 +0000 (21:06 +0200)]
Nested `LocalTaskObj` in `TaskObj`, remove `SpawnErrorObj` conversions

6 years agoAuto merge of #51756 - nielx:fix/librustdoc, r=GuillaumeGomez
bors [Tue, 26 Jun 2018 18:55:09 +0000 (18:55 +0000)]
Auto merge of #51756 - nielx:fix/librustdoc, r=GuillaumeGomez

Haiku: set stack size to 16 MB on Haiku, use 32 MB on other platforms

The maximum stack size on Haiku is set to 16 MB (see [the Haiku source](https://git.haiku-os.org/haiku/tree/headers/private/system/thread_defs.h#n17)). With this change rustdoc will also work on Haiku.

6 years agodo not re-create the `LocationTable` for every path
Niko Matsakis [Tue, 26 Jun 2018 11:12:51 +0000 (07:12 -0400)]
do not re-create the `LocationTable` for every path

:facepalm:

6 years agoconvert query-type-op to create query-region-constraint directly
Niko Matsakis [Tue, 19 Jun 2018 22:32:43 +0000 (18:32 -0400)]
convert query-type-op to create query-region-constraint directly

6 years agoadd a streamlined `instantiate_query_result` method for NLL queries
Niko Matsakis [Tue, 19 Jun 2018 14:01:08 +0000 (10:01 -0400)]
add a streamlined `instantiate_query_result` method for NLL queries

6 years agoconvert `dropck_outlives` type-op to use the query
Niko Matsakis [Tue, 19 Jun 2018 21:25:32 +0000 (17:25 -0400)]
convert `dropck_outlives` type-op to use the query

6 years agointroduce `QueryKey` separation
Niko Matsakis [Tue, 19 Jun 2018 19:00:55 +0000 (15:00 -0400)]
introduce `QueryKey` separation

6 years agoextract more helpers from instantiating query result
Niko Matsakis [Tue, 19 Jun 2018 09:08:24 +0000 (05:08 -0400)]
extract more helpers from instantiating query result

6 years agoWIP fix error messages for propagate_approximated_shorter_to_static_no_bound
Niko Matsakis [Wed, 20 Jun 2018 20:04:34 +0000 (16:04 -0400)]
WIP fix error messages for propagate_approximated_shorter_to_static_no_bound