]> git.lizzy.rs Git - rust.git/log
rust.git
4 years agoAuto merge of #73032 - yoshuawuyts:stabilize-leading_trailing_ones, r=Amanieu
bors [Mon, 29 Jun 2020 00:43:19 +0000 (00:43 +0000)]
Auto merge of #73032 - yoshuawuyts:stabilize-leading_trailing_ones, r=Amanieu

stabilize leading_trailing_ones

This PR stabilizes the `leading_trailing_ones` feature. It's been available on nightly since the start of the year, and hasn't had any issues since. It seems unlikely we'll want to change this, so following up on @djc's suggestion in https://github.com/rust-lang/rust/issues/57969#issuecomment-638405264 I'd like to put forward this PR to stabilize the feature and make it part of `1.46.0`. Thanks!

cc/ @djc @rust-lang/libs

4 years agoAuto merge of #72437 - ecstatic-morse:stabilize-const-if-match, r=oli-obk
bors [Sun, 28 Jun 2020 20:47:52 +0000 (20:47 +0000)]
Auto merge of #72437 - ecstatic-morse:stabilize-const-if-match, r=oli-obk

Stabilize `#![feature(const_if_match)]`

Quoting from the [stabilization report](https://github.com/rust-lang/rust/issues/49146#issuecomment-616301045):

> `if` and `match` expressions as well as the short-circuiting logic operators `&&` and `||` will become legal in all [const contexts](https://doc.rust-lang.org/reference/const_eval.html#const-context). A const context is any of the following:
>
> - The initializer of a `const`, `static`, `static mut` or enum discriminant.
> - The body of a `const fn`.
> - The value of a const generic (nightly only).
> - The length of an array type (`[u8; 3]`) or an array repeat expression (`[0u8; 3]`).
>
> Furthermore, the short-circuiting logic operators will no longer be lowered to their bitwise equivalents (`&` and `|` respectively) in `const` and `static` initializers (see #57175). As a result, `let` bindings can be used alongside short-circuiting logic in those initializers.

Resolves #49146.

Ideally, we would resolve :whale: #66753 before this lands on stable, so it might be worth pushing this back a release. Also, this means we should get the process started for #52000, otherwise people will have no recourse except recursion for iterative `const fn`.

r? @oli-obk

4 years agoUse `LocalDefId` in HIR const-checker
Dylan MacKenzie [Sun, 28 Jun 2020 17:13:04 +0000 (10:13 -0700)]
Use `LocalDefId` in HIR const-checker

4 years agoRemove `ignore-tidy-filelength`
Dylan MacKenzie [Fri, 26 Jun 2020 20:11:24 +0000 (13:11 -0700)]
Remove `ignore-tidy-filelength`

4 years agoUpdate tests
Dylan MacKenzie [Fri, 26 Jun 2020 00:43:48 +0000 (17:43 -0700)]
Update tests

4 years agoStop checking for `while` and `loop` in a const context
Dylan MacKenzie [Fri, 26 Jun 2020 00:41:32 +0000 (17:41 -0700)]
Stop checking for `while` and `loop` in a const context

4 years agoRemove uses of `const_loop` in `rustc`
Dylan MacKenzie [Fri, 26 Jun 2020 00:40:56 +0000 (17:40 -0700)]
Remove uses of `const_loop` in `rustc`

4 years agoMark `const_loop` feature gate as accepted
Dylan MacKenzie [Fri, 26 Jun 2020 00:40:06 +0000 (17:40 -0700)]
Mark `const_loop` feature gate as accepted

4 years agoRequire `allow_internal_unstable` in HIR const-checker
Dylan MacKenzie [Thu, 21 May 2020 21:23:50 +0000 (14:23 -0700)]
Require `allow_internal_unstable` in HIR const-checker

4 years agoRemove `const_if_match` from unstable book
Dylan MacKenzie [Thu, 21 May 2020 20:35:43 +0000 (13:35 -0700)]
Remove `const_if_match` from unstable book

4 years agoUpdate tests
Dylan MacKenzie [Thu, 21 May 2020 19:49:38 +0000 (12:49 -0700)]
Update tests

4 years agoHIR const-checking
Dylan MacKenzie [Thu, 21 May 2020 19:47:09 +0000 (12:47 -0700)]
HIR const-checking

4 years agoMIR const-checking
Dylan MacKenzie [Thu, 21 May 2020 19:46:49 +0000 (12:46 -0700)]
MIR const-checking

4 years agoRemove `const_if_match` feature gate from libraries
Dylan MacKenzie [Thu, 21 May 2020 19:18:32 +0000 (12:18 -0700)]
Remove `const_if_match` feature gate from libraries

4 years agoRemove `control_flow_destroyed` and properly lower `&&` and `||`
Dylan MacKenzie [Thu, 21 May 2020 19:12:46 +0000 (12:12 -0700)]
Remove `control_flow_destroyed` and properly lower `&&` and `||`

4 years agoMark feature gate as accepted
Dylan MacKenzie [Thu, 21 May 2020 18:44:45 +0000 (11:44 -0700)]
Mark feature gate as accepted

4 years agoAuto merge of #73838 - Manishearth:rollup-jj57e84, r=Manishearth
bors [Sun, 28 Jun 2020 16:44:29 +0000 (16:44 +0000)]
Auto merge of #73838 - Manishearth:rollup-jj57e84, r=Manishearth

Rollup of 9 pull requests

Successful merges:

 - #73577 (Add partition_point)
 - #73757 (Const prop: erase all block-only locals at the end of every block)
 - #73774 (Make liveness more precise for assignments to fields)
 - #73795 (Add some `const_compare_raw_pointers`-related regression tests)
 - #73800 (Forward Hash::write_iN to Hash::write_uN)
 - #73813 (Rename two `Resolver` traits)
 - #73817 (Rename clashing_extern_decl to clashing_extern_declarations.)
 - #73826 (Fix docstring typo)
 - #73833 (Remove GlobalCtxt::enter_local)

Failed merges:

r? @ghost

4 years agoRollup merge of #73833 - bjorn3:remove_gcx_enter_local, r=matthewjasper
Manish Goregaokar [Sun, 28 Jun 2020 15:30:36 +0000 (08:30 -0700)]
Rollup merge of #73833 - bjorn3:remove_gcx_enter_local, r=matthewjasper

Remove GlobalCtxt::enter_local

4 years agoRollup merge of #73826 - cjrh:cjrh-patch-1, r=jonas-schievink
Manish Goregaokar [Sun, 28 Jun 2020 15:30:34 +0000 (08:30 -0700)]
Rollup merge of #73826 - cjrh:cjrh-patch-1, r=jonas-schievink

Fix docstring typo

4 years agoRollup merge of #73817 - jumbatm:rename-to-clashing-extern-declarations, r=petrochenkov
Manish Goregaokar [Sun, 28 Jun 2020 15:30:33 +0000 (08:30 -0700)]
Rollup merge of #73817 - jumbatm:rename-to-clashing-extern-declarations, r=petrochenkov

Rename clashing_extern_decl to clashing_extern_declarations.

Rename clashing_extern_decl to clashing_extern_declarations to bring in-line with lint naming conventions.

Fixes #73802.

r? @petrochenkov

4 years agoRollup merge of #73813 - petrochenkov:restrait, r=davidtwco
Manish Goregaokar [Sun, 28 Jun 2020 15:30:31 +0000 (08:30 -0700)]
Rollup merge of #73813 - petrochenkov:restrait, r=davidtwco

Rename two `Resolver` traits

`trait Resolver` -> `trait ResolverExpand` for the resolver interface available from expansion.
`trait Resolver` -> `trait ResolverAstLowering` for the resolver interface available from AST lowering.

Addresses https://github.com/rust-lang/rust/pull/73587#discussion_r443242556

4 years agoRollup merge of #73800 - nikic:hash_i, r=kennytm
Manish Goregaokar [Sun, 28 Jun 2020 15:30:29 +0000 (08:30 -0700)]
Rollup merge of #73800 - nikic:hash_i, r=kennytm

Forward Hash::write_iN to Hash::write_uN

The `Hasher::write_iN()` methods should forward to `Hasher::write_uN()`, because some Hasher implementations implement only the `write_uN()` variants, with the expectation that `write_iN()` will use the same implementation. Most notably, this is the case for the [FxHasher](https://github.com/rust-lang/rustc-hash/blob/5e09ea0a1c7ab7e4f9e27771f5a0e5a36c58d1bb/src/lib.rs#L111) used by rustc itself.

This used to be the case previously, but was broken in #59982. As the PR description makes no mention of this particular change, I assume it was unintentional.

In a local test, this mitigates the regression from #73526 on at least one test-case (cc @cuviper), because we're no longer at the mercy of `FxHasher::write()` getting inlined to get reasonable performance.

4 years agoRollup merge of #73795 - JohnTitor:tests-for-const-fn-ptrs, r=oli-obk
Manish Goregaokar [Sun, 28 Jun 2020 15:30:27 +0000 (08:30 -0700)]
Rollup merge of #73795 - JohnTitor:tests-for-const-fn-ptrs, r=oli-obk

Add some `const_compare_raw_pointers`-related regression tests

Closes #71381
Closes #71382
Closes #71611
Closes #72352

r? @oli-obk, the author of #73398

4 years agoRollup merge of #73774 - ecstatic-morse:liveness-of-projections, r=oli-obk
Manish Goregaokar [Sun, 28 Jun 2020 15:30:25 +0000 (08:30 -0700)]
Rollup merge of #73774 - ecstatic-morse:liveness-of-projections, r=oli-obk

Make liveness more precise for assignments to fields

Previously, we were too conservative and `x.field = 4` was treated as a "use" of `x`. Now it neither kills `x` (since other fields of `x` may still be live) nor marks it as live.

cc @jonas-schievink, who ran into this problem.

4 years agoRollup merge of #73757 - oli-obk:const_prop_hardening, r=wesleywiser
Manish Goregaokar [Sun, 28 Jun 2020 15:30:24 +0000 (08:30 -0700)]
Rollup merge of #73757 - oli-obk:const_prop_hardening, r=wesleywiser

Const prop: erase all block-only locals at the end of every block

I messed up this erasure in https://github.com/rust-lang/rust/pull/73656#discussion_r446040140. I think it is too fragile to have the previous scheme. Let's benchmark the new scheme and see what happens.

r? @wesleywiser

cc @felix91gr

4 years agoRollup merge of #73577 - VillSnow:master, r=Amanieu
Manish Goregaokar [Sun, 28 Jun 2020 15:30:22 +0000 (08:30 -0700)]
Rollup merge of #73577 - VillSnow:master, r=Amanieu

Add partition_point

Add partition_point in C++.
Although existing binary_search in rust does not suitable when the slice has multiple hits,
this function returns exact point of partition.
The definition of this function is very clear and able to accept general matter, therefore you can easily get index which you want like lower/upper_bound.

https://github.com/rust-lang/rfcs/issues/2184

4 years agoUpdate src/libcore/slice/mod.rs
VillSnow [Sun, 28 Jun 2020 12:31:05 +0000 (21:31 +0900)]
Update src/libcore/slice/mod.rs

Co-authored-by: Amanieu d'Antras <amanieu@gmail.com>
4 years agoErase all block-only locals at the end of every block, even if they have not been...
Oliver Scherer [Fri, 26 Jun 2020 09:02:43 +0000 (11:02 +0200)]
Erase all block-only locals at the end of every block, even if they have not been touched.

4 years agoRemove GlobalCtxt::enter_local
bjorn3 [Sun, 28 Jun 2020 09:43:10 +0000 (11:43 +0200)]
Remove GlobalCtxt::enter_local

4 years agoUpdate tracking issue number
VillSnow [Sun, 28 Jun 2020 08:39:03 +0000 (17:39 +0900)]
Update tracking issue number

4 years agoAuto merge of #73830 - Manishearth:rollup-8k68ysm, r=Manishearth
bors [Sun, 28 Jun 2020 08:26:22 +0000 (08:26 +0000)]
Auto merge of #73830 - Manishearth:rollup-8k68ysm, r=Manishearth

Rollup of 10 pull requests

Successful merges:

 - #72796 (MIR sanity check: validate types on assignment)
 - #73243 (Add documentation to point to `File::open` or `OpenOptions::open` instead of `is_file` to check read/write possibility)
 - #73525 (Prepare for LLVM 11)
 - #73672 (Adds a clearer message for when the async keyword is missing from a f…)
 - #73708 (Explain move errors that occur due to method calls involving `self` (take two))
 - #73758 (improper_ctypes: fix remaining `Reveal:All`)
 - #73763 (errors: use `-Z terminal-width` in JSON emitter)
 - #73796 (replace more `DefId`s with `LocalDefId`)
 - #73797 (fix typo in self-profile.md)
 - #73809 (Add links to fs::DirEntry::metadata)

Failed merges:

r? @ghost

4 years agoUpdate doc comment
VillSnow [Sun, 28 Jun 2020 07:45:56 +0000 (16:45 +0900)]
Update doc comment

4 years agoMerge branch 'master' of https://github.com/VillSnow/rust
VillSnow [Sun, 28 Jun 2020 07:27:41 +0000 (16:27 +0900)]
Merge branch 'master' of https://github.com/VillSnow/rust

4 years agoUpdate src/libcore/slice/mod.rs
VillSnow [Sun, 28 Jun 2020 07:26:47 +0000 (16:26 +0900)]
Update src/libcore/slice/mod.rs

Co-authored-by: Lukas Kalbertodt <lukas.kalbertodt@gmail.com>
4 years agoAdd comment on use of unsafe
VillSnow [Sun, 28 Jun 2020 07:25:33 +0000 (16:25 +0900)]
Add comment on use of unsafe

4 years agoRollup merge of #73809 - robyoung:docs/add-links-to-DirEntry-metadata, r=hanna-kruppe
Manish Goregaokar [Sun, 28 Jun 2020 05:30:06 +0000 (22:30 -0700)]
Rollup merge of #73809 - robyoung:docs/add-links-to-DirEntry-metadata, r=hanna-kruppe

Add links to fs::DirEntry::metadata

`fs::DirEntry::metadata` doesn't traverse symlinks. It is not immediately clear what to do if you do want to traverse symlinks. This change adds links to the two other `metadata` functions that will follow symlinks.

4 years agoRollup merge of #73797 - atetubou:patch-1, r=jonas-schievink
Manish Goregaokar [Sun, 28 Jun 2020 05:30:05 +0000 (22:30 -0700)]
Rollup merge of #73797 - atetubou:patch-1, r=jonas-schievink

fix typo in self-profile.md

4 years agoRollup merge of #73796 - lcnr:LocalDefId, r=matthewjasper
Manish Goregaokar [Sun, 28 Jun 2020 05:30:03 +0000 (22:30 -0700)]
Rollup merge of #73796 - lcnr:LocalDefId, r=matthewjasper

replace more `DefId`s with `LocalDefId`

part of https://github.com/rust-lang/rust/issues/70853

4 years agoRollup merge of #73763 - davidtwco:terminal-width-json-emitter, r=estebank
Manish Goregaokar [Sun, 28 Jun 2020 05:30:01 +0000 (22:30 -0700)]
Rollup merge of #73763 - davidtwco:terminal-width-json-emitter, r=estebank

errors: use `-Z terminal-width` in JSON emitter

This PR makes the JSON emitter use `-Z terminal-width` in the "rendered" field of the JSON output.

r? @estebank

4 years agoRollup merge of #73758 - davidtwco:issue-60855-remaining-reveal-all, r=matthewjasper
Manish Goregaokar [Sun, 28 Jun 2020 05:29:59 +0000 (22:29 -0700)]
Rollup merge of #73758 - davidtwco:issue-60855-remaining-reveal-all, r=matthewjasper

improper_ctypes: fix remaining `Reveal:All`

Fixes #60855.

This PR replaces the remaining uses of `ParamEnv::reveal_all` with `LateContext`'s `param_env` (normally `Reveal::UserFacing`) in the improper ctypes lint.

4 years agoRollup merge of #73708 - Aaron1011:feature/reland-move-fn-self-msg, r=davidtwco
Manish Goregaokar [Sun, 28 Jun 2020 05:29:58 +0000 (22:29 -0700)]
Rollup merge of #73708 - Aaron1011:feature/reland-move-fn-self-msg, r=davidtwco

Explain move errors that occur due to method calls involving `self` (take two)

This is a re-attempt of #72389 (which was reverted in #73594)
Instead of using `ExpnKind::Desugaring` to represent operators, this PR
checks the lang item directly.

4 years agoRollup merge of #73672 - nellshamrell:async-fix, r=estebank
Manish Goregaokar [Sun, 28 Jun 2020 05:29:55 +0000 (22:29 -0700)]
Rollup merge of #73672 - nellshamrell:async-fix, r=estebank

Adds a clearer message for when the async keyword is missing from a f…

…unction

This is a somewhat simple fix for #66731.

Under the current version of Rust, if a user has a rust file that looks like this:

```rust
fn boo (){}

async fn foo() {
    boo().await;
}

fn main() {

}
```

And they attempt to run it, they will receive an error message that looks like this:

```bash
error: incorrect use of `await`                                                                                                        --> test.rs:4:14                                                                                                                       |                                                                                                                                   4 |     boo.await();                                                                                                                    |              ^^ help: `await` is not a method call, remove the parentheses                                                                                                                                                                                              error[E0277]: the trait bound `fn() {boo}: std::future::Future` is not satisfied                                                        --> test.rs:4:5                                                                                                                        |                                                                                                                                  4  |     boo.await();                                                                                                                    |     ^^^^^^^^^ the trait `std::future::Future` is not implemented for `fn() {boo}`                                                                                                                                                                                      error: aborting due to 2 previous errors                                                                                                                                                                                                                                    For more information about this error, try `rustc --explain E0277`.
```

This is not very clear.

With the changes made in this PR, when a user compiles and runs that same rust code, they will receive an error message that looks like this:

```bash
error[E0277]: `()` is not a future.
 --> test.rs:4:5
  |
4 |     boo().await;
  |     ^^^^^^^^^^^ `()` is not a future
  |
  = help: the trait `std::future::Future` is not implemented for `()`
  = note: required by `std::future::Future::poll`
```

In the future, I think we should make this error message even clearer, perhaps through a solution like the one described in [this comment](https://github.com/rust-lang/rust/issues/66731#issuecomment-644394287). However, as that potentially involves a major change proposal, I would rather get this change in now and make the error message a little clearer while an MCP is drafted and discussed.

Signed-off-by: Nell Shamrell <nellshamrell@gmail.com>
4 years agoRollup merge of #73525 - cuviper:llvm11, r=nikic
Manish Goregaokar [Sun, 28 Jun 2020 05:29:54 +0000 (22:29 -0700)]
Rollup merge of #73525 - cuviper:llvm11, r=nikic

Prepare for LLVM 11

These are just the code changes needed to build with the current LLVM master (version 11).

r? @nikic

4 years agoRollup merge of #73243 - poliorcetics:discourage-is-file, r=Amanieu
Manish Goregaokar [Sun, 28 Jun 2020 05:29:52 +0000 (22:29 -0700)]
Rollup merge of #73243 - poliorcetics:discourage-is-file, r=Amanieu

Add documentation to point to `File::open` or `OpenOptions::open` instead of `is_file` to check read/write possibility

Fixes #64170.

This adds documentation to point user towards `!is_dir` instead of `is_file` when all they want to is read from a source.

I ran `rg "fn is_file\("` to find all `is_file` methods, I hope I did not miss one.

4 years agoRollup merge of #72796 - RalfJung:mir-assign-sanity, r=matthewjasper
Manish Goregaokar [Sun, 28 Jun 2020 05:29:46 +0000 (22:29 -0700)]
Rollup merge of #72796 - RalfJung:mir-assign-sanity, r=matthewjasper

MIR sanity check: validate types on assignment

This expands the MIR validation added by @jonas-schievink in https://github.com/rust-lang/rust/pull/72093 to also check that on an assignment, the types of both sides match.

Cc @eddyb @oli-obk

4 years agoAuto merge of #72705 - Lucretiel:stdio-forwarding, r=Amanieu
bors [Sun, 28 Jun 2020 04:16:52 +0000 (04:16 +0000)]
Auto merge of #72705 - Lucretiel:stdio-forwarding, r=Amanieu

Added io forwarding methods to the stdio structs

Added methods to forward the `io::Read` and `io::Write` methods of the myriad wrapper structs in `stdio.rs` to their underlying readers / writers. This is especially important for the structs on the outside of a locking boundary, to ensure that the lock isn't being dropped and re-acquired in a loop.

4 years agoFix docstring typo
Caleb Hattingh [Sun, 28 Jun 2020 03:26:09 +0000 (13:26 +1000)]
Fix docstring typo

4 years agoRename the lint to clashing_extern_declarations.
jumbatm [Sun, 28 Jun 2020 00:11:04 +0000 (10:11 +1000)]
Rename the lint to clashing_extern_declarations.

Also, run RustFmt on the clashing_extern_fn test case and update
stderrs.

4 years agoAdded the parapgrah to path::Path::is_file too
Alexis Bourget [Sat, 27 Jun 2020 20:59:47 +0000 (22:59 +0200)]
Added the parapgrah to path::Path::is_file too

4 years agoRename two `Resolver` traits
Vadim Petrochenkov [Sat, 27 Jun 2020 20:51:28 +0000 (23:51 +0300)]
Rename two `Resolver` traits

4 years agoAuto merge of #73671 - ehuss:update-mdbook, r=Mark-Simulacrum
bors [Sat, 27 Jun 2020 20:14:34 +0000 (20:14 +0000)]
Auto merge of #73671 - ehuss:update-mdbook, r=Mark-Simulacrum

Update mdbook

This updates mdbook to 0.4.  The list of changes can be found at https://github.com/rust-lang/mdBook/blob/master/CHANGELOG.md#mdbook-040.  I think the most important one is the change to include fonts with the book instead of using the Google Fonts CDN. This adds a few megabytes of fonts to the docs component.  It may be possible to share the fonts across the books, but would take a fair bit of work to make that happen, so I'm not sure if it is necessary.

This also removes mdbook-linkcheck. It is currently not being used, and I don't foresee it going back into use anytime soon. I would prefer not to maintain something that isn't being used, and it removes a very large number of dependencies.

4 years agoFix comment.
ecstatic-morse [Sat, 27 Jun 2020 19:57:00 +0000 (12:57 -0700)]
Fix comment.

4 years agoAdd test for issue-72352
Yuki Okushi [Sat, 27 Jun 2020 11:34:27 +0000 (20:34 +0900)]
Add test for issue-72352

4 years agoAdd test for issue-71611
Yuki Okushi [Sat, 27 Jun 2020 11:34:16 +0000 (20:34 +0900)]
Add test for issue-71611

4 years agoAdd test for issue-71382
Yuki Okushi [Sat, 27 Jun 2020 11:34:04 +0000 (20:34 +0900)]
Add test for issue-71382

4 years agoAdd links to fs::DirEntry::metadata
Rob Young [Sat, 27 Jun 2020 18:32:19 +0000 (19:32 +0100)]
Add links to fs::DirEntry::metadata

`fs::DirEntry::metadata` doesn't traverse symlinks. It is not immediately
clear what to do if you do want to traverse symlinks. This change adds
links to the two other `metadata` functions that will follow symlinks.

4 years agoUpdate the documentation to point to open instead of is_file and is_dir
Alexis Bourget [Sat, 27 Jun 2020 16:10:58 +0000 (18:10 +0200)]
Update the documentation to point to open instead of is_file and is_dir

4 years agoForward Hash::write_iN to Hash::write_uN
Nikita Popov [Sat, 27 Jun 2020 13:23:01 +0000 (15:23 +0200)]
Forward Hash::write_iN to Hash::write_uN

4 years agofix typo in self-profile.md
Takuto Ikuta [Sat, 27 Jun 2020 12:38:51 +0000 (21:38 +0900)]
fix typo in self-profile.md

4 years agomore LocalDefId cleanup
Bastian Kauschke [Sat, 27 Jun 2020 11:38:00 +0000 (13:38 +0200)]
more LocalDefId cleanup

4 years agoAdd test for issue-71381
Yuki Okushi [Sat, 27 Jun 2020 11:33:50 +0000 (20:33 +0900)]
Add test for issue-71381

4 years agomore LocalDefId in ty::context
Bastian Kauschke [Sat, 27 Jun 2020 11:15:12 +0000 (13:15 +0200)]
more LocalDefId in ty::context

4 years agouse LocalDefId in module checking
Bastian Kauschke [Sat, 27 Jun 2020 11:09:54 +0000 (13:09 +0200)]
use LocalDefId in module checking

4 years agoAuto merge of #73779 - Manishearth:rollup-lwqd9jm, r=Manishearth
bors [Sat, 27 Jun 2020 02:44:35 +0000 (02:44 +0000)]
Auto merge of #73779 - Manishearth:rollup-lwqd9jm, r=Manishearth

Rollup of 12 pull requests

Successful merges:

 - #72771 (Warn if linking to a private item)
 - #72937 (Fortanix SGX target libunwind build process changes)
 - #73485 (Perform obligation deduplication to avoid buggy `ExistentialMismatch`)
 - #73529 (Add liballoc impl SpecFromElem for i8)
 - #73579 (add missing doc links)
 - #73627 (Shortcuts for min/max on double-ended BTreeMap/BTreeSet iterators)
 - #73691 (Bootstrap: detect Windows based on sys.platform)
 - #73694 (Document the Self keyword)
 - #73718 (Document the super keyword)
 - #73728 (Document some invariants correctly/more)
 - #73738 (Remove irrelevant comment)
 - #73765 (Remove blank line)

Failed merges:

r? @ghost

4 years agoAuto merge of #73596 - petrochenkov:shebang2, r=Mark-Simulacrum
bors [Fri, 26 Jun 2020 22:42:44 +0000 (22:42 +0000)]
Auto merge of #73596 - petrochenkov:shebang2, r=Mark-Simulacrum

rustc_lexer: Simplify shebang parsing once more

Fixes https://github.com/rust-lang/rust/issues/73250 (beta regression)

Treat any line starting with `!#` as a shebang candidate, not only lines with something non-whitespace.
This way we no longer need to define what `is_whitespace` means ([Linux shebang whitespace](https://github.com/torvalds/linux/blob/master/fs/binfmt_script.c), ASCII whitespace, Rust lexer whitespace, etc), which is nice.

This change makes some invalid Rust code valid (see the regression above), but still never interprets a fragment of valid Rust code as a shebang.

(This PR also removes one duplicate test.)

4 years agoRollup merge of #73765 - kraai:remove-blank-line, r=jonas-schievink
Manish Goregaokar [Fri, 26 Jun 2020 20:57:46 +0000 (13:57 -0700)]
Rollup merge of #73765 - kraai:remove-blank-line, r=jonas-schievink

Remove blank line

4 years agoRollup merge of #73738 - nbdd0121:comment, r=nikomatsakis
Manish Goregaokar [Fri, 26 Jun 2020 20:57:44 +0000 (13:57 -0700)]
Rollup merge of #73738 - nbdd0121:comment, r=nikomatsakis

Remove irrelevant comment

Iterator is no longer a lang item since 216e72f8d9499d012e23bc4563215e693fcb4f35.

4 years agoRollup merge of #73728 - oli-obk:const_prop_cleanup, r=wesleywiser
Manish Goregaokar [Fri, 26 Jun 2020 20:57:43 +0000 (13:57 -0700)]
Rollup merge of #73728 - oli-obk:const_prop_cleanup, r=wesleywiser

Document some invariants correctly/more

r? @wesleywiser

4 years agoRollup merge of #73718 - poliorcetics:super-keyword, r=shepmaster
Manish Goregaokar [Fri, 26 Jun 2020 20:57:41 +0000 (13:57 -0700)]
Rollup merge of #73718 - poliorcetics:super-keyword, r=shepmaster

Document the super keyword

Partial fix of #34601.

Quite short, just a small example and a link to the reference.

@rustbot modify labels: T-doc,C-enhancement

4 years agoRollup merge of #73694 - poliorcetics:self-upper-keyword, r=Mark-Simulacrum
Manish Goregaokar [Fri, 26 Jun 2020 20:57:39 +0000 (13:57 -0700)]
Rollup merge of #73694 - poliorcetics:self-upper-keyword, r=Mark-Simulacrum

Document the Self keyword

Partial fix of #34601.

Document the `Self` keyword.

This contains simple examples of the places where `Self` can be used.

4 years agoRollup merge of #73691 - ajpaverd:bootstrap-windows-73689, r=Mark-Simulacrum
Manish Goregaokar [Fri, 26 Jun 2020 20:57:37 +0000 (13:57 -0700)]
Rollup merge of #73691 - ajpaverd:bootstrap-windows-73689, r=Mark-Simulacrum

Bootstrap: detect Windows based on sys.platform

Closes #73689.

4 years agoRollup merge of #73627 - ssomers:btree_iter_min_max, r=Mark-Simulacrum
Manish Goregaokar [Fri, 26 Jun 2020 20:57:35 +0000 (13:57 -0700)]
Rollup merge of #73627 - ssomers:btree_iter_min_max, r=Mark-Simulacrum

Shortcuts for min/max on double-ended BTreeMap/BTreeSet iterators

Closes #59947: a performance tweak that might benefit some. Optimizes `min` and `max ` on all btree double-ended iterators that do not drop, i.e. the iterators created by:

- `BTreeMap::iter`
- `BTreeMap::iter_mut`
- `BTreeMap::keys` and `BTreeSet::iter`
- `BTreeMap::range` and `BTreeSet::range`
- `BTreeMap::range_mut`

Also in these (currently) single-ended iterators, but obviously for `min` only:
- `BTreeSet::difference`
- `BTreeSet::intersection`
- `BTreeSet::symmetric_difference`
- `BTreeSet::union`

Did not do this in iterators created by `into_iter` to preserve drop order, as outlined in #62316.

Did not do this in iterators created by `drain_filter`, possibly to preserve drop order, possibly to preserve predicate invocation, mostly to not have to think about it too hard (I guess maybe it wouldn't be a change for `min`, which is the only shortcut possible in this single-ended iterator).

4 years agoRollup merge of #73579 - RalfJung:doc-missing-links, r=shepmaster
Manish Goregaokar [Fri, 26 Jun 2020 20:57:33 +0000 (13:57 -0700)]
Rollup merge of #73579 - RalfJung:doc-missing-links, r=shepmaster

add missing doc links

The doc comments contain ``[`size_of_val`]`` but the link target was missing.

4 years agoRollup merge of #73529 - pickfire:liballoc-specfromelem-i8, r=cuviper
Manish Goregaokar [Fri, 26 Jun 2020 20:57:31 +0000 (13:57 -0700)]
Rollup merge of #73529 - pickfire:liballoc-specfromelem-i8, r=cuviper

Add liballoc impl SpecFromElem for i8

Speedup vec![1_i8; N] for non-zero element.

Before
test do_bench_from_elem_i8        ... bench:         130 ns/iter (+/- 7) = 61 MB/s
test do_bench_from_elem_u8        ... bench:         121 ns/iter (+/- 4) = 66 MB/s
After
test do_bench_from_elem_i8        ... bench:         123 ns/iter (+/- 7) = 65 MB/s
test do_bench_from_elem_u8        ... bench:         121 ns/iter (+/- 5) = 66 MB/s

No speed difference if element is already zero.

```rust
#[bench]
fn do_bench_from_elem_i8(b: &mut Bencher) {
    b.bytes = 8 as u64;
    b.iter(|| {
        let dst = ve::vec![10_i8; 100];
        assert_eq!(dst.len(), 100);
        assert!(dst.iter().all(|x| *x == 10));
    })
}
```

As suggested by @cuviper
https://rust-lang.zulipchat.com/#narrow/stream/219381-t-libs/topic/SpecForElem.20for.20other.20integers

r? @cuviper
CC @joshtriplett

Edit: Wow, I just realized both reviewers are Josh.

4 years agoRollup merge of #73485 - estebank:dedup-preds, r=nikomatsakis
Manish Goregaokar [Fri, 26 Jun 2020 20:57:29 +0000 (13:57 -0700)]
Rollup merge of #73485 - estebank:dedup-preds, r=nikomatsakis

Perform obligation deduplication to avoid buggy `ExistentialMismatch`

Address #59326.

4 years agoRollup merge of #72937 - AdrianCX:master, r=nikomatsakis
Manish Goregaokar [Fri, 26 Jun 2020 20:57:26 +0000 (13:57 -0700)]
Rollup merge of #72937 - AdrianCX:master, r=nikomatsakis

Fortanix SGX target libunwind build process changes

Ticket: https://github.com/fortanix/rust-sgx/issues/174
LLVM related changes (merged): https://github.com/rust-lang/llvm-project/pull/57

Description: libunwind changes needed to run code in sgx environment via rust-sgx.

Target that uses this in rust: x86_64-fortanix-unknown-sgx.

Without this change, rust std for this toolchain is forced to use a precompiled library loaded via environment variable.

With this change we act the same as musl target.

4 years agoRollup merge of #72771 - jyn514:rustdoc, r=Manishearth
Manish Goregaokar [Fri, 26 Jun 2020 20:57:24 +0000 (13:57 -0700)]
Rollup merge of #72771 - jyn514:rustdoc, r=Manishearth

Warn if linking to a private item

Closes https://github.com/rust-lang/rust/issues/72769

r? @GuillaumeGomez

4 years agoExplain move errors that occur due to method calls involving `self`
Aaron Hill [Thu, 11 Jun 2020 17:48:46 +0000 (13:48 -0400)]
Explain move errors that occur due to method calls involving `self`

This is a re-attempt of #72389 (which was reverted in #73594)
Instead of using `ExpnKind::Desugaring` to represent operators, this PR
checks the lang item directly.

4 years agoMake `fn_arg_names` return `Ident` instead of symbol
Aaron Hill [Thu, 11 Jun 2020 17:42:22 +0000 (13:42 -0400)]
Make `fn_arg_names` return `Ident` instead of symbol

Also, implement this query for the local crate, not just foreign crates.

4 years agoAdd peek test for projections
Dylan MacKenzie [Fri, 26 Jun 2020 18:31:48 +0000 (11:31 -0700)]
Add peek test for projections

4 years agoHandle stores to projections correctly in liveness analysis
Dylan MacKenzie [Fri, 26 Jun 2020 18:30:14 +0000 (11:30 -0700)]
Handle stores to projections correctly in liveness analysis

Previously, we were too conservative and `x.field = 4` was treated as a
"use" of `x`.

4 years agorustc_lexer: Simplify shebang parsing once more
Vadim Petrochenkov [Sun, 21 Jun 2020 21:40:11 +0000 (00:40 +0300)]
rustc_lexer: Simplify shebang parsing once more

4 years agoerrors: use `-Z terminal-width` in JSON emitter
David Wood [Fri, 26 Jun 2020 12:18:16 +0000 (13:18 +0100)]
errors: use `-Z terminal-width` in JSON emitter

This commit makes the JSON emitter use `-Z terminal-width` in the
"rendered" field of the JSON output.

Signed-off-by: David Wood <david@davidtw.co>
4 years agoUpdate mdbook.
Eric Huss [Tue, 23 Jun 2020 22:23:46 +0000 (15:23 -0700)]
Update mdbook.

4 years agoRemove mdbook-linkcheck.
Eric Huss [Tue, 23 Jun 2020 22:00:48 +0000 (15:00 -0700)]
Remove mdbook-linkcheck.

4 years agoAuto merge of #73513 - oli-obk:const_binop_overflow, r=estebank
bors [Fri, 26 Jun 2020 14:08:46 +0000 (14:08 +0000)]
Auto merge of #73513 - oli-obk:const_binop_overflow, r=estebank

Show the values and computation that would overflow a const evaluation or propagation

Fixes #71134

In contrast to the example in the issue it doesn't use individual spans for each operand. The effort required to implement that is quite high compared to the little (if at all) benefit it would bring to diagnostics.

cc @shepmaster

The way this is implemented it is also fairly easy to do the same for overflow panics at runtime, but that should be done in a separate PR since it may have runtime performance implications.

4 years agoRemove blank line
KRAAI, MATTHEW [VISUS] [Fri, 26 Jun 2020 13:22:35 +0000 (06:22 -0700)]
Remove blank line

4 years agoFix debug messages
Joshua Nelson [Fri, 26 Jun 2020 12:24:45 +0000 (08:24 -0400)]
Fix debug messages

4 years agoGenerate docs for links to private items when passed --document-private
Joshua Nelson [Sat, 30 May 2020 15:35:35 +0000 (11:35 -0400)]
Generate docs for links to private items when passed --document-private

- Pass around document_private a lot more
- Add tests
  + Add tests for intra-doc links to private items
  + Add ignored tests for warnings in reference links

4 years agoWarn if linking to a private item
Joshua Nelson [Wed, 13 May 2020 04:21:54 +0000 (00:21 -0400)]
Warn if linking to a private item

4 years agoimproper_ctypes: fix remaining `Reveal:All`
David Wood [Fri, 26 Jun 2020 10:21:31 +0000 (11:21 +0100)]
improper_ctypes: fix remaining `Reveal:All`

This commit replaces the remaining uses of `ParamEnv::reveal_all` with
`LateContext`'s `param_env` (normally `Reveal::UserFacing`).

Signed-off-by: David Wood <david@davidtw.co>
4 years agoAuto merge of #73756 - Manishearth:rollup-aehswb2, r=Manishearth
bors [Fri, 26 Jun 2020 10:11:43 +0000 (10:11 +0000)]
Auto merge of #73756 - Manishearth:rollup-aehswb2, r=Manishearth

Rollup of 13 pull requests

Successful merges:

 - #72620 (Omit DW_AT_linkage_name when it is the same as DW_AT_name)
 - #72967 (Don't move cursor in search box when using arrows to navigate results)
 - #73102 (proc_macro: Stop flattening groups with dummy spans)
 - #73297 (Support configurable deny-warnings for all in-tree crates.)
 - #73507 (Cleanup MinGW LLVM linkage workaround)
 - #73588 (Fix handling of reserved registers for ARM inline asm)
 - #73597 (Record span of `const` kw in GenericParamKind)
 - #73629 (Make AssocOp Copy)
 - #73681 (Update Chalk to 0.14)
 - #73707 (Fix links in `SliceIndex` documentation)
 - #73719 (emitter: column width defaults to 140)
 - #73729 (disable collectionbenches for android)
 - #73748 (Add code block to code in documentation of `List::rebase_onto`)

Failed merges:

r? @ghost

4 years agoShow the values and computation that would overflow a const evaluation or propagation
Oliver Scherer [Fri, 19 Jun 2020 16:57:15 +0000 (18:57 +0200)]
Show the values and computation that would overflow a const evaluation or propagation

4 years agoShortcuts for min/max on ordinary BTreeMap/BTreeSet iterators
Stein Somers [Mon, 22 Jun 2020 18:12:11 +0000 (20:12 +0200)]
Shortcuts for min/max on ordinary BTreeMap/BTreeSet iterators

4 years agoRollup merge of #73748 - jyn514:doc-fix, r=Manishearth
Manish Goregaokar [Fri, 26 Jun 2020 07:39:19 +0000 (00:39 -0700)]
Rollup merge of #73748 - jyn514:doc-fix, r=Manishearth

Add code block to code in documentation of `List::rebase_onto`

Closes https://github.com/rust-lang/rust/issues/73676

@bors rollup=always

4 years agoRollup merge of #73729 - nellshamrell:disable-collectionsbenches-android, r=sfackler
Manish Goregaokar [Fri, 26 Jun 2020 07:39:17 +0000 (00:39 -0700)]
Rollup merge of #73729 - nellshamrell:disable-collectionsbenches-android, r=sfackler

disable collectionbenches for android

Fixes #73535

Signed-off-by: Nell Shamrell <nellshamrell@gmail.com>
4 years agoRollup merge of #73719 - davidtwco:issue-72509-emitter-column-width, r=estebank
Manish Goregaokar [Fri, 26 Jun 2020 07:39:15 +0000 (00:39 -0700)]
Rollup merge of #73719 - davidtwco:issue-72509-emitter-column-width, r=estebank

emitter: column width defaults to 140

Fixes #72509.

This PR modifies the column width computation in the emitter when `termize::dimensions` returns `None` so that it uses the default value of 140 (which is used in UI testing currently) instead of `usize::MAX` which just ends up causing overflows in later computations.

I also tried changing the computations which used `column_width` with their saturating equivalent, but the output appeared the same - so I decided to go with this approach because I feel like it's less likely to accidentally re-introduce an ICE like this in future (e.g. adding a non-saturating operation on `column_width` in future).

I haven't added a test because I couldn't come up with a MCVE. I stumbled upon this running rustc-perf with the `piston-image` benchmark (running in tmux; it only happened with stage two builds only; and only when running through Cargo, not rustc directly with the same flags). In addition, given the nature of the issue, I don't know that we *could* write a UI test for this. Open to suggestions here though.

r? @estebank

4 years agoRollup merge of #73707 - LeSeulArtichaut:patch-3, r=kennytm
Manish Goregaokar [Fri, 26 Jun 2020 07:39:14 +0000 (00:39 -0700)]
Rollup merge of #73707 - LeSeulArtichaut:patch-3, r=kennytm

Fix links in `SliceIndex` documentation

See [this doc](https://doc.rust-lang.org/nightly/std/slice/trait.SliceIndex.html#tymethod.get_unchecked) whose links aren't active because of this missing newline.

4 years agoRollup merge of #73681 - jackh726:chalk-0.14, r=nikomatsakis
Manish Goregaokar [Fri, 26 Jun 2020 07:39:12 +0000 (00:39 -0700)]
Rollup merge of #73681 - jackh726:chalk-0.14, r=nikomatsakis

Update Chalk to 0.14

Not a ton here. Notable changes:
- Update to `0.14.0`
  - New dependency on `tracing`, in `librustc_traits` only
  - `FnAbi` from Chalk is `rustc_target::spec::abi::Abi`
  - `Dynamic` actually lowers region
  - Actually lower closures, with some tests. This doesn't 100% work, but can't confirm that's *only* because of closure lowering.
- Use `FxIndexSet` instead of `FxHashSet` in `chalk_fulfill`, which seems to have fixed the non-deterministic test error ordering. Guess we'll see on CI
- Actually implement `opaque_ty_data`, though I don't think this is sufficient for tests for them (I haven't added any)
- Uncomment some of the chalk tests that now work

r? @nikomatsakis

4 years agoRollup merge of #73629 - flip1995:assoc_op_copy_clone, r=Manishearth
Manish Goregaokar [Fri, 26 Jun 2020 07:39:10 +0000 (00:39 -0700)]
Rollup merge of #73629 - flip1995:assoc_op_copy_clone, r=Manishearth

Make AssocOp Copy

Found that this enum is not `Copy` while reviewing this Clippy PR: https://github.com/rust-lang/rust-clippy/pull/5727#discussion_r443761621

There shouldn't be a reason why this should not be `Copy`.