]> git.lizzy.rs Git - rust.git/log
rust.git
4 years agoRollup merge of #69500 - cuviper:par_for_each_in-item, r=Mark-Simulacrum
Yuki Okushi [Thu, 27 Feb 2020 05:38:09 +0000 (14:38 +0900)]
Rollup merge of #69500 - cuviper:par_for_each_in-item, r=Mark-Simulacrum

Simplify the signature of par_for_each_in

Given `T: IntoIterator`/`IntoParallelIterator`, `T::Item` is
unambiguous, so we don't need the explicit trait casting.

4 years agoRollup merge of #69480 - GuillaumeGomez:clean-up-e0373, r=Dylan-DPC
Yuki Okushi [Thu, 27 Feb 2020 05:38:08 +0000 (14:38 +0900)]
Rollup merge of #69480 - GuillaumeGomez:clean-up-e0373, r=Dylan-DPC

Clean up E0373 explanation

r? @Dylan-DPC

4 years agoRollup merge of #69479 - matthiaskrgr:op_pred, r=Dylan-DPC
Yuki Okushi [Thu, 27 Feb 2020 05:38:06 +0000 (14:38 +0900)]
Rollup merge of #69479 - matthiaskrgr:op_pred, r=Dylan-DPC

clarify operator precedence

4 years agoRollup merge of #69473 - contrun:update-llvm, r=nikomatsakis
Yuki Okushi [Thu, 27 Feb 2020 05:38:05 +0000 (14:38 +0900)]
Rollup merge of #69473 - contrun:update-llvm, r=nikomatsakis

update llvm to silence gcc 9 warnings

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

4 years agoRollup merge of #69439 - petrochenkov:latelife, r=matthewjasper
Yuki Okushi [Thu, 27 Feb 2020 05:38:03 +0000 (14:38 +0900)]
Rollup merge of #69439 - petrochenkov:latelife, r=matthewjasper

resolve: `lifetimes.rs` -> `late/lifetimes.rs`

Lifetime resolution should ideally be merged into the late resolution pass, at least for named lifetimes.
Let's move it closer to it for a start.

4 years agoRollup merge of #69324 - estebank:ice-break-backport-bad-placeholder-type, r=Centril
Yuki Okushi [Thu, 27 Feb 2020 05:38:02 +0000 (14:38 +0900)]
Rollup merge of #69324 - estebank:ice-break-backport-bad-placeholder-type, r=Centril

Backport only: avoid ICE on bad placeholder type

 #69148 has a proper fix, but it is too big to backport.
This change avoids the ICE by actually emitting an appropriate error. The
output will be duplicated in some cases, but that's better than the
avoidable ICE.

r? @Centril

4 years agoSimplify the signature of par_for_each_in
Josh Stone [Wed, 26 Feb 2020 23:08:21 +0000 (15:08 -0800)]
Simplify the signature of par_for_each_in

Given `T: IntoIterator`/`IntoParallelIterator`, `T::Item` is
unambiguous, so we don't need the explicit trait casting.

4 years agoAuto merge of #67742 - mark-i-m:describe-it, r=matthewjasper
bors [Wed, 26 Feb 2020 20:50:56 +0000 (20:50 +0000)]
Auto merge of #67742 - mark-i-m:describe-it, r=matthewjasper

Generalized article_and_description

r? @matthewjasper

The logic of finding the right word and article to print seems to be repeated elsewhere... this is an experimental method to unify this logic...

4 years agoAuto merge of #69484 - Dylan-DPC:rollup-j6ripxy, r=Dylan-DPC
bors [Wed, 26 Feb 2020 16:01:21 +0000 (16:01 +0000)]
Auto merge of #69484 - Dylan-DPC:rollup-j6ripxy, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #68712 (Add methods to 'leak' RefCell borrows as references with the lifetime of the original reference)
 - #69209 (Miscellaneous cleanup to formatting)
 - #69381 (Allow getting `no_std` from the config file)
 - #69434 (rustc_metadata: Use binary search from standard library)
 - #69447 (Minor refactoring of statement parsing)

Failed merges:

r? @ghost

4 years agoRollup merge of #69447 - Centril:minor-stmt-refactor, r=estebank
Dylan DPC [Wed, 26 Feb 2020 14:34:35 +0000 (15:34 +0100)]
Rollup merge of #69447 - Centril:minor-stmt-refactor, r=estebank

Minor refactoring of statement parsing

Extracted out of https://github.com/rust-lang/rust/pull/69445.

r? @estebank

4 years agoRollup merge of #69434 - petrochenkov:metabs, r=Mark-Simulacrum
Dylan DPC [Wed, 26 Feb 2020 14:34:33 +0000 (15:34 +0100)]
Rollup merge of #69434 - petrochenkov:metabs, r=Mark-Simulacrum

rustc_metadata: Use binary search from standard library

instead of a hand rolled one.

Noticed while reviewing https://github.com/rust-lang/rust/pull/68941.

4 years agoRollup merge of #69381 - QuiltOS:no-std-from-config, r=Mark-Simulacrum
Dylan DPC [Wed, 26 Feb 2020 14:34:32 +0000 (15:34 +0100)]
Rollup merge of #69381 - QuiltOS:no-std-from-config, r=Mark-Simulacrum

Allow getting `no_std` from the config file

Currently, it is only set correctly in the sanity checking implicit
default fallback code. Having a config file at all will for force
`no_std = false`.

4 years agoRollup merge of #69209 - Mark-Simulacrum:strip-unsafe, r=dtolnay
Dylan DPC [Wed, 26 Feb 2020 14:34:30 +0000 (15:34 +0100)]
Rollup merge of #69209 - Mark-Simulacrum:strip-unsafe, r=dtolnay

Miscellaneous cleanup to formatting

Each commit stands alone.

This pull request will also resolve #58320.

4 years agoRollup merge of #68712 - HeroicKatora:finalize-ref-cell, r=dtolnay
Dylan DPC [Wed, 26 Feb 2020 14:34:29 +0000 (15:34 +0100)]
Rollup merge of #68712 - HeroicKatora:finalize-ref-cell, r=dtolnay

Add methods to 'leak' RefCell borrows as references with the lifetime of the original reference

Usually, references to the interior are only created by the `Deref` and
`DerefMut` impl of the guards `Ref` and `RefMut`. Note that `RefCell`
already has to cope with leaks of such guards which, when it occurs,
effectively makes it impossible to ever acquire a mutable guard or any
guard for `Ref` and `RefMut` respectively. It is already safe to use
this to create a reference to the inner of the ref cell that lives as
long as the reference to the `RefCell` itself, e.g.

```rust
fn leak(r: &RefCell<usize>) -> Option<&usize> {
    let guard = r.try_borrow().ok()?;
    let leaked = Box::leak(Box::new(guard));
    Some(&*leaked)
}
```

The newly added methods allow the same reference conversion without an
indirection over a leaked allocation. It's placed on the `Ref`/`RefMut` to
compose with both borrow and try_borrow directly.

4 years agoAuto merge of #67290 - jonas-schievink:leak-audit, r=KodrAus
bors [Wed, 26 Feb 2020 12:48:53 +0000 (12:48 +0000)]
Auto merge of #67290 - jonas-schievink:leak-audit, r=KodrAus

Audit liballoc for leaks in `Drop` impls when user destructor panics

Inspired by https://github.com/rust-lang/rust/pull/67243 and https://github.com/rust-lang/rust/pull/67235, this audits and hopefully fixes the remaining `Drop` impls in liballoc for resource leaks in the presence of panics in destructors called by the affected `Drop` impl.

This does not touch `Hash{Map,Set}` since they live in hashbrown. They have similar issues though.

r? @KodrAus

4 years agoClean up E0373 explanation
Guillaume Gomez [Wed, 26 Feb 2020 11:56:30 +0000 (12:56 +0100)]
Clean up E0373 explanation

4 years agoclarify operator precedence
Matthias Krüger [Wed, 26 Feb 2020 11:43:37 +0000 (12:43 +0100)]
clarify operator precedence

4 years agoAuto merge of #61812 - jonas-schievink:assoc-ty-defaults, r=nikomatsakis
bors [Wed, 26 Feb 2020 09:27:06 +0000 (09:27 +0000)]
Auto merge of #61812 - jonas-schievink:assoc-ty-defaults, r=nikomatsakis

Implement RFC 2532 – Associated Type Defaults

This is a partial implementation that is still missing the changes to object types, since I ran into some trouble while implementing that. I'm opening this part already to get feedback on the implementation and the unexpected test fallout (see my comments below). The remaining changes can be done in a later PR.

Blockers before this can land:
* [x] Resolve unsoundness around interaction with specialization (https://github.com/rust-lang/rust/pull/61812#discussion_r300504010) - #64564

cc https://github.com/rust-lang/rust/issues/29661
Fixes #53907
Fixes #54182
Fixes #62211
Fixes #41868
Fixes #63593
Fixes #47385
Fixes #43924
Fixes #32350
Fixes #26681
Fixes https://github.com/rust-lang/rust/issues/67187

4 years agoupdate llvm to silence gcc 9 warnings
YI [Wed, 26 Feb 2020 00:56:55 +0000 (08:56 +0800)]
update llvm to silence gcc 9 warnings

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

4 years agoAuto merge of #69474 - Dylan-DPC:rollup-ciotplu, r=Dylan-DPC
bors [Wed, 26 Feb 2020 01:48:27 +0000 (01:48 +0000)]
Auto merge of #69474 - Dylan-DPC:rollup-ciotplu, r=Dylan-DPC

Rollup of 7 pull requests

Successful merges:

 - #67637 (Add primitive module to libcore)
 - #69387 (Deduplicate identifier printing a bit)
 - #69412 (Mark attributes consumed by `check_mod_attrs` as normal)
 - #69423 (syntax: Remove `Nt(Impl,Trait,Foreign)Item`)
 - #69429 (remove redundant clones and import)
 - #69457 (Clean up e0370 e0371)
 - #69468 ([master] Backport release notes of 1.41.1)

Failed merges:

r? @ghost

4 years agoRollup merge of #69468 - pietroalbini:master-1.41.1-notes, r=Mark-Simulacrum
Dylan DPC [Wed, 26 Feb 2020 01:07:18 +0000 (02:07 +0100)]
Rollup merge of #69468 - pietroalbini:master-1.41.1-notes, r=Mark-Simulacrum

[master] Backport release notes of 1.41.1

r? @Mark-Simulacrum

4 years agoRollup merge of #69457 - GuillaumeGomez:clean-up-e0370-e0371, r=Dylan-DPC
Dylan DPC [Wed, 26 Feb 2020 01:07:17 +0000 (02:07 +0100)]
Rollup merge of #69457 - GuillaumeGomez:clean-up-e0370-e0371, r=Dylan-DPC

Clean up e0370 e0371

r? @Dylan-DPC

4 years agoRollup merge of #69429 - matthiaskrgr:clippy_, r=estebank
Dylan DPC [Wed, 26 Feb 2020 01:07:15 +0000 (02:07 +0100)]
Rollup merge of #69429 - matthiaskrgr:clippy_, r=estebank

remove redundant clones and import

4 years agoRollup merge of #69423 - petrochenkov:nont, r=Centril
Dylan DPC [Wed, 26 Feb 2020 01:07:14 +0000 (02:07 +0100)]
Rollup merge of #69423 - petrochenkov:nont, r=Centril

syntax: Remove `Nt(Impl,Trait,Foreign)Item`

Follow-up to https://github.com/rust-lang/rust/pull/69366.
r? @Centril

4 years agoRollup merge of #69412 - tmiasko:checked-unused, r=petrochenkov
Dylan DPC [Wed, 26 Feb 2020 01:07:12 +0000 (02:07 +0100)]
Rollup merge of #69412 - tmiasko:checked-unused, r=petrochenkov

Mark attributes consumed by `check_mod_attrs` as normal

Take advantage of the fact that `check_mod_attrs` marks attributes as
used and change their type to normal, so that any remaining uses will be
warned about by the unused attribute lint.

4 years agoRollup merge of #69387 - petrochenkov:idprint, r=Mark-Simulacrum
Dylan DPC [Wed, 26 Feb 2020 01:07:11 +0000 (02:07 +0100)]
Rollup merge of #69387 - petrochenkov:idprint, r=Mark-Simulacrum

Deduplicate identifier printing a bit

https://github.com/rust-lang/rust/pull/67010 introduced a couple more subtly different ways to print an identifier.
This PR attempts to restore the order.

The most basic identifier printing interface is `Formatter`-based now, so `String`s are not allocated unless required.

r? @Mark-Simulacrum

4 years agoRollup merge of #67637 - Mark-Simulacrum:primitive-mod, r=dtolnay
Dylan DPC [Wed, 26 Feb 2020 01:07:05 +0000 (02:07 +0100)]
Rollup merge of #67637 - Mark-Simulacrum:primitive-mod, r=dtolnay

Add primitive module to libcore

This re-exports the primitive types from libcore at `core::primitive` to allow
macro authors to have a reliable location to use them from.

Fixes #44865

4 years agoAuto merge of #69450 - cuviper:llvm-scev-no-wrap, r=nikic
bors [Tue, 25 Feb 2020 22:13:27 +0000 (22:13 +0000)]
Auto merge of #69450 - cuviper:llvm-scev-no-wrap, r=nikic

Cherry-pick the LLVM fix for #69225

An additional reproducer was provided in #69225 -- the new testcase here -- which still crashes even after #69241 reverted #67174. Now this pull request updates LLVM with the cherry-picked reversion of its own. This is also going to stable in #69444.

I have not tried to reapply #67174 yet -- cc @kraai @shahn

4 years agobackport release notes of 1.41.1
Pietro Albini [Tue, 25 Feb 2020 19:19:12 +0000 (20:19 +0100)]
backport release notes of 1.41.1

4 years agoAuto merge of #69421 - flip1995:clippyup, r=Dylan-DPC
bors [Tue, 25 Feb 2020 15:08:50 +0000 (15:08 +0000)]
Auto merge of #69421 - flip1995:clippyup, r=Dylan-DPC

Update Clippy from 8fbb23f to fc5d0cc

Fixes #69419

```
Fix false positive in `missing_const_for_fn`
Rustup to rust-lang/rust#69366
Add new lint [`wildcard imports`]. Add suggestion to [`enum_glob_use`]
Add new lint `lossy_float_literal` to detect lossy whole number float literals
```

4 years agoClean up E0371 explanation
Guillaume Gomez [Tue, 25 Feb 2020 12:28:47 +0000 (13:28 +0100)]
Clean up E0371 explanation

4 years agoClean up E0370 explanation
Guillaume Gomez [Tue, 25 Feb 2020 12:28:40 +0000 (13:28 +0100)]
Clean up E0370 explanation

4 years agoAuto merge of #69440 - Dylan-DPC:rollup-hj4bo9l, r=Dylan-DPC
bors [Tue, 25 Feb 2020 11:56:56 +0000 (11:56 +0000)]
Auto merge of #69440 - Dylan-DPC:rollup-hj4bo9l, r=Dylan-DPC

Rollup of 6 pull requests

Successful merges:

 - #69220 (Add documentation for the `-Zself-profile` flag)
 - #69391 (Add rustdoc aliases to `ptr::copy` and `ptr::copy_nonoverlapping`)
 - #69427 (Cleanup e0368 e0369)
 - #69433 (don't explicitly compare against true or false)
 - #69435 (Replace uses of Cell::get + Cell::set with Cell::replace.)
 - #69437 (no more codegen for miri_start_panic)

Failed merges:

r? @ghost

4 years agoAuto merge of #69428 - matthiaskrgr:submodule_upd, r=Xanewok
bors [Tue, 25 Feb 2020 08:36:38 +0000 (08:36 +0000)]
Auto merge of #69428 - matthiaskrgr:submodule_upd, r=Xanewok

submodules: update rls from 10bf331 to 5fde462

Changes:
````
Update cargo.
````

Fixes #69383
Fixes #69286

r? @Xanewok

4 years agoparse: address nitpick
Mazdak Farrokhzad [Tue, 25 Feb 2020 05:00:47 +0000 (06:00 +0100)]
parse: address nitpick

4 years agobootstrap: Further centralize target defaulting logic.
John Ericson [Tue, 25 Feb 2020 02:59:36 +0000 (21:59 -0500)]
bootstrap: Further centralize target defaulting logic.

Background: targets can be specied with or without config files;
unneccessarily differences in the logic between those cases has caused
a) the bug I tried to fix in the previous commit, b) the bug I
introduced in the previous commit.

The solution is to make the code paths the same as much as possible.

1. Targets are now not created from the `default` method. (I would both
remove the impl if this was a public library, but just wrap it for
convience becaues it's not.) Instead, there is a `from_triple` method
which does the defaulting.

2. Besides the sanity checking, use the new method in the code reading
config files. Now `no_std` is overriden iff set explicitly just like the
other fields which are optional in the TOML AST type.

3. In sanity checking, just populate the map for all targets no matter
what. That way do don't duplicate logic trying to be clever and remember
which targets have "non standard" overrides. Sanity checking is back to
just sanity checking, and out of the game of trying to default too.

4 years agoCherry-pick the LLVM fix for #69225
Josh Stone [Tue, 25 Feb 2020 00:21:22 +0000 (16:21 -0800)]
Cherry-pick the LLVM fix for #69225

4 years agoparse: move condition into guard
Mazdak Farrokhzad [Mon, 24 Feb 2020 23:59:39 +0000 (00:59 +0100)]
parse: move condition into guard

4 years agoparse: simplify `parse_stmt_without_recovery`.
Mazdak Farrokhzad [Sun, 23 Feb 2020 13:10:03 +0000 (14:10 +0100)]
parse: simplify `parse_stmt_without_recovery`.

4 years agoparse: extract `parse_stmt_item` & `parse_stmt_path_start`.
Mazdak Farrokhzad [Sun, 23 Feb 2020 12:49:19 +0000 (13:49 +0100)]
parse: extract `parse_stmt_item` & `parse_stmt_path_start`.

4 years agoRollup merge of #69437 - RalfJung:miri-no-codegen, r=ecstatic-morse
Dylan DPC [Mon, 24 Feb 2020 19:10:19 +0000 (20:10 +0100)]
Rollup merge of #69437 - RalfJung:miri-no-codegen, r=ecstatic-morse

no more codegen for miri_start_panic

With https://github.com/rust-lang/miri/pull/1136 landed, we don't generate code any more for crates that will be run by Miri. So the LLVM backend does not have to implement the `miri_start_panic` intrinsic any more.

Cc @Aaron1011

4 years agoRollup merge of #69435 - anyska:cell-replace, r=Centril
Dylan DPC [Mon, 24 Feb 2020 19:10:18 +0000 (20:10 +0100)]
Rollup merge of #69435 - anyska:cell-replace, r=Centril

Replace uses of Cell::get + Cell::set with Cell::replace.

4 years agoRollup merge of #69433 - matthiaskrgr:bool_cmp, r=eddyb
Dylan DPC [Mon, 24 Feb 2020 19:10:16 +0000 (20:10 +0100)]
Rollup merge of #69433 - matthiaskrgr:bool_cmp, r=eddyb

don't explicitly compare against true or false

4 years agoRollup merge of #69427 - GuillaumeGomez:cleanup-e0368-e0369, r=Dylan-DPC
Dylan DPC [Mon, 24 Feb 2020 19:10:15 +0000 (20:10 +0100)]
Rollup merge of #69427 - GuillaumeGomez:cleanup-e0368-e0369, r=Dylan-DPC

Cleanup e0368 e0369

r? @Dylan-DPC

4 years agoRollup merge of #69391 - memoryruins:memalias, r=Mark-Simulacrum
Dylan DPC [Mon, 24 Feb 2020 19:10:13 +0000 (20:10 +0100)]
Rollup merge of #69391 - memoryruins:memalias, r=Mark-Simulacrum

Add rustdoc aliases to `ptr::copy` and `ptr::copy_nonoverlapping`

This PR adds a [rustdoc alias](https://doc.rust-lang.org/nightly/rustdoc/unstable-features.html#add-aliases-for-an-item-in-documentation-search) to `ptr::copy` and `ptr::copy_nonoverlapping` using the commonly used terms `memcpy` and `memmove`. The motivation for this PR is to improve discoverability for these functions, since I've noticed users overlook these functions on multiple occasions (and they have thus reached for [libc](https://crates.io/crates/libc) without need). Currently std docs state:

https://doc.rust-lang.org/nightly/std/ptr/fn.copy_nonoverlapping.html
> `copy_nonoverlapping` is semantically equivalent to C's `memcpy`, but with the argument order swapped.

https://doc.rust-lang.org/nightly/std/ptr/fn.copy.html
> `copy` is semantically equivalent to C's `memmove`, but with the argument order swapped.

#### search results before adding a rustdoc alias:
![screenshot 6517](https://user-images.githubusercontent.com/6868531/75102985-78fbb680-55c2-11ea-8e41-04979e6fa6f6.png)
![screenshot 6518](https://user-images.githubusercontent.com/6868531/75102984-78632000-55c2-11ea-9673-8822aae636d1.png)

#### after adding `#[doc(alias = "memcpy")]` and `#[doc(alias = "memmove")]`:
![screenshot 6516](https://user-images.githubusercontent.com/6868531/75102986-78fbb680-55c2-11ea-93b9-1929be940043.png)
![screenshot 6515](https://user-images.githubusercontent.com/6868531/75102987-78fbb680-55c2-11ea-9861-ce8a77a0c3b9.png)

4 years agoRollup merge of #69220 - wesleywiser:doc_self_profile_unstable_book, r=nikomatsakis
Dylan DPC [Mon, 24 Feb 2020 19:10:12 +0000 (20:10 +0100)]
Rollup merge of #69220 - wesleywiser:doc_self_profile_unstable_book, r=nikomatsakis

Add documentation for the `-Zself-profile` flag

4 years agoresolve: `lifetimes.rs` -> `late/lifetime.rs`
Vadim Petrochenkov [Mon, 24 Feb 2020 18:44:55 +0000 (21:44 +0300)]
resolve: `lifetimes.rs` -> `late/lifetime.rs`

4 years agosyntax: Remove `Nt(Impl,Trait,Foreign)Item`
Vadim Petrochenkov [Mon, 24 Feb 2020 09:06:45 +0000 (12:06 +0300)]
syntax: Remove `Nt(Impl,Trait,Foreign)Item`

4 years agoReplace uses of Cell::get + Cell::set with Cell::replace.
Ana-Maria [Mon, 24 Feb 2020 16:23:55 +0000 (16:23 +0000)]
Replace uses of Cell::get + Cell::set with Cell::replace.

4 years agorustc_metadata: Use binary search from standard library
Vadim Petrochenkov [Mon, 24 Feb 2020 16:03:15 +0000 (19:03 +0300)]
rustc_metadata: Use binary search from standard library

instead of a hand rolled one.

4 years agodon't explicitly compare against true or false
Matthias Krüger [Mon, 24 Feb 2020 15:52:40 +0000 (16:52 +0100)]
don't explicitly compare against true or false

4 years agono more codegen for miri_start_panic
Ralf Jung [Mon, 24 Feb 2020 15:42:26 +0000 (16:42 +0100)]
no more codegen for miri_start_panic

4 years agoAuto merge of #69344 - RalfJung:miri, r=oli-obk
bors [Mon, 24 Feb 2020 14:54:39 +0000 (14:54 +0000)]
Auto merge of #69344 - RalfJung:miri, r=oli-obk

bump Miri

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

r? @ghost Cc @oli-obk

4 years agolibrustc_macros: remove redundant single component path import
Matthias Krüger [Mon, 24 Feb 2020 13:53:55 +0000 (14:53 +0100)]
librustc_macros: remove redundant single component path import

4 years agolibrustc{, codegen_ssa,infer,mir_build}: don't clone types that are copy
Matthias Krüger [Mon, 24 Feb 2020 13:48:40 +0000 (14:48 +0100)]
librustc{, codegen_ssa,infer,mir_build}: don't clone types that are copy

4 years agoremove redundant clones in librustc_mir_build and librustc_data_structures
Matthias Krüger [Mon, 24 Feb 2020 13:42:14 +0000 (14:42 +0100)]
remove redundant clones in librustc_mir_build and librustc_data_structures

4 years agosubmodules: update rls from 10bf331 to 5fde462
Matthias Krüger [Mon, 24 Feb 2020 12:47:20 +0000 (13:47 +0100)]
submodules: update rls from 10bf331 to 5fde462

Changes:
````
Update cargo.
````

Fixes #69383
Fixes #69286

r? @Xanewok

4 years agobump Miri once more
Ralf Jung [Mon, 24 Feb 2020 12:08:24 +0000 (13:08 +0100)]
bump Miri once more

4 years agoClean up E0368 and E0369 explanations
Guillaume Gomez [Mon, 24 Feb 2020 11:55:49 +0000 (12:55 +0100)]
Clean up E0368 and E0369 explanations

4 years agoAuto merge of #69424 - pietroalbini:rollup-3oelogm, r=pietroalbini
bors [Mon, 24 Feb 2020 11:41:30 +0000 (11:41 +0000)]
Auto merge of #69424 - pietroalbini:rollup-3oelogm, r=pietroalbini

Rollup of 5 pull requests

Successful merges:

 - #69372 (Updates links in various Compiler Error Index entries)
 - #69385 (Relax str::get_unchecked precondition to permit empty slicing)
 - #69386 (Fix minor error in `MaybeUninit::get_mut()` doc example)
 - #69394 (Clean up E0367 explanation)
 - #69405 (docs: Stdin::read_line: mention the appending)

Failed merges:

r? @ghost

4 years agoAddress method comments
Andreas Molzer [Mon, 24 Feb 2020 10:23:47 +0000 (11:23 +0100)]
Address method comments

4 years agoRollup merge of #69405 - NieDzejkob:docs-readline-appends, r=joshtriplett
Pietro Albini [Mon, 24 Feb 2020 10:15:36 +0000 (11:15 +0100)]
Rollup merge of #69405 - NieDzejkob:docs-readline-appends, r=joshtriplett

docs: Stdin::read_line: mention the appending

The fact that `stdin().read_line()` is an [unpleasant](https://twitter.com/Michcioperz/status/1231646797661167617?s=20) [footgun](https://rustbattle.net/battle/straight-finch-8-e4f4). Let's make it clearer in the documentation.

4 years agoRollup merge of #69394 - GuillaumeGomez:clean-up-0367, r=Dylan-DPC
Pietro Albini [Mon, 24 Feb 2020 10:15:34 +0000 (11:15 +0100)]
Rollup merge of #69394 - GuillaumeGomez:clean-up-0367, r=Dylan-DPC

Clean up E0367 explanation

r? @Dylan-DPC

4 years agoRollup merge of #69386 - danielhenrymantilla:maybe_uninit_docs_replace_chunk_with_win...
Pietro Albini [Mon, 24 Feb 2020 10:15:33 +0000 (11:15 +0100)]
Rollup merge of #69386 - danielhenrymantilla:maybe_uninit_docs_replace_chunk_with_windows, r=Dylan-DPC

Fix minor error in `MaybeUninit::get_mut()` doc example

In the `MaybeUninit::get_mut()` example I wanted to assert that the slice was sorted and mistakenly used `.chunks(2)` rather than `.windows(2)` to assert it, as @ametisf pointed out in https://github.com/rust-lang/rust/pull/65948#issuecomment-589988183 .

This fixes it.

4 years agoRollup merge of #69385 - ridiculousfish:relax_get_unchecked, r=nagisa
Pietro Albini [Mon, 24 Feb 2020 10:15:31 +0000 (11:15 +0100)]
Rollup merge of #69385 - ridiculousfish:relax_get_unchecked, r=nagisa

Relax str::get_unchecked precondition to permit empty slicing

Prior to this commit, `str` documented that `get_unchecked` had
the precondition that "`begin` must come before `end`". This would appear
to prohibit empty slices (i.e. begin == end).

In practice, get_unchecked is called often with empty slices. Let's relax
the precondition so as to allow them.

4 years agoRollup merge of #69372 - yawpitch:master, r=varkor
Pietro Albini [Mon, 24 Feb 2020 10:15:30 +0000 (11:15 +0100)]
Rollup merge of #69372 - yawpitch:master, r=varkor

Updates links in various Compiler Error Index entries

Currently many of the links in the online https://doc.rust-lang.org/error-index.html are not clickable, and many of them don't resolve correctly as they point to older versions of rustbyexample and the reference.

4 years agoUpdate Clippy
flip1995 [Mon, 24 Feb 2020 08:13:13 +0000 (09:13 +0100)]
Update Clippy

4 years agoBump core::primitive to 1.43
David Tolnay [Mon, 24 Feb 2020 07:59:39 +0000 (23:59 -0800)]
Bump core::primitive to 1.43

4 years agoAuto merge of #69366 - Centril:unified-items, r=petrochenkov
bors [Mon, 24 Feb 2020 00:31:01 +0000 (00:31 +0000)]
Auto merge of #69366 - Centril:unified-items, r=petrochenkov

parse: unify item parsing & filter illegal item kinds

This PR fully unifies item parsing into a single `fn parse_item_common` method which produces `Option<Item>`. The `Item` is then mapped into `ForeignItem` and `AssocItem` as necessary by transforming the `*Kind` and converting contextually bad variants into `None`, thereby filtering them away.

The PR does not yet unmerge the definition of `ForeignItemKind` from `AssocItemKind`. I've left that as future work as it didn't feel like this parser-focused PR would be the best one to deal with it. Changes to the AST data structures are instead kept to a reasonable minimum.

Based on https://github.com/rust-lang/rust/pull/69361.

Fixes https://github.com/rust-lang/rust/issues/48137.
RELNOTES: Now, `item` macro fragments can be interpolated into `impl`, `trait`, and `extern` contexts. See `src/test/ui/parser/issue-48137-macros-cannot-interpolate-impl-items.rs` for the relevant test.

r? @petrochenkov
cc @estebank

4 years agoparse: test bad variants wrt. issue 48137.
Mazdak Farrokhzad [Sun, 23 Feb 2020 12:04:46 +0000 (13:04 +0100)]
parse: test bad variants wrt. issue 48137.

4 years agoparse: tweak diagnostic wordings
Mazdak Farrokhzad [Sun, 23 Feb 2020 11:54:00 +0000 (12:54 +0100)]
parse: tweak diagnostic wordings

4 years agoparse: tweak `parse_item_` for more reuse.
Mazdak Farrokhzad [Sun, 23 Feb 2020 10:52:57 +0000 (11:52 +0100)]
parse: tweak `parse_item_` for more reuse.

4 years agoparse/ast: move `Defaultness` into variants.
Mazdak Farrokhzad [Sun, 23 Feb 2020 09:24:30 +0000 (10:24 +0100)]
parse/ast: move `Defaultness` into variants.

4 years agoparse: `NtItem` -> `parse_item_common`.
Mazdak Farrokhzad [Sun, 23 Feb 2020 05:53:59 +0000 (06:53 +0100)]
parse: `NtItem` -> `parse_item_common`.

4 years agoparser: tweak item kind wording
Mazdak Farrokhzad [Sun, 23 Feb 2020 05:04:37 +0000 (06:04 +0100)]
parser: tweak item kind wording

4 years agoparser: tweak unmatched wording
Mazdak Farrokhzad [Sun, 23 Feb 2020 03:49:26 +0000 (04:49 +0100)]
parser: tweak unmatched wording

4 years agoparser: refactor away at_end
Mazdak Farrokhzad [Sat, 22 Feb 2020 09:03:10 +0000 (10:03 +0100)]
parser: refactor away at_end

4 years agoparse: harden `default` test.
Mazdak Farrokhzad [Sat, 22 Feb 2020 07:55:01 +0000 (08:55 +0100)]
parse: harden `default` test.

4 years agoparse: move token hack into `parse_item_common`.
Mazdak Farrokhzad [Sat, 22 Feb 2020 07:34:24 +0000 (08:34 +0100)]
parse: move token hack into `parse_item_common`.

4 years agoparse: use `parse_item_common` in `parse_assoc_item_`.
Mazdak Farrokhzad [Sat, 22 Feb 2020 07:16:39 +0000 (08:16 +0100)]
parse: use `parse_item_common` in `parse_assoc_item_`.

4 years agoparse: use `parse_item_common` in `parse_foreign_item`.
Mazdak Farrokhzad [Sat, 22 Feb 2020 05:57:31 +0000 (06:57 +0100)]
parse: use `parse_item_common` in `parse_foreign_item`.

4 years agoparse: recover `default` on free items.
Mazdak Farrokhzad [Sat, 22 Feb 2020 03:53:02 +0000 (04:53 +0100)]
parse: recover `default` on free items.

4 years agoparse: extract `error_on_unmatched_vis`.
Mazdak Farrokhzad [Sat, 22 Feb 2020 02:44:24 +0000 (03:44 +0100)]
parse: extract `error_on_unmatched_vis`.

4 years agoast: add `Defaultness` to `Item`, making `AssocItem` an alias.
Mazdak Farrokhzad [Sat, 22 Feb 2020 02:29:17 +0000 (03:29 +0100)]
ast: add `Defaultness` to `Item`, making `AssocItem` an alias.

4 years ago`parse_defaultness`: avoid hardcoded list of keywords.
Mazdak Farrokhzad [Sat, 22 Feb 2020 01:32:02 +0000 (02:32 +0100)]
`parse_defaultness`: avoid hardcoded list of keywords.

4 years agoadd `Span` to `ast::Defaultness::Default`.
Mazdak Farrokhzad [Sat, 22 Feb 2020 01:01:53 +0000 (02:01 +0100)]
add `Span` to `ast::Defaultness::Default`.

4 years agodocs: Stdin::read_line: mention the appending
Jakub Kądziołka [Sun, 23 Feb 2020 20:19:25 +0000 (21:19 +0100)]
docs: Stdin::read_line: mention the appending

4 years agoAuto merge of #69393 - Dylan-DPC:rollup-rxbd1zg, r=Dylan-DPC
bors [Sun, 23 Feb 2020 19:26:35 +0000 (19:26 +0000)]
Auto merge of #69393 - Dylan-DPC:rollup-rxbd1zg, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #69336 (Do not ping the infrastructure team on toolstate changes)
 - #69351 (Improve external MinGW detection)
 - #69361 (parse: allow `type Foo: Ord` syntactically)
 - #69375 (Rename CodeMap to SourceMap follow up)
 - #69376 (parser: Cleanup `Parser::bump_with` and its uses)

Failed merges:

r? @ghost

4 years agoAuto merge of #69084 - yaahc:delayed-doc-lint, r=petrochenkov
bors [Sun, 23 Feb 2020 16:09:41 +0000 (16:09 +0000)]
Auto merge of #69084 - yaahc:delayed-doc-lint, r=petrochenkov

Split non macro portion of unused_doc_comment from macro part into two passes/lints

## Motivation

This change is motivated by the needs of the [spandoc library](https://github.com/yaahc/spandoc). The specific use case is that my macro is removing doc comments when an attribute is applied to a fn with doc comments, but I would like the lint to still appear when I forget to add the `#[spandoc]` attribute to a fn, so I don't want to have to silence the lint globally.

## Approach

This change splits the `unused _doc_comment` lint into two lints, `unused_macro_doc_comment` and `unused_doc_comment`. The non macro portion is moved into an `early_lint_pass` rather than a pre_expansion_pass. This allows proc macros to silence `unused_doc_comment` warnings by either adding an attribute to silence it or by removing the doc comment before the early_pass runs.

The `unused_macro_doc_comment` lint however will still be impossible for proc-macros to silence, but the only alternative that I can see is to remove this lint entirely, which I don't think is acceptable / is a decision I'm not comfortable making personally, so instead I opted to split the macro portion of the check into a separate lint so that it can be silenced globally with an attribute if necessary without needing to globally silence the `unused_doc_comment` lint as well, which is still desireable.

fixes https://github.com/rust-lang/rust/issues/67838

4 years agoDeduplicate identifier printing a bit
Vadim Petrochenkov [Sat, 22 Feb 2020 22:29:36 +0000 (01:29 +0300)]
Deduplicate identifier printing a bit

4 years agoAuto merge of #69351 - mati865:mingw-ultimate-fix, r=cramertj
bors [Sun, 23 Feb 2020 12:52:48 +0000 (12:52 +0000)]
Auto merge of #69351 - mati865:mingw-ultimate-fix, r=cramertj

Improve external MinGW detection

Fixes #68872

4 years agoUpdate links
Michael Morehouse [Sat, 22 Feb 2020 11:49:52 +0000 (11:49 +0000)]
Update links

Formatting fixes

Now that I can actually run `python x.py test src/tools/tidy` locally
... my god it takes a long time to compile when you're on a cellular
connection.

Removing unnecessary whitespaces

Updates src/test/ui/json-short.stderr golden test file

Fixes test failure by updating the golden file for changes
in src/librustc_error_codes/error_codes/E0601.md

Update src/librustc_error_codes/error_codes/E0080.md

Co-Authored-By: varkor <github@varkor.com>
Update src/librustc_error_codes/error_codes/E0080.md

Co-Authored-By: varkor <github@varkor.com>
Update src/librustc_error_codes/error_codes/E0080.md

Co-Authored-By: varkor <github@varkor.com>
Update src/librustc_error_codes/error_codes/E0154.md

Co-Authored-By: varkor <github@varkor.com>
Update src/librustc_error_codes/error_codes/E0154.md

Co-Authored-By: varkor <github@varkor.com>
Update src/librustc_error_codes/error_codes/E0661.md

Co-Authored-By: varkor <github@varkor.com>
Update src/librustc_error_codes/error_codes/E0662.md

Co-Authored-By: varkor <github@varkor.com>
Update src/librustc_error_codes/error_codes/E0663.md

Co-Authored-By: varkor <github@varkor.com>
Update src/librustc_error_codes/error_codes/E0664.md

Co-Authored-By: varkor <github@varkor.com>
Update src/test/ui/json-short.stderr

Co-Authored-By: varkor <github@varkor.com>
Update src/librustc_error_codes/error_codes/E0260.md

Co-Authored-By: varkor <github@varkor.com>
Update src/librustc_error_codes/error_codes/E0154.md

Co-Authored-By: varkor <github@varkor.com>
Update src/librustc_error_codes/error_codes/E0260.md

Co-Authored-By: varkor <github@varkor.com>
Apply suggestions from code review

Co-Authored-By: varkor <github@varkor.com>
Fixing 1 character over 80 cascade

4 years agoClean up E0367 explanation
Guillaume Gomez [Sun, 23 Feb 2020 11:02:32 +0000 (12:02 +0100)]
Clean up E0367 explanation

4 years agoAuto merge of #69336 - Mark-Simulacrum:no-infra-toolstate, r=Dylan-DPC
bors [Sun, 23 Feb 2020 09:40:18 +0000 (09:40 +0000)]
Auto merge of #69336 - Mark-Simulacrum:no-infra-toolstate, r=Dylan-DPC

Do not ping the infrastructure team on toolstate changes

To my knowledge, there is essentially never any particular action that the infra team needs to take on these pings, and they are currently relatively annoying.

cc rust-lang/infra -- does anyone *want* these notifications?

4 years agoRollup merge of #69376 - petrochenkov:bumpwith, r=Centril
Dylan DPC [Sun, 23 Feb 2020 08:57:45 +0000 (09:57 +0100)]
Rollup merge of #69376 - petrochenkov:bumpwith, r=Centril

parser: Cleanup `Parser::bump_with` and its uses

Follow-up to https://github.com/rust-lang/rust/pull/69006.
r? @Centril

4 years agoRollup merge of #69375 - Menschenkindlein:master, r=Dylan-DPC
Dylan DPC [Sun, 23 Feb 2020 08:57:44 +0000 (09:57 +0100)]
Rollup merge of #69375 - Menschenkindlein:master, r=Dylan-DPC

Rename CodeMap to SourceMap follow up

See https://github.com/rust-lang/rust/issues/51574

4 years agoRollup merge of #69361 - Centril:free-ty-alias, r=petrochenkov
Dylan DPC [Sun, 23 Feb 2020 08:57:43 +0000 (09:57 +0100)]
Rollup merge of #69361 - Centril:free-ty-alias, r=petrochenkov

parse: allow `type Foo: Ord` syntactically

This addresses:
> (Work still remains to fuse this with free type aliases, but this can be done later.)

in https://github.com/rust-lang/rust/pull/69194.

r? @petrochenkov

4 years agoRollup merge of #69351 - mati865:mingw-ultimate-fix, r=cramertj
Dylan DPC [Sun, 23 Feb 2020 08:57:40 +0000 (09:57 +0100)]
Rollup merge of #69351 - mati865:mingw-ultimate-fix, r=cramertj

Improve external MinGW detection

Fixes #68872

4 years agoRollup merge of #69336 - Mark-Simulacrum:no-infra-toolstate, r=Dylan-DPC
Dylan DPC [Sun, 23 Feb 2020 08:57:38 +0000 (09:57 +0100)]
Rollup merge of #69336 - Mark-Simulacrum:no-infra-toolstate, r=Dylan-DPC

Do not ping the infrastructure team on toolstate changes

To my knowledge, there is essentially never any particular action that the infra team needs to take on these pings, and they are currently relatively annoying.

cc rust-lang/infra -- does anyone *want* these notifications?

4 years agoAuto merge of #69334 - Centril:nested-item-vis-def, r=petrochenkov
bors [Sun, 23 Feb 2020 06:27:07 +0000 (06:27 +0000)]
Auto merge of #69334 - Centril:nested-item-vis-def, r=petrochenkov

print vis & defaultness for nested items

Fixes https://github.com/rust-lang/rust/issues/69315 which was injected by https://github.com/rust-lang/rust/pull/69194.

r? @petrochenkov
cc @alexcrichton