]> git.lizzy.rs Git - rust.git/log
rust.git
5 years agoAuto merge of #55113 - mockersf:master, r=estebank
bors [Tue, 23 Oct 2018 08:17:18 +0000 (08:17 +0000)]
Auto merge of #55113 - mockersf:master, r=estebank

#45829 when a renamed import conflict with a previous import

Fix the suggestion when a renamed import conflict.

It check if the snipped contains `" as "`, and if so uses everything before for the suggestion.

5 years agoAuto merge of #54778 - scottmcm:stabilize-ihle, r=pnkfelix
bors [Tue, 23 Oct 2018 04:05:50 +0000 (04:05 +0000)]
Auto merge of #54778 - scottmcm:stabilize-ihle, r=pnkfelix

Stabilize impl_header_lifetime_elision in 2015

~~This is currently blocked on https://github.com/rust-lang/rust/issues/54902; it should be good after that~~

It's already stable in 2018; this finishes the stabilization.

FCP completed (https://github.com/rust-lang/rust/issues/15872#issuecomment-417953153), proposal (https://github.com/rust-lang/rust/issues/15872#issuecomment-412759783).

Tracking issue: https://github.com/rust-lang/rust/issues/15872
Usage examples (from libcore): https://github.com/rust-lang/rust/pull/54687

5 years agoAuto merge of #55231 - zackmdavis:determinate, r=oli-obk
bors [Tue, 23 Oct 2018 01:24:26 +0000 (01:24 +0000)]
Auto merge of #55231 - zackmdavis:determinate, r=oli-obk

pick a reference issue for absolute-paths future incompatibility info

It would be kind of embarrassing to ship with the "issue TBD" message!

5 years agobetter dummy span detection and remove redundant branch
François Mockers [Mon, 22 Oct 2018 07:08:09 +0000 (09:08 +0200)]
better dummy span detection and remove redundant branch

5 years agoAuto merge of #55224 - kryptan:master, r=matthewjasper
bors [Mon, 22 Oct 2018 03:41:28 +0000 (03:41 +0000)]
Auto merge of #55224 - kryptan:master, r=matthewjasper

Use a keyword in raw identifier example

That's a very small documentation fix. The text says "you can now use keywords as identifiers" but example didn't use a keyword and would work without raw identifiers.

5 years agoAuto merge of #55126 - GuillaumeGomez:improve-search-tabs, r=QuietMisdreavus
bors [Mon, 22 Oct 2018 01:04:52 +0000 (01:04 +0000)]
Auto merge of #55126 - GuillaumeGomez:improve-search-tabs, r=QuietMisdreavus

improve search tabs look

Fixes #55056.

![screenshot from 2018-10-16 19-06-48](https://user-images.githubusercontent.com/3050060/47034247-1e08b280-d177-11e8-9c1e-c7320af9b561.png)

![screenshot from 2018-10-16 19-09-39](https://user-images.githubusercontent.com/3050060/47034255-2365fd00-d177-11e8-8686-4765d3e56ff5.png)

With this, I think it'll be more obvious.

cc @memoryruins

r? @QuietMisdreavus

5 years agoAuto merge of #55179 - bjorn3:miri_public_op_field, r=RalfJung
bors [Sun, 21 Oct 2018 20:07:34 +0000 (20:07 +0000)]
Auto merge of #55179 - bjorn3:miri_public_op_field, r=RalfJung

Give OpTy access to locals for priroda

r? @oli-obk

5 years agoAuto merge of #55236 - petrochenkov:pfail, r=davidtwco
bors [Sun, 21 Oct 2018 17:26:16 +0000 (17:26 +0000)]
Auto merge of #55236 - petrochenkov:pfail, r=davidtwco

Move parse-fail tests to UI

cc https://github.com/rust-lang/rust/issues/53353

r? @davidtwco

5 years agoimprove search tabs look
Guillaume Gomez [Tue, 16 Oct 2018 17:07:41 +0000 (19:07 +0200)]
improve search tabs look

5 years agoAuto merge of #52984 - fabric-and-ink:remove-canonical-var, r=scalexm
bors [Sun, 21 Oct 2018 14:42:35 +0000 (14:42 +0000)]
Auto merge of #52984 - fabric-and-ink:remove-canonical-var, r=scalexm

Replace CanonicalVar with DebruijnIndex

Close #49887

5 years agoAddress review comments
bjorn3 [Sun, 21 Oct 2018 14:16:23 +0000 (16:16 +0200)]
Address review comments

5 years agoRename read_local_of_frame to access_local
bjorn3 [Sat, 20 Oct 2018 12:39:23 +0000 (14:39 +0200)]
Rename read_local_of_frame to access_local

5 years agoRename alloc_map_ref to alloc_map
bjorn3 [Sat, 20 Oct 2018 11:42:25 +0000 (13:42 +0200)]
Rename alloc_map_ref to alloc_map

5 years agoAdd alloc_map accessor
bjorn3 [Sat, 20 Oct 2018 09:09:44 +0000 (11:09 +0200)]
Add alloc_map accessor

5 years agoUse `read_local_of_frame` in `eval_place_to_op`
bjorn3 [Sat, 20 Oct 2018 09:02:39 +0000 (11:02 +0200)]
Use `read_local_of_frame` in `eval_place_to_op`

Also make `layout_of_local` accept any `Frame`

5 years agoFix errors
bjorn3 [Fri, 19 Oct 2018 12:23:20 +0000 (14:23 +0200)]
Fix errors

5 years agoAdd method to get OpTy for local from arbitrary frame
bjorn3 [Fri, 19 Oct 2018 12:12:42 +0000 (14:12 +0200)]
Add method to get OpTy for local from arbitrary frame

5 years agoMake OpTy field op public for priroda
bjorn3 [Thu, 18 Oct 2018 12:17:01 +0000 (14:17 +0200)]
Make OpTy field op public for priroda

5 years agoAuto merge of #55069 - matthewjasper:explain-free-region-liveness, r=nikomatsakis
bors [Sun, 21 Oct 2018 12:04:25 +0000 (12:04 +0000)]
Auto merge of #55069 - matthewjasper:explain-free-region-liveness, r=nikomatsakis

[NLL] Use new region infer errors when explaining borrows

Use the new free region infer errors for explaining borrows

This gives at least some explanation for why a borrow is expected to
last for a certain free region. Also:

* Reports E0373: "closure may outlive the current function" with NLL.
* Special cases the case of returning a reference to (or value referencing) a local variable or temporary (E0515).
* Special case assigning a reference to a local variable in a closure to a captured variable. (E0521)

Closes #51026 - `regions-nested-fns-2.rs` isn't changed to that diagnostic, since that would not be the correct error here.
Closes #51169
cc #53882 - The error is (IMO) better now, but it could be better when we trace lifetimes in these error messages.

r? @nikomatsakis cc @pnkfelix

5 years agoUse new region infer errors for explaining borrows
Matthew Jasper [Sun, 14 Oct 2018 14:12:02 +0000 (15:12 +0100)]
Use new region infer errors for explaining borrows

This gives at least some explanation for why a borrow is expected to
last for a certain free region. Also:

* Reports E0373: "closure may outlive the current function" with NLL.
* Special cases the case of returning a reference to (or value
  referencing) a local variable or temporary (E0515).
* Special case assigning a reference to a local variable in a closure
  to a captured variable.

5 years agoFix a few tests with target-specific output
Vadim Petrochenkov [Sun, 21 Oct 2018 00:21:16 +0000 (03:21 +0300)]
Fix a few tests with target-specific output

Enable one fully ignored test

5 years agoMake sure all ui/parse tests have `-Z parse-only`
Vadim Petrochenkov [Sat, 20 Oct 2018 21:38:23 +0000 (00:38 +0300)]
Make sure all ui/parse tests have `-Z parse-only`

Except those testing parsing during macro expansion

5 years agoMake some ui/parser tests compile-pass
Vadim Petrochenkov [Sat, 20 Oct 2018 21:02:06 +0000 (00:02 +0300)]
Make some ui/parser tests compile-pass

5 years agoMove more parsing tests to ui/parser
Vadim Petrochenkov [Sat, 20 Oct 2018 20:53:16 +0000 (23:53 +0300)]
Move more parsing tests to ui/parser

5 years agoRemove the parse-fail test suite
Vadim Petrochenkov [Sat, 20 Oct 2018 20:43:35 +0000 (23:43 +0300)]
Remove the parse-fail test suite

5 years agoMove parse-fail tests to UI
Vadim Petrochenkov [Sat, 20 Oct 2018 20:36:17 +0000 (23:36 +0300)]
Move parse-fail tests to UI

5 years agoAuto merge of #55125 - RalfJung:stacked-borrows, r=oli-obk
bors [Sun, 21 Oct 2018 09:32:25 +0000 (09:32 +0000)]
Auto merge of #55125 - RalfJung:stacked-borrows, r=oli-obk

miri engine: Hooks for basic stacked borrows

r? @oli-obk

5 years agoAuto merge of #54919 - alexcrichton:update-cargo, r=Mark-Simulacrum
bors [Sun, 21 Oct 2018 06:48:10 +0000 (06:48 +0000)]
Auto merge of #54919 - alexcrichton:update-cargo, r=Mark-Simulacrum

Update Cargo, build curl/OpenSSL statically via features

In addition to to updating Cargo's submodule and Cargo's dependencies,
this also updates Cargo's build to build OpenSSL statically into Cargo
as well as libcurl unconditionally. This removes OpenSSL build logic
from the bootstrap code, and otherwise requests that even on OSX we
build curl statically.

5 years agoUpdate Cargo, build curl/OpenSSL statically via features
Alex Crichton [Mon, 8 Oct 2018 17:39:09 +0000 (10:39 -0700)]
Update Cargo, build curl/OpenSSL statically via features

In addition to to updating Cargo's submodule and Cargo's dependencies,
this also updates Cargo's build to build OpenSSL statically into Cargo
as well as libcurl unconditionally. This removes OpenSSL build logic
from the bootstrap code, and otherwise requests that even on OSX we
build curl statically.

5 years agoupdate miri
Ralf Jung [Sat, 20 Oct 2018 23:32:45 +0000 (01:32 +0200)]
update miri

5 years agoAuto merge of #55230 - Manishearth:rollup, r=Manishearth
bors [Sat, 20 Oct 2018 22:23:36 +0000 (22:23 +0000)]
Auto merge of #55230 - Manishearth:rollup, r=Manishearth

Rollup of 5 pull requests

Successful merges:

 - #55156 (Fixed: Multiple errors on single typo in match pattern)
 - #55189 (update books for the next release)
 - #55193 (make asm diagnostic instruction optional)
 - #55203 (Write an initial version of the `program_clauses` callback)
 - #55213 (ignore target folders)

Failed merges:

r? @ghost

5 years agomanage cases with tabs or other whitespaces
François Mockers [Sat, 20 Oct 2018 22:23:29 +0000 (00:23 +0200)]
manage cases with tabs or other whitespaces

5 years agoGive an error number for "borrowed data escapes outside of closure"
Matthew Jasper [Sun, 14 Oct 2018 13:53:10 +0000 (14:53 +0100)]
Give an error number for "borrowed data escapes outside of closure"

5 years agoUse more accurate `ConstraintCategory`s
Matthew Jasper [Sat, 13 Oct 2018 13:23:23 +0000 (14:23 +0100)]
Use more accurate `ConstraintCategory`s

Adds UseAsConst and UseAsStatic to replace Return in consts/statics.
Don't report the arguments to an overloaded operator as CallArguments.
Also don't report "escaping data" in these items.

5 years agoPrefer type annotations and returns in free region errors
Matthew Jasper [Sat, 13 Oct 2018 12:21:04 +0000 (13:21 +0100)]
Prefer type annotations and returns in free region errors

5 years agoRollup merge of #55213 - qmx:tidy-fix, r=tmandry
Manish Goregaokar [Sat, 20 Oct 2018 20:15:52 +0000 (13:15 -0700)]
Rollup merge of #55213 - qmx:tidy-fix, r=tmandry

when you try to edit a crate inside the compiler tree using rls, it
generates it's assets under target/rls, then tidy is trying to validate
line lenghts for C headers, etc

5 years agoRollup merge of #55203 - scalexm:program-clauses, r=nikomatsakis
Manish Goregaokar [Sat, 20 Oct 2018 20:15:48 +0000 (13:15 -0700)]
Rollup merge of #55203 - scalexm:program-clauses, r=nikomatsakis

Sometimes I just return `ty::List::empty()` because I cannot express these \"built-in\" clauses without bound tys support.

r? @nikomatsakis

5 years agoRollup merge of #55189 - steveklabnik:update-books, r=QuietMisdreavus
Manish Goregaokar [Sat, 20 Oct 2018 20:15:45 +0000 (13:15 -0700)]
Rollup merge of #55189 - steveklabnik:update-books, r=QuietMisdreavus

Sending this PR in today so we can see what linkchecker wants overnight; please don't r+ until travis is green!

5 years agoRollup merge of #55073 - alexcrichton:demote-simd, r=nagisa
Manish Goregaokar [Sat, 20 Oct 2018 20:15:39 +0000 (13:15 -0700)]
Rollup merge of #55073 - alexcrichton:demote-simd, r=nagisa

The issue of passing around SIMD types as values between functions has
seen [quite a lot] of [discussion], and although we thought [we fixed
it][quite a lot] it [wasn't]! This PR is a change to rustc to, again,
try to fix this issue.

The fundamental problem here remains the same, if a SIMD vector argument
is passed by-value in LLVM's function type, then if the caller and
callee disagree on target features a miscompile happens. We solve this
by never passing SIMD vectors by-value, but LLVM will still thwart us
with its argument promotion pass to promote by-ref SIMD arguments to
by-val SIMD arguments.

This commit is an attempt to thwart LLVM thwarting us. We, just before
codegen, will take yet another look at the LLVM module and demote any
by-value SIMD arguments we see. This is a very manual attempt by us to
ensure the codegen for a module keeps working, and it unfortunately is
likely producing suboptimal code, even in release mode. The saving grace
for this, in theory, is that if SIMD types are passed by-value across
a boundary in release mode it's pretty unlikely to be performance
sensitive (as it's already doing a load/store, and otherwise
perf-sensitive bits should be inlined).

The implementation here is basically a big wad of C++. It was largely
copied from LLVM's own argument promotion pass, only doing the reverse.
In local testing this...

Closes #50154
Closes #52636
Closes #54583
Closes #55059

[quite a lot]: https://github.com/rust-lang/rust/pull/47743
[discussion]: https://github.com/rust-lang/rust/issues/44367
[wasn't]: https://github.com/rust-lang/rust/issues/50154

5 years agoAuto merge of #55156 - PramodBisht:issue/52717, r=estebank
bors [Sat, 20 Oct 2018 19:45:53 +0000 (19:45 +0000)]
Auto merge of #55156 - PramodBisht:issue/52717, r=estebank

Fixed: Multiple errors on single typo in match pattern

Here we have fixed the case where we were throwing two diagnostic messages `E0026` and `E0027` for same case.

Example
```
error[E0026]: variant `A::A` does not have a field named `fob`
  --> src/test/ui/issue-52717.rs:20:12
   |
20 |     A::A { fob } => { println!("{}", fob); }
   |            ^^^ variant `A::A` does not have this field

error[E0027]: pattern does not mention field `foo`
  --> src/test/ui/issue-52717.rs:20:5
   |
20 |     A::A { fob } => { println!("{}", fob); }
   |     ^^^^^^^^^^^^ missing field `foo`

error: aborting due to 2 previous errors
```

Here above we can see that both `E0026` and `E0027` are depicting
same thing.

So, to fix this issue, we are simply checking if for last element of `inexistent_fields` is there any value lies in `unmentioned_fields` using levenshtein algorithm, if it does then for that case we are simply deleting element from `unmentioned_fields`. More or less, now instead of showing separate message in `E0027` we are giving extra hint on `E0026`

r? @estebank

5 years agopick a reference issue for absolute-paths future incompatibility info
Zack M. Davis [Sat, 20 Oct 2018 18:17:42 +0000 (11:17 -0700)]
pick a reference issue for absolute-paths future incompatibility info

It would be kind of embarrassing to ship with the "issue TBD" message!

5 years agoRename InferTy::CanonicalTy to BoundTy and add DebruijnIndex to variant type
Fabian Drinck [Sat, 20 Oct 2018 17:07:17 +0000 (19:07 +0200)]
Rename InferTy::CanonicalTy to BoundTy and add DebruijnIndex to variant type

5 years agoRename CanonicalVar to BoundTyIndex
Fabian Drinck [Sat, 20 Oct 2018 16:39:29 +0000 (18:39 +0200)]
Rename CanonicalVar to BoundTyIndex

5 years agoAuto merge of #55119 - varkor:unwarned-match-on-never, r=nikomatsakis
bors [Sat, 20 Oct 2018 15:02:26 +0000 (15:02 +0000)]
Auto merge of #55119 - varkor:unwarned-match-on-never, r=nikomatsakis

Allow explicit matches on ! without warning

It's now possible to explicitly match on `!` without an unreachable code warning. This seems desirable as promoting explicitness.

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

5 years agoUse a keyword in raw identifier example
kryptan [Sat, 20 Oct 2018 12:24:38 +0000 (15:24 +0300)]
Use a keyword in raw identifier example

5 years agoupdate books for the next release
Steve Klabnik [Thu, 18 Oct 2018 23:23:45 +0000 (19:23 -0400)]
update books for the next release

5 years agoAuto merge of #55014 - ljedrz:lazyboye_unwraps, r=matthewjasper
bors [Sat, 20 Oct 2018 11:22:48 +0000 (11:22 +0000)]
Auto merge of #55014 - ljedrz:lazyboye_unwraps, r=matthewjasper

Prefer unwrap_or_else to unwrap_or in case of function calls/allocations

The contents of `unwrap_or` are evaluated eagerly, so it's not a good pick in case of function calls and allocations. This PR also changes a few `unwrap_or`s with `unwrap_or_default`.

An added bonus is that in some cases this change also reveals if the object it's called on is an `Option` or a `Result` (based on whether the closure takes an argument).

5 years agoAuto merge of #55114 - oli-obk:fx#map, r=nikomatsakis
bors [Sat, 20 Oct 2018 08:45:55 +0000 (08:45 +0000)]
Auto merge of #55114 - oli-obk:fx#map, r=nikomatsakis

Deprecate the `FxHashMap()` and `FxHashSet()` constructor function hack

5 years ago`impl<'_> IceCube<'_> {}` is now only one error in both editions
Scott McMurray [Sat, 20 Oct 2018 05:57:41 +0000 (22:57 -0700)]
`impl<'_> IceCube<'_> {}` is now only one error in both editions

5 years agoAdd a stub feature so we can still test E0705
Scott McMurray [Tue, 9 Oct 2018 06:31:50 +0000 (23:31 -0700)]
Add a stub feature so we can still test E0705

5 years ago17905 also no longer errors, thanks to IHLE
Scott McMurray [Mon, 8 Oct 2018 08:13:37 +0000 (01:13 -0700)]
17905 also no longer errors, thanks to IHLE

But its test was written in an outdated way that hits a different error despite IHLE, so keep a variant around for that case.

5 years agoMove an underscore-lifetime error test to an IHLE success test
Scott McMurray [Mon, 8 Oct 2018 07:00:58 +0000 (00:00 -0700)]
Move an underscore-lifetime error test to an IHLE success test

5 years agoHooray! 19982 finally works the way people wanted in December 2014 :)
Scott McMurray [Mon, 8 Oct 2018 06:48:51 +0000 (23:48 -0700)]
Hooray! 19982 finally works the way people wanted in December 2014 :)

5 years agoStabilize impl_header_lifetime_elision in 2015
Scott McMurray [Wed, 3 Oct 2018 07:27:12 +0000 (00:27 -0700)]
Stabilize impl_header_lifetime_elision in 2015

It's already stable in 2018; this finishes the stabilization.

5 years agoAuto merge of #55007 - davidtwco:issue-39175, r=petrochenkov
bors [Sat, 20 Oct 2018 01:31:10 +0000 (01:31 +0000)]
Auto merge of #55007 - davidtwco:issue-39175, r=petrochenkov

Help suggests non-existent package std::os::ext::process::CommandExt

Fixes #39175.

5 years agoAuto merge of #55162 - nikomatsakis:issue-54902-underscore-bound, r=tmandry
bors [Fri, 19 Oct 2018 22:54:14 +0000 (22:54 +0000)]
Auto merge of #55162 - nikomatsakis:issue-54902-underscore-bound, r=tmandry

handle underscore bounds in unexpected places

Per the discussion on #54902, I made it a hard error to use lifetime bounds in various places where they used to be permitted:

- `where Foo: Bar<'_>` for example

I also moved error reporting to HIR lowering and added `Error` variants to let us suppress downstream errors that result.

I (imo) improved the error message wording to be clearer, as well.

In the process, I fixed the ICE in #52098.

Fixes #54902
Fixes #52098

5 years agoadd more to the ERROR messages
Niko Matsakis [Fri, 19 Oct 2018 20:43:46 +0000 (16:43 -0400)]
add more to the ERROR messages

5 years agofix error messages
Niko Matsakis [Fri, 19 Oct 2018 20:39:41 +0000 (16:39 -0400)]
fix error messages

5 years agoAuto merge of #55152 - nikomatsakis:nll-issue-54571-type-annot-in-constants, r=pnkfelix
bors [Fri, 19 Oct 2018 20:20:12 +0000 (20:20 +0000)]
Auto merge of #55152 - nikomatsakis:nll-issue-54571-type-annot-in-constants, r=pnkfelix

support type annot in constants, casts

Fixes #54571
Fixes #54332
Fixes #55183

r? @pnkfelix

5 years agoignore target folders
Douglas Campos [Fri, 19 Oct 2018 19:26:43 +0000 (19:26 +0000)]
ignore target folders

when you try to edit a crate inside the compiler tree using rls, it
generates it's assets under target/rls, then tidy is trying to validate
line lenghts for C headers, etc

5 years agoWrite an initial version of the `program_clauses` callback
scalexm [Mon, 8 Oct 2018 19:29:37 +0000 (21:29 +0200)]
Write an initial version of the `program_clauses` callback

5 years agoOnly suggest paths that exist.
David Wood [Fri, 12 Oct 2018 11:47:37 +0000 (13:47 +0200)]
Only suggest paths that exist.

In order to output a path that could actually be imported (valid and
visible), we need to handle re-exports correctly.

For example, take `std::os::unix::process::CommandExt`, this trait is
actually defined at `std::sys::unix::ext::process::CommandExt` (at time
of writing).

`std::os::unix` rexports the contents of `std::sys::unix::ext`.
`std::sys` is private so the "true" path to `CommandExt` isn't accessible.

In this case, the visible parent map will look something like this:

(child) -> (parent)
`std::sys::unix::ext::process::CommandExt` -> `std::sys::unix::ext::process`
`std::sys::unix::ext::process` -> `std::sys::unix::ext`
`std::sys::unix::ext` -> `std::os`

This is correct, as the visible parent of `std::sys::unix::ext` is in fact
`std::os`.

When printing the path to `CommandExt` and looking at the current
segment that corresponds to `std::sys::unix::ext`, we would normally
print `ext` and then go to the parent - resulting in a mangled path like
`std::os::ext::process::CommandExt`.

Instead, we must detect that there was a re-export and instead print `unix`
(which is the name `std::sys::unix::ext` was re-exported as in `std::os`).

5 years agonormalize the self-type that we extract from impl
Niko Matsakis [Thu, 18 Oct 2018 19:48:48 +0000 (15:48 -0400)]
normalize the self-type that we extract from impl

5 years agoeven though we don't need it yet, fix the "fast path" code
Niko Matsakis [Thu, 18 Oct 2018 18:26:45 +0000 (14:26 -0400)]
even though we don't need it yet, fix the "fast path" code

5 years agoadd a test that we enforce '`static` errors post normalization
Niko Matsakis [Thu, 18 Oct 2018 18:26:33 +0000 (14:26 -0400)]
add a test that we enforce '`static` errors post normalization

5 years agoadd useful debug log
Niko Matsakis [Thu, 18 Oct 2018 18:16:13 +0000 (14:16 -0400)]
add useful debug log

5 years agoregion_infer/mod.rs: rustfmt
Niko Matsakis [Thu, 18 Oct 2018 14:44:33 +0000 (10:44 -0400)]
region_infer/mod.rs: rustfmt

5 years agopacify the mercilous tidy
Niko Matsakis [Thu, 18 Oct 2018 00:09:52 +0000 (20:09 -0400)]
pacify the mercilous tidy

5 years agoskip user-type annotations if they don't have regions
Niko Matsakis [Wed, 17 Oct 2018 22:23:43 +0000 (18:23 -0400)]
skip user-type annotations if they don't have regions

5 years agolowering casts in constants now creates multiple uses
Niko Matsakis [Thu, 18 Oct 2018 09:58:20 +0000 (05:58 -0400)]
lowering casts in constants now creates multiple uses

This can trigger more errors than before. Not sure what is the best
fix here.

5 years agopacify the mercilous tidy
Niko Matsakis [Wed, 17 Oct 2018 20:40:43 +0000 (16:40 -0400)]
pacify the mercilous tidy

5 years agosave the user-provided type immediately upon return from astconv
Niko Matsakis [Wed, 17 Oct 2018 20:20:54 +0000 (16:20 -0400)]
save the user-provided type immediately upon return from astconv

5 years agocreate type ascription for any cast
Niko Matsakis [Wed, 17 Oct 2018 20:18:24 +0000 (16:18 -0400)]
create type ascription for any cast

Also, avoid shadowing of the `ty` variable by giving the `cast_ty` and
`var_ty` variables different names.  We want to get the user-provided
type from `cast_ty.hir_id`.

5 years agoWrap cast expressions inside of ValueTypeAscription
Keith Yeung [Tue, 2 Oct 2018 16:31:46 +0000 (09:31 -0700)]
Wrap cast expressions inside of ValueTypeAscription

5 years agosuppress duplicate -- or near duplicate -- type test errors
Niko Matsakis [Thu, 18 Oct 2018 13:00:11 +0000 (09:00 -0400)]
suppress duplicate -- or near duplicate -- type test errors

5 years agonormalize and prove predicates
Niko Matsakis [Wed, 17 Oct 2018 15:10:08 +0000 (11:10 -0400)]
normalize and prove predicates

Also include a test that was not working previously.

5 years agonormalize after substitution
Niko Matsakis [Wed, 17 Oct 2018 16:31:44 +0000 (12:31 -0400)]
normalize after substitution

5 years agopull `relate_type_and_user_type` code into `type_check` module
Niko Matsakis [Wed, 17 Oct 2018 18:55:42 +0000 (14:55 -0400)]
pull `relate_type_and_user_type` code into `type_check` module

It's really layered atop the core "relate-types" code

5 years agoUpdate unit tests
Oliver Scherer [Wed, 17 Oct 2018 11:51:47 +0000 (13:51 +0200)]
Update unit tests

5 years agoUpdate TypedArena tests
Oliver Scherer [Wed, 17 Oct 2018 07:11:55 +0000 (09:11 +0200)]
Update TypedArena tests

5 years agoUpdate more internals tests to `default`
Oliver Scherer [Tue, 16 Oct 2018 20:06:19 +0000 (22:06 +0200)]
Update more internals tests to `default`

5 years agoFree some memory instead of just dropping elements
Oliver Scherer [Tue, 16 Oct 2018 17:59:44 +0000 (19:59 +0200)]
Free some memory instead of just dropping elements

5 years agoUpdate a compiler-test to the `Default` changes
Oliver Scherer [Tue, 16 Oct 2018 17:51:12 +0000 (19:51 +0200)]
Update a compiler-test to the `Default` changes

5 years agoRemove unused box
Oliver Scherer [Tue, 16 Oct 2018 15:21:55 +0000 (17:21 +0200)]
Remove unused box

5 years agoDerives often have very strict bounds
Oliver Scherer [Tue, 16 Oct 2018 15:19:25 +0000 (17:19 +0200)]
Derives often have very strict bounds

5 years agoPrefer `Default::default` over `FxHash*::default` in struct constructors
Oliver Scherer [Tue, 16 Oct 2018 14:57:53 +0000 (16:57 +0200)]
Prefer `Default::default` over `FxHash*::default` in struct constructors

5 years agoDeprecate the `FxHashMap()` and `FxHashSet()` constructor function hack
Oliver Scherer [Tue, 16 Oct 2018 08:44:26 +0000 (10:44 +0200)]
Deprecate the `FxHashMap()` and `FxHashSet()` constructor function hack

5 years agotype_check/mod.rs: rustfmt
Niko Matsakis [Wed, 17 Oct 2018 16:15:56 +0000 (12:15 -0400)]
type_check/mod.rs: rustfmt

5 years agoreplace `UserTypeAnnotation::AdtDef` with `TypeOf`
Niko Matsakis [Wed, 17 Oct 2018 15:48:41 +0000 (11:48 -0400)]
replace `UserTypeAnnotation::AdtDef` with `TypeOf`

5 years agopropagate user-type annotation for constants in expressions
Niko Matsakis [Wed, 17 Oct 2018 14:14:29 +0000 (10:14 -0400)]
propagate user-type annotation for constants in expressions

5 years agoconvert `FnDef` to `TypeOf`, which is more general
Niko Matsakis [Wed, 17 Oct 2018 13:58:52 +0000 (09:58 -0400)]
convert `FnDef` to `TypeOf`, which is more general

5 years agoremove outdated assertion
Niko Matsakis [Wed, 17 Oct 2018 16:32:00 +0000 (12:32 -0400)]
remove outdated assertion

This dates from the days before we instantiated user types with
inference variables.

5 years agoFixed: Multiple errors on single typo in match pattern
Pramod Bisht [Fri, 19 Oct 2018 10:33:49 +0000 (10:33 +0000)]
Fixed: Multiple errors on single typo in match pattern

Here we have fixed the case where we were throwing two diagnostic
messages `E0026` and `E0027` for same case like this

Example
error[E0026]: variant `A::A` does not have a field named `fob`
  --> src/test/ui/issue-52717.rs:20:12
   |
20 |     A::A { fob } => { println!("{}", fob); }
   |            ^^^ variant `A::A` does not have this field

error[E0027]: pattern does not mention field `foo`
  --> src/test/ui/issue-52717.rs:20:5
   |
20 |     A::A { fob } => { println!("{}", fob); }
   |     ^^^^^^^^^^^^ missing field `foo`

error: aborting due to 2 previous errors

Here above we can see that both `E0026` and `E0027` are depicting
same thing.

So, to fix this issue, we are simply checking element of
`inexistent_fields` is there any value lies in
`unmentioned_fields` using Levenshtein algorithm, if does
then for that case we are simply deleting element from
`unmentioned_fields`. More or less now instead of showing
separate message in `E0027` we are giving extra hint on `E0026`

Address: #52717

5 years agorustc: Fix (again) simd vectors by-val in ABI
Alex Crichton [Sun, 14 Oct 2018 19:27:22 +0000 (12:27 -0700)]
rustc: Fix (again) simd vectors by-val in ABI

The issue of passing around SIMD types as values between functions has
seen [quite a lot] of [discussion], and although we thought [we fixed
it][quite a lot] it [wasn't]! This PR is a change to rustc to, again,
try to fix this issue.

The fundamental problem here remains the same, if a SIMD vector argument
is passed by-value in LLVM's function type, then if the caller and
callee disagree on target features a miscompile happens. We solve this
by never passing SIMD vectors by-value, but LLVM will still thwart us
with its argument promotion pass to promote by-ref SIMD arguments to
by-val SIMD arguments.

This commit is an attempt to thwart LLVM thwarting us. We, just before
codegen, will take yet another look at the LLVM module and demote any
by-value SIMD arguments we see. This is a very manual attempt by us to
ensure the codegen for a module keeps working, and it unfortunately is
likely producing suboptimal code, even in release mode. The saving grace
for this, in theory, is that if SIMD types are passed by-value across
a boundary in release mode it's pretty unlikely to be performance
sensitive (as it's already doing a load/store, and otherwise
perf-sensitive bits should be inlined).

The implementation here is basically a big wad of C++. It was largely
copied from LLVM's own argument promotion pass, only doing the reverse.
In local testing this...

Closes #50154
Closes #52636
Closes #54583
Closes #55059

[quite a lot]: https://github.com/rust-lang/rust/pull/47743
[discussion]: https://github.com/rust-lang/rust/issues/44367
[wasn't]: https://github.com/rust-lang/rust/issues/50154

5 years agoAuto merge of #55194 - kennytm:rollup, r=kennytm
bors [Fri, 19 Oct 2018 09:29:48 +0000 (09:29 +0000)]
Auto merge of #55194 - kennytm:rollup, r=kennytm

Rollup of 7 pull requests

Successful merges:

 - #54300 (Updated RELEASES.md for 1.30.0)
 - #55013 ([NLL] Propagate bounds from generators)
 - #55071 (Fix ICE and report a human readable error)
 - #55144 (Cleanup resolve)
 - #55166 (Don't warn about parentheses on `match (return)`)
 - #55169 (Add a `copysign` function to f32 and f64)
 - #55178 (Stabilize slice::chunks_exact(), chunks_exact_mut(), rchunks(), rchunks_mut(), rchunks_exact(), rchunks_exact_mut())

5 years agoRollup merge of #55013 - matthewjasper:propagate-generator-bounds, r=nikomatsakis
kennytm [Fri, 19 Oct 2018 08:48:36 +0000 (16:48 +0800)]
Rollup merge of #55013 - matthewjasper:propagate-generator-bounds, r=nikomatsakis

[NLL] Propagate bounds from generators

This used to only be done for closures.

5 years agoRollup merge of #55178 - sdroege:stabilize-chunks-exact, r=alexcrichton
kennytm [Fri, 19 Oct 2018 03:03:35 +0000 (11:03 +0800)]
Rollup merge of #55178 - sdroege:stabilize-chunks-exact, r=alexcrichton

Stabilize slice::chunks_exact(), chunks_exact_mut(), rchunks(), rchunks_mut(), rchunks_exact(), rchunks_exact_mut()

Fixes #47115, #55177

5 years agoRollup merge of #55169 - raphlinus:copysign, r=joshtriplett
kennytm [Fri, 19 Oct 2018 03:03:34 +0000 (11:03 +0800)]
Rollup merge of #55169 - raphlinus:copysign, r=joshtriplett

Add a `copysign` function to f32 and f64

This patch adds a `copysign` function to the float primitive types. It is an exceptionally useful function for writing efficient numeric code, as it often avoids branches, is auto-vectorizable, and there are efficient intrinsics for most platforms.

I think this might work as-is, as the relevant `copysign` intrinsic is already used internally for the implementation of `signum`. It's possible that an implementation might be needed in japaric/libm for portability across all platforms, in which case I'll do that also.

Part of the work towards #55107

5 years agoRollup merge of #55166 - varkor:ret-parens, r=davidtwco
kennytm [Fri, 19 Oct 2018 03:03:33 +0000 (11:03 +0800)]
Rollup merge of #55166 - varkor:ret-parens, r=davidtwco

Don't warn about parentheses on `match (return)`

Fixes #55164.

5 years agoRollup merge of #55144 - ljedrz:cleanup_resolve, r=petrochenkov
kennytm [Fri, 19 Oct 2018 03:03:32 +0000 (11:03 +0800)]
Rollup merge of #55144 - ljedrz:cleanup_resolve, r=petrochenkov

Cleanup resolve

- improve/remove allocations
- `truncate` instead of `pop`ping in a loop
- improve common patterns