]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoRename VariantKind -> Variant
Joshua Nelson [Fri, 15 Jan 2021 06:17:23 +0000 (01:17 -0500)]
Rename VariantKind -> Variant

There's no `Variant`, so it seems silly to have `Kind`.

3 years agoRemove useless `clean::Variant` struct
Joshua Nelson [Fri, 15 Jan 2021 02:42:59 +0000 (21:42 -0500)]
Remove useless `clean::Variant` struct

It had exactly one field and no special behavior, so there was no point.

3 years agoAuto merge of #80974 - ehuss:update-cargo, r=ehuss
bors [Fri, 15 Jan 2021 15:26:05 +0000 (15:26 +0000)]
Auto merge of #80974 - ehuss:update-cargo, r=ehuss

Update cargo

10 commits in 329895f5b52a358e5d9ecb26215708b5cb31d906..a73e5b7d567c3036b296fc6b33ed52c5edcd882e
2021-01-06 00:01:52 +0000 to 2021-01-12 23:45:39 +0000
- Sort available binaries when multiple (rust-lang/cargo#9066)
- Fix misspelling of environment variable (rust-lang/cargo#9067)
- Remove statement that opt-level 0 turns on debug (rust-lang/cargo#9070)
- Fix `links` vars showing up for testing packages (rust-lang/cargo#9065)
- Fix unit_for computation on proc-macros in shared workspace. (rust-lang/cargo#9059)
- Document `could not find the github team` error on `cargo owner --add` (rust-lang/cargo#9000)
- Unstable section of cargo/config.toml takes bools (rust-lang/cargo#9057)
- [doc] add note about empty environment variables for missing manifest keys (rust-lang/cargo#9053)
- another round of clippy lint fixes (rust-lang/cargo#9051)
- Updated display message of cargo metadata --help (rust-lang/cargo#9050)

3 years agoAuto merge of #80625 - jyn514:python-what-python, r=Mark-Simulacrum
bors [Fri, 15 Jan 2021 12:26:09 +0000 (12:26 +0000)]
Auto merge of #80625 - jyn514:python-what-python, r=Mark-Simulacrum

Choose the version of python at runtime (portable version)

r? `@Mark-Simulacrum`

Fixed version of https://github.com/rust-lang/rust/pull/80585. The goal is to avoid giving 'error: python3 required' when downloading LLVM from CI and instead default to python3 where possible.

This has some minor overhead when you have `python` as python2, but almost nothing compared to actually running the build.

3 years agoAuto merge of #81035 - JohnTitor:rollup-9m03awf, r=JohnTitor
bors [Fri, 15 Jan 2021 09:27:21 +0000 (09:27 +0000)]
Auto merge of #81035 - JohnTitor:rollup-9m03awf, r=JohnTitor

Rollup of 5 pull requests

Successful merges:

 - #80254 (Don't try to add nested predicate to Rustdoc auto-trait `ParamEnv`)
 - #80834 (Remove unreachable panics from VecDeque::{front/back}[_mut])
 - #80944 (Use Option::map_or instead of `.map(..).unwrap_or(..)`)
 - #81008 (Don't ICE when computing a layout of a generator tainted by errors)
 - #81023 (Remove doctree::Variant)

Failed merges:

 - #81033 (Remove useless `clean::Variant` struct)

r? `@ghost`
`@rustbot` modify labels: rollup

3 years agoRollup merge of #81023 - CraftSpider:rustdoc-remove-variant, r=jyn514
Yuki Okushi [Fri, 15 Jan 2021 09:26:18 +0000 (18:26 +0900)]
Rollup merge of #81023 - CraftSpider:rustdoc-remove-variant, r=jyn514

Remove doctree::Variant

This was easy, probably was missed when whatever used it was removed

3 years agoRollup merge of #81008 - tmiasko:generator-layout-err, r=tmandry
Yuki Okushi [Fri, 15 Jan 2021 09:26:16 +0000 (18:26 +0900)]
Rollup merge of #81008 - tmiasko:generator-layout-err, r=tmandry

Don't ICE when computing a layout of a generator tainted by errors

Fixes #80998.

3 years agoRollup merge of #80944 - LingMan:map_or, r=nagisa
Yuki Okushi [Fri, 15 Jan 2021 09:26:14 +0000 (18:26 +0900)]
Rollup merge of #80944 - LingMan:map_or, r=nagisa

Use Option::map_or instead of `.map(..).unwrap_or(..)`

``@rustbot`` modify labels +C-cleanup +T-compiler

3 years agoRollup merge of #80834 - bugadani:vecdeque, r=oli-obk
Yuki Okushi [Fri, 15 Jan 2021 09:26:11 +0000 (18:26 +0900)]
Rollup merge of #80834 - bugadani:vecdeque, r=oli-obk

Remove unreachable panics from VecDeque::{front/back}[_mut]

`VecDeque`'s `front`, `front_mut`, `back` and `back_mut` methods are implemented in terms of the index operator, which causes these functions to contain [unreachable panic calls](https://rust.godbolt.org/z/MTnq1o).

This PR reimplements these methods in terms of `get[_mut]` instead.

3 years agoRollup merge of #80254 - Aaron1011:rustdoc-auto-param-env, r=estebank
Yuki Okushi [Fri, 15 Jan 2021 09:26:04 +0000 (18:26 +0900)]
Rollup merge of #80254 - Aaron1011:rustdoc-auto-param-env, r=estebank

Don't try to add nested predicate to Rustdoc auto-trait `ParamEnv`

Fixes #80233

We already have logic in `evaluate_predicates` that tries to add
unimplemented predicates to our `ParamEnv`. Trying to add a predicate
that already holds can lead to errors later on, since projection
will prefer trait candidates from the `ParamEnv` to predicates from an
impl.

3 years agoAuto merge of #80993 - Aaron1011:collect-set-tokens, r=petrochenkov
bors [Fri, 15 Jan 2021 05:36:48 +0000 (05:36 +0000)]
Auto merge of #80993 - Aaron1011:collect-set-tokens, r=petrochenkov

Set tokens on AST node in `collect_tokens`

A new `HasTokens` trait is introduced, which is used to move logic from
the callers of `collect_tokens` into the body of `collect_tokens`.

In addition to reducing duplication, this paves the way for PR #80689,
which needs to perform additional logic during token collection.

3 years agoAuto merge of #81027 - Xanewok:update-rls, r=calebcartwright
bors [Fri, 15 Jan 2021 02:11:37 +0000 (02:11 +0000)]
Auto merge of #81027 - Xanewok:update-rls, r=calebcartwright

Update RLS and Rustfmt

Fixes #80576

Updates Rustfmt to use `rustfmt-v1.4.31` branch. Both are updated (along with `racer`) in tandem to pull in the exact same version of rustc-ap-* libraries.

r? `@calebcartwright`

3 years agoChoose the version of python at runtime (portable version)
Joshua Nelson [Fri, 1 Jan 2021 16:52:31 +0000 (11:52 -0500)]
Choose the version of python at runtime (portable version)

- Try `py -3` first for windows compatibility
- Fall back to `python3` if `py` doesn't work

3 years ago...and update Cargo.lock again
Igor Matuszewski [Fri, 15 Jan 2021 01:26:55 +0000 (02:26 +0100)]
...and update Cargo.lock again

3 years agoRemove local patch in Cargo.toml for rls-* crates
Igor Matuszewski [Fri, 15 Jan 2021 01:21:04 +0000 (02:21 +0100)]
Remove local patch in Cargo.toml for rls-* crates

3 years agoUpdate RLS and Rustfmt
Igor Matuszewski [Fri, 15 Jan 2021 00:50:59 +0000 (01:50 +0100)]
Update RLS and Rustfmt

3 years agoRemove doctree::Variant
Rune Tynan [Thu, 14 Jan 2021 20:21:44 +0000 (15:21 -0500)]
Remove doctree::Variant

3 years agoAuto merge of #81018 - m-ou-se:rollup-7202dc7, r=m-ou-se
bors [Thu, 14 Jan 2021 20:21:20 +0000 (20:21 +0000)]
Auto merge of #81018 - m-ou-se:rollup-7202dc7, r=m-ou-se

Rollup of 17 pull requests

Successful merges:

 - #79982 (Add missing methods to unix ExitStatusExt)
 - #80017 (Suggest `_` and `..` if a pattern has too few fields)
 - #80169 (Recommend panic::resume_unwind instead of panicking.)
 - #80217 (Add a `std::io::read_to_string` function)
 - #80444 (Add as_ref and as_mut methods for Bound)
 - #80567 (Add Iterator::intersperse_with)
 - #80829 (Get rid of `DepConstructor`)
 - #80895 (Fix handling of malicious Readers in read_to_end)
 - #80966 (Deprecate atomic::spin_loop_hint in favour of hint::spin_loop)
 - #80969 (Use better ICE message when no MIR is available)
 - #80972 (Remove unstable deprecated Vec::remove_item)
 - #80973 (Update books)
 - #80980 (Fixed incorrect doc comment)
 - #80981 (Fix -Cpasses=list and llvm version print with -vV)
 - #80985 (Fix stabilisation version of slice_strip)
 - #80990 (llvm: Remove the unused context from CreateDebugLocation)
 - #80991 (Fix formatting specifiers doc links)

Failed merges:

 - #80944 (Use Option::map_or instead of `.map(..).unwrap_or(..)`)

r? `@ghost`
`@rustbot` modify labels: rollup

3 years agoRemove unreachable panics from VecDeque
Dániel Buga [Sat, 9 Jan 2021 09:22:06 +0000 (10:22 +0100)]
Remove unreachable panics from VecDeque

3 years agoUse Option::map_or instead of `.map(..).unwrap_or(..)`
LingMan [Mon, 11 Jan 2021 19:45:33 +0000 (20:45 +0100)]
Use Option::map_or instead of `.map(..).unwrap_or(..)`

3 years agoRollup merge of #80991 - calebsander:fix/fmt-link, r=m-ou-se
Mara Bos [Thu, 14 Jan 2021 18:00:31 +0000 (18:00 +0000)]
Rollup merge of #80991 - calebsander:fix/fmt-link, r=m-ou-se

Fix formatting specifiers doc links

d36e3e23a80f039ee98117ebba0bb2ea6e34f0c1 seems to have inadvertently changed many of these links to point to `core::fmt` instead of `std::fmt`. The information about formatting specifiers is only documented in [`std::fmt`](https://doc.rust-lang.org/std/fmt/); [`core::fmt`](https://doc.rust-lang.org/core/fmt/) is empty. 3baf6a4a749bd6ac4a8b9f1054d3f2ad2fc91e45 seems to have already fixed a couple of these links to point back to `std::fmt`.

3 years agoRollup merge of #80990 - cuviper:unused-debug-context, r=nagisa
Mara Bos [Thu, 14 Jan 2021 18:00:29 +0000 (18:00 +0000)]
Rollup merge of #80990 - cuviper:unused-debug-context, r=nagisa

llvm: Remove the unused context from CreateDebugLocation

This went unused in commit 88d874de6395, part of #68965.

3 years agoRollup merge of #80985 - ijackson:slice-strip-fix, r=jyn514
Mara Bos [Thu, 14 Jan 2021 18:00:27 +0000 (18:00 +0000)]
Rollup merge of #80985 - ijackson:slice-strip-fix, r=jyn514

Fix stabilisation version of slice_strip

See https://github.com/rust-lang/rust/pull/77853#pullrequestreview-564921079

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoRollup merge of #80981 - bjorn3:bjorn3-patch-1, r=jonas-schievink
Mara Bos [Thu, 14 Jan 2021 18:00:25 +0000 (18:00 +0000)]
Rollup merge of #80981 - bjorn3:bjorn3-patch-1, r=jonas-schievink

Fix -Cpasses=list and llvm version print with -vV

cc https://github.com/rust-lang/rust/pull/77975#issuecomment-759362933

3 years agoRollup merge of #80980 - trevarj:patch-1, r=nagisa
Mara Bos [Thu, 14 Jan 2021 18:00:22 +0000 (18:00 +0000)]
Rollup merge of #80980 - trevarj:patch-1, r=nagisa

Fixed incorrect doc comment

">" is right alignment, not left

3 years agoRollup merge of #80973 - ehuss:update-books, r=ehuss
Mara Bos [Thu, 14 Jan 2021 18:00:20 +0000 (18:00 +0000)]
Rollup merge of #80973 - ehuss:update-books, r=ehuss

Update books

## nomicon

2 commits in a5a48441d411f61556b57d762b03d6874afe575d..a8584998eacdea7106a1dfafcbf6c1c06fcdf925
2020-12-06 10:39:41 +0900 to 2021-01-06 12:49:49 -0500
- Update vector code examples
- Remove outdated information about `jemalloc`

## reference

13 commits in b278478b766178491a8b6f67afa4bcd6b64d977a..50af691f838937c300b47812d0507c6d88c14f97
2020-12-21 18:18:03 -0800 to 2021-01-12 21:19:20 -0800
- Update grammar for parser unification. (rust-lang/reference#927)
- Define constraining an implementation (rust-lang/reference#928)
- Document extra behavior of #[no_mangle] (rust-lang/reference#930)
- Add a float examle without a `.`. (rust-lang/reference#929)
- Add more details about const generics. (rust-lang/reference#921)
- Fix footnotes. (rust-lang/reference#926)
- Add "Logic errors" as behavior not considered unsafe (rust-lang/reference#919)
- Update grammar for order of parameters/arguments. (rust-lang/reference#920)
- Fix formatting in the tuple section (rust-lang/reference#923)
- document const generics (rust-lang/reference#901)
- Update mdbook (rust-lang/reference#918)
- linkage.md: update link to FFI section of the Book. (rust-lang/reference#917)
- Document array expression with a const. (rust-lang/reference#914)

## book

8 commits in 5bb44f8b5b0aa105c8b22602e9b18800484afa21..ac57a0ddd23d173b26731ccf939f3ba729753275
2020-12-18 20:07:31 -0500 to 2021-01-09 14:18:45 -0500
- Update version of mdbook we're testing with to 0.4.5 (rust-lang/book#2561)
- Fix grammar in ch13-01-closures.md (rust-lang/book#2534)
- Merge remote-tracking branch 'origin/pr/2527'
- Clarify code example ch6.3 (rust-lang/book#2485)
- Fix link added in rust-lang/book#2495 to be relative and at the bottom
- Merge remote-tracking branch 'origin/pr/2495'
- Update output to match the updated poem punctuation
- Fix rust-lang/book#2539 - Remove fancy apostrophes from poem for Windows

## rust-by-example

3 commits in 1cce0737d6a7d3ceafb139b4a206861fb1dcb2ab..03e23af01f0b4f83a3a513da280e1ca92587f2ec
2020-12-21 17:36:29 -0300 to 2021-01-09 10:20:28 -0300
- Replace for loop with iteration (rust-lang/rust-by-example#1404)
- Update mdbook (rust-lang/rust-by-example#1402)
- Add note for match guards to include catch-all (rust-lang/rust-by-example#1401)

## embedded-book

1 commits in ba34b8a968f9531d38c4dc4411d5568b7c076bfe..ceec19e873be87c6ee5666b030c6bb612f889a96
2020-11-17 00:20:43 +0000 to 2021-01-03 13:13:10 +0000
- book.toml: add link to GitHub repo  (rust-embedded/book#276)

3 years agoRollup merge of #80972 - KodrAus:deprecate/remove_item, r=nagisa
Mara Bos [Thu, 14 Jan 2021 18:00:18 +0000 (18:00 +0000)]
Rollup merge of #80972 - KodrAus:deprecate/remove_item, r=nagisa

Remove unstable deprecated Vec::remove_item

Closes #40062

The `Vec::remove_item` method was deprecated in `1.46.0` (in August of 2020). This PR now removes that unstable method entirely.

3 years agoRollup merge of #80969 - camelid:monomorph-ice-msg, r=nagisa
Mara Bos [Thu, 14 Jan 2021 18:00:16 +0000 (18:00 +0000)]
Rollup merge of #80969 - camelid:monomorph-ice-msg, r=nagisa

Use better ICE message when no MIR is available

The ICE message is somewhat confusing and overly specific - the issue is
that there's no MIR available.

This should make debugging these ICEs easier since the error tells you
what's actually wrong, not what it was trying to do when it failed.

cc https://github.com/rust-lang/rust/pull/80952#issuecomment-759198841
cc `````@jyn514`````

3 years agoRollup merge of #80966 - KodrAus:deprecate/spin_loop_hint, r=m-ou-se
Mara Bos [Thu, 14 Jan 2021 18:00:14 +0000 (18:00 +0000)]
Rollup merge of #80966 - KodrAus:deprecate/spin_loop_hint, r=m-ou-se

Deprecate atomic::spin_loop_hint in favour of hint::spin_loop

For https://github.com/rust-lang/rust/issues/55002

We wanted to leave `atomic::spin_loop_hint` alone when stabilizing `hint::spin_loop` so folks had some time to migrate. This now deprecates `atomic_spin_loop_hint`.

3 years agoRollup merge of #80895 - sfackler:read-to-end-ub, r=m-ou-se
Mara Bos [Thu, 14 Jan 2021 18:00:11 +0000 (18:00 +0000)]
Rollup merge of #80895 - sfackler:read-to-end-ub, r=m-ou-se

Fix handling of malicious Readers in read_to_end

A malicious `Read` impl could return overly large values from `read`, which would result in the guard's drop impl setting the buffer's length to greater than its capacity! ~~To fix this, the drop impl now uses the safe `truncate` function instead of `set_len` which ensures that this will not happen. The result of calling the function will be nonsensical, but that's fine given the contract violation of the `Read` impl.~~

~~The `Guard` type is also used by `append_to_string` which does not pass untrusted values into the length field, so I've copied the guard type into each function and only modified the one used by `read_to_end`. We could just keep a single one and modify it, but it seems a bit cleaner to keep the guard code close to the functions and related specifically to them.~~

To fix this, we now assert that the returned length is not larger than the buffer passed to the method.

For reference, this bug has been present for ~2.5 years since 1.20: https://github.com/rust-lang/rust/commit/ecbb896b9eb2acadefde57be493e4298c1aa04a3.

Closes #80894.

3 years agoRollup merge of #80829 - jyn514:dep-constructor, r=michaelwoerister
Mara Bos [Thu, 14 Jan 2021 18:00:09 +0000 (18:00 +0000)]
Rollup merge of #80829 - jyn514:dep-constructor, r=michaelwoerister

Get rid of `DepConstructor`

This removes fully 235 unused functions.

Follow-up to https://github.com/rust-lang/rust/pull/80325#discussion_r548491999.

r? ``@michaelwoerister``
cc ``@cjgillot``

3 years agoRollup merge of #80567 - lukaslueg:intersperse_with, r=m-ou-se
Mara Bos [Thu, 14 Jan 2021 18:00:06 +0000 (18:00 +0000)]
Rollup merge of #80567 - lukaslueg:intersperse_with, r=m-ou-se

Add Iterator::intersperse_with

This is a follow-up to #79479, tracking in #79524, as discussed https://github.com/rust-lang/rust/pull/79479#issuecomment-752671731.

~~Note that I had to manually implement `Clone` and `Debug` because `derive` insists on placing a `Clone`-bound on the struct-definition, which is too narrow. There is a long-standing issue # for this somewhere around here :-)~~

Also, note that I refactored the guts of `Intersperse` into private functions and re-used them in `IntersperseWith`, so I also went light on duplicating all the tests.

If this is suitable to be merged, the tracking issue should be updated, since it only mentions `intersperse`.

Happy New Year!

r? ``@m-ou-se``

3 years agoRollup merge of #80444 - glittershark:bound-as-ref, r=dtolnay
Mara Bos [Thu, 14 Jan 2021 18:00:02 +0000 (18:00 +0000)]
Rollup merge of #80444 - glittershark:bound-as-ref, r=dtolnay

Add as_ref and as_mut methods for Bound

Add as_ref and as_mut method for std::ops::range::Bound, patterned off
of the methods of the same name on Option.

I'm not quite sure what the process is for introducing new feature gates (this is my first contribution) so I've left these ungated, but happy to do whatever is necessary to gate them.

3 years agoRollup merge of #80217 - camelid:io-read_to_string, r=m-ou-se
Mara Bos [Thu, 14 Jan 2021 18:00:00 +0000 (18:00 +0000)]
Rollup merge of #80217 - camelid:io-read_to_string, r=m-ou-se

Add a `std::io::read_to_string` function

I recognize that you're usually supposed to open an issue first, but the
implementation is very small so it's okay if this is closed and it was 'wasted
work' :)

-----

The equivalent of `std::fs::read_to_string`, but generalized to all
`Read` impls.

As the documentation on `std::io::read_to_string` says, the advantage of
this function is that it means you don't have to create a variable first
and it provides more type safety since you can only get the buffer out
if there were no errors. If you use `Read::read_to_string`, you have to
remember to check whether the read succeeded because otherwise your
buffer will be empty.

It's friendlier to newcomers and better in most cases to use an explicit
return value instead of an out parameter.

3 years agoRollup merge of #80169 - frewsxcv:frewsxcv-docs-fix, r=jyn514
Mara Bos [Thu, 14 Jan 2021 17:59:57 +0000 (17:59 +0000)]
Rollup merge of #80169 - frewsxcv:frewsxcv-docs-fix, r=jyn514

Recommend panic::resume_unwind instead of panicking.

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

3 years agoRollup merge of #80017 - camelid:sugg-rest-pattern, r=estebank
Mara Bos [Thu, 14 Jan 2021 17:59:55 +0000 (17:59 +0000)]
Rollup merge of #80017 - camelid:sugg-rest-pattern, r=estebank

Suggest `_` and `..` if a pattern has too few fields

Fixes #80010.

3 years agoRollup merge of #79982 - ijackson:exit-status, r=dtolnay
Mara Bos [Thu, 14 Jan 2021 17:59:53 +0000 (17:59 +0000)]
Rollup merge of #79982 - ijackson:exit-status, r=dtolnay

Add missing methods to unix ExitStatusExt

These are the methods corresponding to the remaining exit status examination macros from `wait.h`.  `WCOREDUMP` isn't in SuS but is it is very standard.  I have not done portability testing to see if this builds everywhere, so I may need to Do Something if it doesn't.

There is also a bugfix and doc improvement to `.signal()`, and an `.into_raw()` accessor.

This would fix #73128 and fix #73129.  Please let me know if you like this direction, and if so I will open the tracking issue and so on.

If this MR goes well, I may tackle #73125 next - I have an idea for how to do it.

3 years agoAuto merge of #79689 - Vooblin:patch1, r=tmandry
bors [Thu, 14 Jan 2021 17:27:15 +0000 (17:27 +0000)]
Auto merge of #79689 - Vooblin:patch1, r=tmandry

Update tests of "unused_lifetimes" lint for async functions and corresponding source code

Before this PR the following code would cause an error:
```
#![deny(unused_lifetimes)]
async fn f<'a>(_: &'a i32) {}
fn main() {}
```
It was happening because of the desugaring of return type in async functions. As a result of the desugaring, the return type contains all lifetimes involved in the function signature. And these lifetimes were interpreted separately from the same in the function scope => so they are unused.

Now, all lifetimes from the return type are interpreted as used. It is also not perfect, but at least this lint doesn't cause wrong errors now.

This PR connected to issues #78522, #77217

3 years agoAuto merge of #79328 - c410-f3r:hir-if, r=matthewjasper
bors [Thu, 14 Jan 2021 14:41:58 +0000 (14:41 +0000)]
Auto merge of #79328 - c410-f3r:hir-if, r=matthewjasper

Reintroduce hir::ExprKind::If

Basically copied and paste #59288/https://github.com/rust-lang/rust-clippy/pull/4080 with some modifications.

The vast majority of tests were fixed and now there are only a few remaining. Since I am still unable to figure out the missing pieces, any help with the following list is welcome.

- [ ] **Unnecessary `typeck` exception**: [Cheated on this one to make CI green.](https://github.com/rust-lang/rust/pull/79328/files#diff-3faee9ba23fc54a12b7c43364ba81f8c5660045c7e1d7989a02a0cee1c5b2051)
- [x] **Incorrect span**: [Span should reference `then` and `else` separately.](https://github.com/rust-lang/rust/pull/79328/files#diff-cf2c46e82222ee4b1037a68fff8a1af3c4f1de7a6b3fd798aacbf3c0475abe3d)
- [x] **New note regarding `assert!`**: [Modified but not "wrong". Maybe can be a good thing?](https://github.com/rust-lang/rust/pull/79328/files#diff-9e0d7c89ed0224e2b62060c957177c27db43c30dfe3c2974cb6b5091cda9cfb5)
- [x] **Inverted report location**: [Modified but not "wrong". Locations were inverted.](https://github.com/rust-lang/rust/pull/79328/files#diff-f637ce7c1f68d523a165aa9651765df05e36c4d7d279194b1a6b28b48a323691)
- [x] **`src/test/ui/point-to-type-err-cause-on-impl-trait-return.rs` has weird errors**: [Not sure why this is happening.](https://github.com/rust-lang/rust/pull/79328/files#diff-c823c09660f5b112f95e97e8ff71f1797b6c7f37dbb3d16f8e98bbaea8072e95)
- [x] **Missing diagnostic**: [???](https://github.com/rust-lang/rust/pull/79328/files#diff-6b8ab09360d725ba4513933827f9796b42ff9522b0690f80b76de067143af2fc)

3 years agoDon't ICE when computing a layout of a generator tainted by errors
Tomasz Miąsko [Thu, 14 Jan 2021 00:00:00 +0000 (00:00 +0000)]
Don't ICE when computing a layout of a generator tainted by errors

3 years agoAuto merge of #81003 - tmiasko:generator-layout, r=oli-obk
bors [Thu, 14 Jan 2021 11:58:17 +0000 (11:58 +0000)]
Auto merge of #81003 - tmiasko:generator-layout, r=oli-obk

Encode optimized MIR of generators when emitting metadata

3 years agoAuto merge of #78259 - plaflamme:fix-49660, r=KodrAus
bors [Thu, 14 Jan 2021 08:46:55 +0000 (08:46 +0000)]
Auto merge of #78259 - plaflamme:fix-49660, r=KodrAus

Fix #49660 - Adds checks to ensure existence of arithmetic trait implementations

The first 2 commits fix an issue with the existing `wrapping.rs` tests. It wasn't referred to from the module, so the file was being ignored. This is fixed in https://github.com/rust-lang/rust/pull/78259/commits/872dc60ed203d16d43140c1d1623474cf8a9aedc This surfaced a bug in its macro which is fixed in https://github.com/rust-lang/rust/pull/78259/commits/8ddad18283e304753e09ef651209b4a6b54148b0

Lastly, commit https://github.com/rust-lang/rust/pull/78259/commits/64d695b753bfe09797b5f95c7b9b72948da01710 is the actual tests for fixing #49660

The following checks are done:

* `Add`, `Sub`, `Mul`, `Div`, `Rem`
  * `T op T`, `T op &T`, `&T op T` and `&T op &T`
  * for all integer and floating point types
* `AddAssign`, `SubAssign`, `MulAssign`, `DivAssign`, `RemAssign`
  * `&mut T op T` and `&mut T op &T`
  * for all integer and floating point types
* `Neg`
  * `op T` and `op &T`
  * for all signed integer and floating point types
* `Not`
  * `op T` and `op &T`
  * for `bool`
* `BitAnd`, `BitOr`, `BitXor`
  * `T op T`, `T op &T`, `&T op T` and `&T op &T`
  * for all integer types and bool
* `BitAndAssign`, `BitOrAssign`, `BitXorAssign`
  * `&mut T op T` and `&mut T op &T`
  * for all integer types and bool
* `Shl`, `Shr`
  * `L op R`, `L op &R`, `&L op R` and `&L op &R`
  * for all pairs of integer types
* `ShlAssign`, `ShrAssign`
  * `&mut L op R`, `&mut L op &R`
  * for all pairs of integer types

NOTE: I'd like some feedback on improving the macros. I'm not familiar with the idioms and patterns there and composing them has been a challenge for me.

[EDIT]: updated links to commits after rebase.

3 years agoFix typos in Fuchsia unix_process_wait_more
David Tolnay [Thu, 14 Jan 2021 06:13:45 +0000 (22:13 -0800)]
Fix typos in Fuchsia unix_process_wait_more

3 years agoAdds tests to ensure some base op traits exist.
Philippe Laflamme [Fri, 23 Oct 2020 03:52:07 +0000 (23:52 -0400)]
Adds tests to ensure some base op traits exist.

These tests invoke the various op traits using all accepted types they
are implemented for as well as for references to those types.

This fixes #49660 and ensures the following implementations exist:

* `Add`, `Sub`, `Mul`, `Div`, `Rem`
  * `T op T`, `T op &T`, `&T op T` and `&T op &T`
  * for all integer and floating point types
* `AddAssign`, `SubAssign`, `MulAssign`, `DivAssign`, `RemAssign`
  * `&mut T op T` and `&mut T op &T`
  * for all integer and floating point types
* `Neg`
  * `op T` and `op &T`
  * for all signed integer and floating point types
* `Not`
  * `op T` and `op &T`
  * for `bool`
* `BitAnd`, `BitOr`, `BitXor`
  * `T op T`, `T op &T`, `&T op T` and `&T op &T`
  * for all integer types and bool
* `BitAndAssign`, `BitOrAssign`, `BitXorAssign`
  * `&mut T op T` and `&mut T op &T`
  * for all integer types and bool
* `Shl`, `Shr`
  * `L op R`, `L op &R`, `&L op R` and `&L op &R`
  * for all pairs of integer types
* `ShlAssign`, `ShrAssign`
  * `&mut L op R`, `&mut L op &R`
  * for all pairs of integer types

3 years agoAvoid ident concatenation in macro.
Philippe Laflamme [Thu, 22 Oct 2020 03:02:20 +0000 (23:02 -0400)]
Avoid ident concatenation in macro.

AFAIK it isn't currently possible to do this. It is also more in line with other tests in the surrounding modules.

3 years agoFix missing mod declaration for Wrapping tests.
Philippe Laflamme [Thu, 22 Oct 2020 02:13:56 +0000 (22:13 -0400)]
Fix missing mod declaration for Wrapping tests.

3 years agoSet tokens on AST node in `collect_tokens`
Aaron Hill [Wed, 13 Jan 2021 21:28:57 +0000 (16:28 -0500)]
Set tokens on AST node in `collect_tokens`

A new `HasTokens` trait is introduced, which is used to move logic from
the callers of `collect_tokens` into the body of `collect_tokens`.

In addition to reducing duplication, this paves the way for PR #80689,
which needs to perform additional logic during token collection.

3 years agoAuto merge of #80802 - jyn514:box-attributes, r=nnethercote
bors [Thu, 14 Jan 2021 02:26:46 +0000 (02:26 +0000)]
Auto merge of #80802 - jyn514:box-attributes, r=nnethercote

Box Item::Attributes

This reduces the size of Item from 128 to 40 bytes. I think this is as small as it needs to get :tada:

Builds on https://github.com/rust-lang/rust/pull/80339 and should not be merged before.

r? `@GuillaumeGomez`

3 years agoAdd as_ref and as_mut methods for Bound
Griffin Smith [Mon, 28 Dec 2020 16:41:52 +0000 (11:41 -0500)]
Add as_ref and as_mut methods for Bound

Add as_ref and as_mut method for std::ops::range::Bound, patterned off
of the methods of the same name on Option.

3 years agoEncode optimized MIR of generators when emitting metadata
Tomasz Miąsko [Thu, 14 Jan 2021 00:00:00 +0000 (00:00 +0000)]
Encode optimized MIR of generators when emitting metadata

3 years agoAuto merge of #80654 - Aaron1011:fix/dummy-span-ctxt, r=wesleywiser
bors [Wed, 13 Jan 2021 23:24:31 +0000 (23:24 +0000)]
Auto merge of #80654 - Aaron1011:fix/dummy-span-ctxt, r=wesleywiser

Properly handle `SyntaxContext` of dummy spans in incr comp

Fixes #80336

Due to macro expansion, we may end up with spans with an invalid
location and non-root `SyntaxContext`. This commits preserves the
`SyntaxContext` of such spans in the incremental cache, and ensures
that we always hash the `SyntaxContext` when computing the `Fingerprint`
of a `Span`

Previously, we would discard the `SyntaxContext` during serialization to
the incremental cache, causing the span's `Fingerprint` to change across
compilation sessions.

3 years agoAuto merge of #77524 - Patryk27:fixes/66228, r=estebank
bors [Wed, 13 Jan 2021 20:35:58 +0000 (20:35 +0000)]
Auto merge of #77524 - Patryk27:fixes/66228, r=estebank

Rework diagnostics for wrong number of generic args (fixes #66228 and #71924)

This PR reworks the `wrong number of {} arguments` message, so that it provides more details and contextual hints.

3 years agoProperly handle `SyntaxContext` of dummy spans in incr comp
Aaron Hill [Sun, 3 Jan 2021 15:09:32 +0000 (10:09 -0500)]
Properly handle `SyntaxContext` of dummy spans in incr comp

Fixes #80336

Due to macro expansion, we may end up with spans with an invalid
location and non-root `SyntaxContext`. This commits preserves the
`SyntaxContext` of such spans in the incremental cache, and ensures
that we always hash the `SyntaxContext` when computing the `Fingerprint`
of a `Span`

Previously, we would discard the `SyntaxContext` during serialization to
the incremental cache, causing the span's `Fingerprint` to change across
compilation sessions.

3 years agoImprove Iterator::intersperse_ docs
Lukas Lueg [Wed, 13 Jan 2021 20:07:59 +0000 (21:07 +0100)]
Improve Iterator::intersperse_ docs

3 years agoFix formatting specifiers doc link
Caleb Sander [Wed, 13 Jan 2021 20:05:39 +0000 (15:05 -0500)]
Fix formatting specifiers doc link

Was incorrectly linked to `core::fmt`, which is empty, in d36e3e23a80f039ee98117ebba0bb2ea6e34f0c1
Some of the links were fixed already in 3baf6a4a749bd6ac4a8b9f1054d3f2ad2fc91e45

3 years agoRemove the unused context from CreateDebugLocation
Josh Stone [Wed, 13 Jan 2021 19:55:49 +0000 (11:55 -0800)]
Remove the unused context from CreateDebugLocation

This went unused in commit 88d874de6395, part of #68965.

3 years agoAdd doc intralinks
Lukas Lueg [Wed, 13 Jan 2021 18:47:41 +0000 (19:47 +0100)]
Add doc intralinks

3 years agoAuto merge of #80718 - tmiasko:skip-opt-mir, r=oli-obk
bors [Wed, 13 Jan 2021 17:48:41 +0000 (17:48 +0000)]
Auto merge of #80718 - tmiasko:skip-opt-mir, r=oli-obk

Consistently avoid constructing optimized MIR when not doing codegen

The optimized MIR for closures is being encoded unconditionally, while
being unnecessary for cargo check. This turns out to be especially
costly with MIR inlining enabled, since it triggers computation of
optimized MIR for all callees that are being examined for inlining
purposes https://github.com/rust-lang/rust/pull/77307#issuecomment-751915450.

Skip encoding of optimized MIR for closures, enum constructors, struct
constructors, and trait fns when not doing codegen, like it is already
done for other items since 49433.

3 years agoFix stabilisation version of slice_strip
Ian Jackson [Wed, 13 Jan 2021 14:21:18 +0000 (14:21 +0000)]
Fix stabilisation version of slice_strip

See https://github.com/rust-lang/rust/pull/77853#pullrequestreview-564921079

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoAuto merge of #76219 - Mark-Simulacrum:extern-require-abi, r=estebank
bors [Wed, 13 Jan 2021 13:56:15 +0000 (13:56 +0000)]
Auto merge of #76219 - Mark-Simulacrum:extern-require-abi, r=estebank

Add allow-by-default lint on implicit ABI in extern function pointers and items

This adds a new lint, missing_abi, which lints on omitted ABIs on extern blocks, function declarations, and function pointers.

It is currently not emitting the best possible diagnostics -- we need to track the span of "extern" at least or do some heuristic searching based on the available spans -- but seems good enough for an initial pass than can be expanded in future PRs.

This is a pretty large PR, but mostly due to updating a large number of tests to include ABIs; I can split that into a separate PR if it would be helpful, but test updates are already in dedicated commits.

3 years agoExitStatusExt: Fix build on Fuchsia
Ian Jackson [Wed, 13 Jan 2021 11:17:41 +0000 (11:17 +0000)]
ExitStatusExt: Fix build on Fuchsia

This is not particularly pretty but the current situation is a mess
and I don't think I'm making it significantly worse.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoFix typo saeled -> sealed
David Tolnay [Mon, 11 Jan 2021 02:11:00 +0000 (18:11 -0800)]
Fix typo saeled -> sealed

3 years agoExitStatusExt windows: Retrospectively seal this trait
Ian Jackson [Mon, 4 Jan 2021 17:45:23 +0000 (17:45 +0000)]
ExitStatusExt windows: Retrospectively seal this trait

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoExitStatusExt unix: Retrospectively seal this trait
Ian Jackson [Mon, 4 Jan 2021 17:11:41 +0000 (17:11 +0000)]
ExitStatusExt unix: Retrospectively seal this trait

As discussed in #79982.

I think the "new interfaces", ie the new trait and impl, must be
insta-stable.  This seems OK because we are, in fact, adding a new
restriction to the stable API.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agounix ExitStatus: Add tracking issue to new methods
Ian Jackson [Mon, 4 Jan 2021 17:37:34 +0000 (17:37 +0000)]
unix ExitStatus: Add tracking issue to new methods

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoReplace `Ie` with `In other words`
Ian Jackson [Sun, 13 Dec 2020 11:03:37 +0000 (11:03 +0000)]
Replace `Ie` with `In other words`

Co-authored-by: Joshua Nelson <joshua@yottadb.com>
3 years agoReplace `Ie` with `In other words`
Ian Jackson [Sun, 13 Dec 2020 11:03:17 +0000 (11:03 +0000)]
Replace `Ie` with `In other words`

Co-authored-by: Joshua Nelson <joshua@yottadb.com>
3 years agounix ExitStatus: Provide .continued()
Ian Jackson [Sat, 12 Dec 2020 21:52:17 +0000 (21:52 +0000)]
unix ExitStatus: Provide .continued()

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agounix ExitStatus: Provide .stopped_signal()
Ian Jackson [Sat, 12 Dec 2020 21:47:47 +0000 (21:47 +0000)]
unix ExitStatus: Provide .stopped_signal()

Necessary to handle WIFSTOPPED.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agounix ExitStatus: Provide .core_dumped
Ian Jackson [Sat, 12 Dec 2020 21:44:13 +0000 (21:44 +0000)]
unix ExitStatus: Provide .core_dumped

This is essential for proper reporting of child process status on Unix.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agounix ExitStatus: Provide .into_raw()
Ian Jackson [Sat, 12 Dec 2020 21:41:55 +0000 (21:41 +0000)]
unix ExitStatus: Provide .into_raw()

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agounix ExitStatus: Clarify docs for .signal()
Ian Jackson [Sat, 12 Dec 2020 21:37:34 +0000 (21:37 +0000)]
unix ExitStatus: Clarify docs for .signal()

We need to be clear that this never returns WSTOPSIG.  That is, if
WIFSTOPPED, the return value is None.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agounix ExitStatus: Do not treat WIFSTOPPED as WIFSIGNALED
Ian Jackson [Sat, 12 Dec 2020 21:31:54 +0000 (21:31 +0000)]
unix ExitStatus: Do not treat WIFSTOPPED as WIFSIGNALED

A unix wait status can contain, at least, exit statuses, termination
signals, and stop signals.

WTERMSIG is only valid if WIFSIGNALED.

https://pubs.opengroup.org/onlinepubs/9699919799/functions/wait.html

It will not be easy to experience this bug with `Command`, because
that doesn't pass WUNTRACED.  But you could make an ExitStatus
containing, say, a WIFSTOPPED, from a call to one of the libc wait
functions.

(In the WIFSTOPPED case, there is WSTOPSIG.  But a stop signal is
encoded differently to a termination signal, so WTERMSIG and WSTOPSIG
are by no means the same.)

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoUpdate code to account for extern ABI requirement
Mark Rousskov [Tue, 1 Sep 2020 21:28:11 +0000 (17:28 -0400)]
Update code to account for extern ABI requirement

3 years agoLint on extern in item declaration position
Mark Rousskov [Tue, 1 Sep 2020 21:21:54 +0000 (17:21 -0400)]
Lint on extern in item declaration position

3 years agoUpdate tests for extern block linting
Mark Rousskov [Tue, 1 Sep 2020 21:12:52 +0000 (17:12 -0400)]
Update tests for extern block linting

3 years agoIntroduce missing ABI lint on extern blocks
Mark Rousskov [Tue, 1 Sep 2020 21:12:38 +0000 (17:12 -0400)]
Introduce missing ABI lint on extern blocks

3 years agoFix -Cpasses=list and llvm version print with -vV
bjorn3 [Wed, 13 Jan 2021 11:15:42 +0000 (12:15 +0100)]
Fix -Cpasses=list and llvm version print with -vV

3 years agoAuto merge of #80824 - cuviper:heap-clones, r=kennytm
bors [Wed, 13 Jan 2021 11:11:34 +0000 (11:11 +0000)]
Auto merge of #80824 - cuviper:heap-clones, r=kennytm

Try to avoid locals when cloning into Box/Rc/Arc

For generic `T: Clone`, we can allocate an uninitialized box beforehand,
which gives the optimizer a chance to create the clone directly in the
heap. For `T: Copy`, we can go further and do a simple memory copy,
regardless of optimization level.

The same applies to `Rc`/`Arc::make_mut` when they must clone the data.

3 years agoFixed incorrect doc comment
trevor arjeski [Wed, 13 Jan 2021 10:49:46 +0000 (13:49 +0300)]
Fixed incorrect doc comment

">" is right alignment, not left

3 years agoAuto merge of #77858 - ijackson:split-inclusive, r=KodrAus
bors [Wed, 13 Jan 2021 07:38:58 +0000 (07:38 +0000)]
Auto merge of #77858 - ijackson:split-inclusive, r=KodrAus

Stabilize split_inclusive

### Contents of this MR

This stabilises:

 * `slice::split_inclusive`
 * `slice::split_inclusive_mut`
 * `str::split_inclusive`

Closes #72360.

### A possible concern

The proliferation of `split_*` methods is not particularly pretty.  The existence of `split_inclusive` seems to invite the addition of `rsplit_inclusive`, `splitn_inclusive`, etc.  We could instead have a more general API, along these kinds of lines maybe:
```
   pub fn split_generic('a,P,H>(&'a self, pat: P, how: H) -> ...
       where P: Pattern
       where H: SplitHow;

   pub fn split_generic_mut('a,P,H>(&'a mut self, pat: P, how: H) -> ...
       where P: Pattern
       where H: SplitHow;

   trait SplitHow {
       fn reverse(&self) -> bool;
       fn inclusive -> bool;
       fn limit(&self) -> Option<usize>;
   }

   pub struct SplitFwd;
   ...
   pub struct SplitRevInclN(pub usize);
```
But maybe that is worse.

### Let us defer that? ###

This seems like a can of worms.  I think we can defer opening it now; if and when we have something more general, these two methods can become convenience aliases.  But I thought I would mention it so the lang API team can consider it and have an opinion.

3 years agodeprecate atomic::spin_loop_hint in favour of hint::spin_loop
Ashley Mannix [Wed, 13 Jan 2021 04:39:19 +0000 (14:39 +1000)]
deprecate atomic::spin_loop_hint in favour of hint::spin_loop

3 years agoInclude `..` suggestion if fields are all wildcards
Camelid [Wed, 13 Jan 2021 04:39:51 +0000 (20:39 -0800)]
Include `..` suggestion if fields are all wildcards

3 years agoUpdate books
Eric Huss [Wed, 13 Jan 2021 04:42:46 +0000 (20:42 -0800)]
Update books

3 years agoremove unstable deprecated Vec::remove_item
Ashley Mannix [Wed, 13 Jan 2021 05:14:11 +0000 (15:14 +1000)]
remove unstable deprecated Vec::remove_item

3 years agoUse better ICE message when no MIR is available
Camelid [Wed, 13 Jan 2021 04:52:06 +0000 (20:52 -0800)]
Use better ICE message when no MIR is available

The ICE message is somewhat confusing and overly specific - the issue is
that there's no MIR available.

This should make debugging these ICEs easier since the error tells you
what's actually wrong, not what it was trying to do when it failed.

cc https://github.com/rust-lang/rust/pull/80952#issuecomment-759198841

3 years agoAuto merge of #80960 - Dylan-DPC:rollup-89tri8x, r=Dylan-DPC
bors [Wed, 13 Jan 2021 04:29:45 +0000 (04:29 +0000)]
Auto merge of #80960 - Dylan-DPC:rollup-89tri8x, r=Dylan-DPC

Rollup of 10 pull requests

Successful merges:

 - #78901 (diagnostics: Note capturing closures can't be coerced to fns)
 - #79588 (Provide more information for HRTB lifetime errors involving closures)
 - #80232 (Remove redundant def_id lookups)
 - #80662 (Added support for i386-unknown-linux-gnu and i486-unknown-linux-gnu)
 - #80736 (use Once instead of Mutex to manage capture resolution)
 - #80796 (Update to LLVM 11.0.1)
 - #80859 (Fix --pretty=expanded with --remap-path-prefix)
 - #80922 (Revert "Auto merge of #76896 - spastorino:codegen-inline-fns2)
 - #80924 (Fix rustdoc --test-builder argument parsing)
 - #80935 (Rename `rustc_middle::lint::LevelSource` to `LevelAndSource`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

3 years agobump split_inclusive stabilization to 1.51.0
Ashley Mannix [Wed, 13 Jan 2021 03:51:37 +0000 (13:51 +1000)]
bump split_inclusive stabilization to 1.51.0

3 years agobump split_inclusive stabilization to 1.51.0
Ashley Mannix [Wed, 13 Jan 2021 03:50:39 +0000 (13:50 +1000)]
bump split_inclusive stabilization to 1.51.0

3 years agobump split_inclusive stabilization to 1.51.0
Ashley Mannix [Wed, 13 Jan 2021 03:49:34 +0000 (13:49 +1000)]
bump split_inclusive stabilization to 1.51.0

3 years agobump split_inclusive stabilization to 1.51.0
Ashley Mannix [Wed, 13 Jan 2021 03:48:36 +0000 (13:48 +1000)]
bump split_inclusive stabilization to 1.51.0

3 years agoUpdate cargo
Eric Huss [Wed, 13 Jan 2021 03:46:42 +0000 (19:46 -0800)]
Update cargo

3 years agoAlways show suggestions in their own subwindows
Camelid [Wed, 13 Jan 2021 03:06:20 +0000 (19:06 -0800)]
Always show suggestions in their own subwindows

3 years agoAdd a test case with lots of whitespace
Camelid [Wed, 13 Jan 2021 00:47:04 +0000 (16:47 -0800)]
Add a test case with lots of whitespace

3 years agoOnly suggest `..` if more than one field is missing
Camelid [Sun, 20 Dec 2020 22:43:07 +0000 (14:43 -0800)]
Only suggest `..` if more than one field is missing

3 years agoSpecialize `..` help message for all fields vs. the rest
Camelid [Sat, 19 Dec 2020 04:17:09 +0000 (20:17 -0800)]
Specialize `..` help message for all fields vs. the rest

3 years agoPluralize 'parenthesis' correctly
Camelid [Sat, 19 Dec 2020 03:56:14 +0000 (19:56 -0800)]
Pluralize 'parenthesis' correctly

It's 'parentheses', not 'parenthesis', when you have more than one.

3 years agoSuggest `Variant(..)` if all of the mentioned fields are `_`
Camelid [Sat, 19 Dec 2020 03:51:39 +0000 (19:51 -0800)]
Suggest `Variant(..)` if all of the mentioned fields are `_`

3 years agoSimplify code
Camelid [Sat, 19 Dec 2020 01:09:53 +0000 (17:09 -0800)]
Simplify code

Co-authored-by: Esteban Kuber <estebank@users.noreply.github.com>
3 years agoSuggest `_` and `..` if a pattern has too few fields
Camelid [Sun, 13 Dec 2020 22:13:52 +0000 (14:13 -0800)]
Suggest `_` and `..` if a pattern has too few fields

For example, this code:

    struct S(i32, f32);

    let S(x) = S(0, 1.0);

will make the compiler suggest either:

    let S(x, _) = S(0, 1.0);

or:

    let S(x, ..) = S(0, 1.0);