Pietro Albini [Tue, 4 Jun 2019 20:39:41 +0000 (22:39 +0200)]
Rollup merge of #61523 - Nemo157:hide-gen-future, r=cramertj
Hide gen_future API from documentation
This is internal rustc only API which should never be used outside code created by the current `async` transform, if it is used then the panic messages don't make sense as they're written from the perspective of that meaning there is a bug in the `async` transform (e.g. #61482).
Pietro Albini [Tue, 4 Jun 2019 20:39:38 +0000 (22:39 +0200)]
Rollup merge of #61488 - matthewjasper:fix-nll-typeck-ices, r=pnkfelix
Fix NLL typeck ICEs
* Don't ICE when a type containing a region is constrained by nothing
* Don't ICE trying to normalize a type in a `ParamEnv` containing global bounds.
To explain what was happening in the `issue-61311-normalize.rs` case:
* When borrow checking the `the_fn` in the last `impl` we would try to normalize `Self::Proj` (`<Unit as HasProjFn>::Proj`).
* We would find the `impl` that we're checking and and check its `where` clause.
* This would need us to check `<Box<dyn Obj + 'static> as HasProj>::Proj: Bound`
* We find two possible implementations, the blanket impl and the bound in our `ParamEnv`.
* The bound in our `ParamEnv` was canonicalized, so we don't see it as a global bound. As such we prefer it to the `impl`.
* This means that we cannot normalize `<Box<dyn Obj + 'static> as HasProj>::Proj` to `Unit`.
* The `<Box<dyn Obj + 'static> as HasProj>::Proj: Bound` bound, which looks like it should be in our `ParamEnv` has been normalized to `Unit: Bound`.
* We fail to prove `<Box<dyn Obj + 'static> as HasProj>::Proj: Bound`.
* We ICE, since we believe typeck have errored.
bors [Tue, 4 Jun 2019 20:10:54 +0000 (20:10 +0000)]
Auto merge of #61407 - phansch:annotate_snippet_refactoring1, r=oli-obk
Add new diagnostic writer using annotate-snippet library
This adds a new diagnostic writer `AnnotateRsEmitterWriter` that uses
the [`annotate-snippet`][as] library to print out the human readable
diagnostics.
The goal of #59346 is to eventually switch over to using the library instead of
maintaining our own diagnostics output.
This PR does **not** add all the required features to the new
diagnostics writer. It is only meant as a starting point so that other
people can start contributing as well.
There are some FIXMEs in `librustc_errors/annotate_rs_emitter.rs` that
point at yet to be implemented features of the new diagnostic emitter, however
those are most likely not exhaustive.
Philipp Hansch [Fri, 31 May 2019 20:01:27 +0000 (22:01 +0200)]
Add new diagnostic writer using annotate-snippet library
This adds a new diagnostic writer `AnnotateRsEmitterWriter` that uses
the [`annotate-snippet`][as] library to print out the human readable
diagnostics.
The goal is to eventually switch over to using the library instead of
maintaining our own diagnostics output.
This commit does *not* add all the required features to the new
diagnostics writer. It is only meant as a starting point so that other
people can contribute as well.
bors [Tue, 4 Jun 2019 08:31:53 +0000 (08:31 +0000)]
Auto merge of #61136 - matthewjasper:cannot-move-errors, r=pnkfelix
Make cannot move errors more consistent with other borrowck errors
* Note the type of the place being moved in all cases.
* Note the place being moved from.
* Simplify the search for overloaded place operators
* Extend the note for move from overloaded deref apply to all types.
* Add a note for moves from overloaded index.
* Special case moves for closure captures.
bors [Tue, 4 Jun 2019 05:37:44 +0000 (05:37 +0000)]
Auto merge of #61510 - Centril:rollup-bvi95y2, r=Centril
Rollup of 13 pull requests
Successful merges:
- #61135 (Fix documentation of `Rc::make_mut` regarding `rc::Weak`.)
- #61404 (miri unsizing: fix projecting into a field of an operand)
- #61409 (Fix an ICE with a const argument in a trait)
- #61413 (Re-implement async fn drop order lowering )
- #61419 (Add an unusual-conversion example to to_uppercase)
- #61420 (Succinctify splice docs)
- #61444 (Suggest using `as_ref` on `*const T`)
- #61446 (On TerminatorKind::DropAndReplace still handle unused_mut correctly)
- #61485 (azure: retry s3 upload if it fails)
- #61489 (ci: Reenable step timings on AppVeyor)
- #61496 (Do not panic in tidy on unbalanced parentheses in cfg's)
- #61497 (Treat 0 as special value for codegen-units-std)
- #61499 (Add regression test for existential type ICE #53457)
Rollup merge of #61489 - alexcrichton:appveyor-timings, r=pietroalbini
ci: Reenable step timings on AppVeyor
This was accidentally regressed in #60777 by accident, and we've stopped
printing out step timings on AppVeyor recently reducing the ability for
us to track build times over time!
Rollup merge of #61485 - pietroalbini:retry-azure-upload, r=alexcrichton
azure: retry s3 upload if it fails
We had some cases (like [this](https://dev.azure.com/rust-lang/e71b0ddf-dd27-435a-873c-e30f86eea377/_apis/build/builds/370/logs/734) a few hours ago) when uploading to S3 fails with a network error. This retries the upload if it fails.
Rollup merge of #61413 - davidtwco:async-argument-order-in-a-sane-way, r=eddyb
Re-implement async fn drop order lowering
This PR re-implements the async fn drop order lowering changes so
that it all takes place in HIR lowering, building atop the work done by
@eddyb to refactor `Res::Upvar`.
Previously, this types involved in the lowering were constructed in
libsyntax as they had to be used during name resolution and HIR
lowering. This was awful because none of that logic should have existed
in libsyntax.
This commit also changes `ArgSource` to keep a `HirId` to the original
argument pattern rather than a cloned copy of the pattern.
Only b7aa4ed and 71fb8fa should be reviewed, any other commits
are from #61276 (though 447e336 might end up staying in this PR).
As a nice side effect, it also fixes #61187 (cc #61192).
bors [Mon, 3 Jun 2019 22:05:55 +0000 (22:05 +0000)]
Auto merge of #59148 - lcnr:unchecked_maths, r=eddyb
add support for unchecked math
add compiler support for
```rust
/// Returns the result of an unchecked addition, resulting in
/// undefined behavior when `x + y > T::max_value()` or `x + y < T::min_value()`.
pub fn unchecked_add<T>(x: T, y: T) -> T;
/// Returns the result of an unchecked substraction, resulting in
/// undefined behavior when `x - y > T::max_value()` or `x - y < T::min_value()`.
pub fn unchecked_sub<T>(x: T, y: T) -> T;
/// Returns the result of an unchecked multiplication, resulting in
/// undefined behavior when `x * y > T::max_value()` or `x * y < T::min_value()`.
pub fn unchecked_mul<T>(x: T, y: T) -> T;
```
Alex Crichton [Mon, 3 Jun 2019 14:46:08 +0000 (07:46 -0700)]
ci: Reenable step timings on AppVeyor
This was accidentally regressed in #60777 by accident, and we've stopped
printing out step timings on AppVeyor recently reducing the ability for
us to track build times over time!
Matthew Jasper [Sun, 5 May 2019 10:16:56 +0000 (11:16 +0100)]
Improve cannot move errors
* Show the place and type being moved
* Give a special error for variables in match guard
* Simplify search for overloaded deref
* Search for overloaded index
David Wood [Mon, 3 Jun 2019 09:14:27 +0000 (10:14 +0100)]
rustc: construct statement vector directly
This commit simplifies the previous logic to construct the statement
vector directly rather than constructing a `Vec` of
`(hir::Stmt, Option<hir::Stmt>)` first.
David Wood [Sun, 2 Jun 2019 18:59:49 +0000 (19:59 +0100)]
rustc: use lowering helpers
This commit changes the lowering to stop creating HIR statements,
expressions and patterns directly and instead uses the pre-existing
helper functions.
David Wood [Sun, 2 Jun 2019 18:03:17 +0000 (19:03 +0100)]
rustc: remove `HirId` from `ArgSource::AsyncFn`
This commit removes the `HirId` from `ArgSource::AsyncFn`, relying on
the fact that only `simple_ident` is used in each of the locations that
previously took the original pattern from the `ArgSource::AsyncFn`.
David Wood [Wed, 29 May 2019 16:28:51 +0000 (19:28 +0300)]
rustc: async fn drop order lowering in HIR
This commit re-implements the async fn drop order lowering changes so
that it all takes place in HIR lowering, building atop the work done by
`@eddyb` to refactor `Res::Upvar`.
Previously, this types involved in the lowering were constructed in
libsyntax as they had to be used during name resolution and HIR
lowering. This was awful because none of that logic should have existed
in libsyntax.
This commit also changes `ArgSource` to keep a `HirId` to the original
argument pattern rather than a cloned copy of the pattern.
bors [Mon, 3 Jun 2019 08:28:27 +0000 (08:28 +0000)]
Auto merge of #61062 - mark-i-m:mono-mv, r=eddyb,oli-obk
Remove _all_ codegen dependencies on `rustc_mir` :tada:
~This code is pretty self-contained. It has no references to the rest of `rustc_mir`. Moving it to its own crate means that almost all of the references from `rustc_codegen_*` to `rustc_mir` are instead moved to `rustc_monomorphize`, which should help improve compile times for the compiler a bit...~
With the help of eddyb and oli-obk, all of the dependencies of `librustc_codegen_*` on `librustc_mir` have been removed:
- dependencies on `rustc_mir::monomorphize` were moved to `rustc::mir::mono`
- `rustc_mir::const_eval::const_field` is made into a query.
- `rustc_mir::interpret::type_name` is made into a query.
This should help reduce compile time when working on `rustc_mir` :clock1:
bors [Mon, 3 Jun 2019 02:45:35 +0000 (02:45 +0000)]
Auto merge of #61361 - estebank:infer-type, r=varkor
Add more detail to type inference error
When encountering code where type inference fails, add more actionable
information:
```
fn main() {
let foo = Vec::new();
}
```
```
error[E0282]: type annotations needed in `std::vec::Vec<T>`
--> $DIR/vector-no-ann.rs:2:16
|
LL | let foo = Vec::new();
| --- ^^^^^^^^ cannot infer type for `T` in `std::vec::Vec<T>`
| |
| consider giving `foo` a type
```
bors [Mon, 3 Jun 2019 00:02:34 +0000 (00:02 +0000)]
Auto merge of #61008 - GuillaumeGomez:fix-rustdoc-code-highlighting, r=Manishearth
Fix lines highlighting in rustdoc source view
Fixes #60948.
This PR fixes how we handle the lines highlighting from the URL (so in "/doc/src/alloc/string.rs.html#285-283", the "285-283" part). We got a hard limit on 50000, for some unknown and lost reasons which was used in case only one line is selected.
bors [Sun, 2 Jun 2019 14:42:11 +0000 (14:42 +0000)]
Auto merge of #61460 - Centril:rollup-8txhjx4, r=Centril
Rollup of 6 pull requests
Successful merges:
- #61380 (Fix some issues with `unwrap_usize` instead of `assert_usize`)
- #61423 (codegen: change `$6d$` to `$u6d$`)
- #61438 (Point at individual type args on arg count mismatch)
- #61441 (Tweak wording when encountering `fn` call in pattern)
- #61451 (Fix missing semicolon in doc)
- #61458 (Fix typo in AsRef doc)