]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoAuto merge of #86867 - JohnTitor:convert-to-actual-assert, r=jackh726
bors [Mon, 5 Jul 2021 02:05:04 +0000 (02:05 +0000)]
Auto merge of #86867 - JohnTitor:convert-to-actual-assert, r=jackh726

Convert `debug_assert!` to `assert!` in `Binder::dummy`

This is needed for #85350 not to be passed.
r? `@jackh726`

2 years agoAuto merge of #86875 - JohnTitor:rollup-fuefamw, r=JohnTitor
bors [Sun, 4 Jul 2021 22:23:06 +0000 (22:23 +0000)]
Auto merge of #86875 - JohnTitor:rollup-fuefamw, r=JohnTitor

Rollup of 8 pull requests

Successful merges:

 - #86477 (E0716: clarify that equivalent code example is erroneous)
 - #86623 (Add check to ensure error code explanations are not removed anymore even if not emitted)
 - #86856 (Make x.py less verbose on failures)
 - #86858 (Stabilize `string_drain_as_str`)
 - #86859 (Add a regression test for issue-69323)
 - #86862 (re-export SwitchIntEdgeEffects)
 - #86864 (Add missing code example for Write::write_vectored)
 - #86874 (Bump deps)

Failed merges:

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

2 years agoRollup merge of #86874 - klensy:bump-deps, r=Mark-Simulacrum
Yuki Okushi [Sun, 4 Jul 2021 22:13:29 +0000 (07:13 +0900)]
Rollup merge of #86874 - klensy:bump-deps, r=Mark-Simulacrum

Bump deps

tidy: updated cargo_metadata to 0.12 (rustfmt only one left, that depends on 0.8 version in tree, waiting when it merges into rustc repo)

miow v0.3.6 -> v0.3.7, drops socket2 v0.3.19

curl v0.4.36 -> v0.4.38
curl-sys v0.4.42+curl-7.76.0 -> v0.4.44+curl-7.77.0
fixes CVE's https://curl.se/docs/vuln-7.76.0.html

2 years agoRollup merge of #86864 - GuillaumeGomez:example-write-vectored, r=JohnTitor
Yuki Okushi [Sun, 4 Jul 2021 22:13:28 +0000 (07:13 +0900)]
Rollup merge of #86864 - GuillaumeGomez:example-write-vectored, r=JohnTitor

Add missing code example for Write::write_vectored

2 years agoRollup merge of #86862 - tmiasko:re-export-SwitchIntEdgeEffects, r=jonas-schievink
Yuki Okushi [Sun, 4 Jul 2021 22:13:27 +0000 (07:13 +0900)]
Rollup merge of #86862 - tmiasko:re-export-SwitchIntEdgeEffects, r=jonas-schievink

re-export SwitchIntEdgeEffects

This makes it possible to use `switch_int_edge_effects` outside
`rustc_mir::dataflow::impls`.

2 years agoRollup merge of #86859 - JohnTitor:test-69323, r=jackh726
Yuki Okushi [Sun, 4 Jul 2021 22:13:26 +0000 (07:13 +0900)]
Rollup merge of #86859 - JohnTitor:test-69323, r=jackh726

Add a regression test for issue-69323

Closes #69323
r? `@jackh726`

2 years agoRollup merge of #86858 - JohnTitor:stabilize-string-drain-as-str, r=Mark-Simulacrum
Yuki Okushi [Sun, 4 Jul 2021 22:13:25 +0000 (07:13 +0900)]
Rollup merge of #86858 - JohnTitor:stabilize-string-drain-as-str, r=Mark-Simulacrum

Stabilize `string_drain_as_str`

Closes #76905, FCP is done: https://github.com/rust-lang/rust/issues/76905#issuecomment-873461688

2 years agoRollup merge of #86856 - jyn514:x.py-less-verbose, r=Mark-Simulacrum
Yuki Okushi [Sun, 4 Jul 2021 22:13:24 +0000 (07:13 +0900)]
Rollup merge of #86856 - jyn514:x.py-less-verbose, r=Mark-Simulacrum

Make x.py less verbose on failures

- Don't print the exact command run by rustbuild unless `--verbose` is set.
  This is almost always unhelpful, since it's just cargo with a lot of
  arguments (and you can't replicate it anyway unless you have the environment variables, which aren't printed by default).
- Don't print "Build completed unsuccessfully" unless --verbose is set.
  You can already tell the build failed by the errors above, and the
  time isn't particularly helpful.
- Don't print the full path to bootstrap. This is useless to everyone,
  even including when working on x.py itself. You can still opt-in to
  this being shown with `--verbose`, since it will throw an exception.

Before:

```
error[E0432]: unresolved import `x`
   --> library/std/src/lib.rs:343:5
    |
343 | use x;
    |     ^ no external crate `x`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0432`.
error: could not compile `std`

To learn more, run the command again with --verbose.
command did not execute successfully: "/home/joshua/rustc4/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "check" "--target" "x86_64-unknown-linux-gnu" "-Zbinary-dep-depinfo" "-j" "8" "--release" "--features" "panic-unwind backtrace" "--manifest-path" "/home/joshua/rustc4/library/test/Cargo.toml" "--message-format" "json-render-diagnostics"
expected success, got: exit status: 101
failed to run: /home/joshua/rustc4/build/bootstrap/debug/bootstrap check
Build completed unsuccessfully in 0:00:13
```

After:

```
error[E0432]: unresolved import `x`
   --> library/std/src/lib.rs:343:5
    |
343 | use x;
    |     ^ no external crate `x`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0432`.
error: could not compile `std`

To learn more, run the command again with --verbose.
```

cc https://github.com/rust-lang/rust/issues/86854, https://github.com/rust-lang/rust/pull/86022

r? `@Mark-Simulacrum`

2 years agoRollup merge of #86623 - GuillaumeGomez:prevent-explanation-removal, r=Mark-Simulacrum
Yuki Okushi [Sun, 4 Jul 2021 22:13:23 +0000 (07:13 +0900)]
Rollup merge of #86623 - GuillaumeGomez:prevent-explanation-removal, r=Mark-Simulacrum

Add check to ensure error code explanations are not removed anymore even if not emitted

The error explanations are useful in case you use older version of the compiler. Even more if they had an explanation. If they are not emitted, their explanations should be updated but not removed (as we did for a few of them, like E0001).

r? `@Mark-Simulacrum`

2 years agoRollup merge of #86477 - tlyu:e0716-clarification, r=JohnTitor
Yuki Okushi [Sun, 4 Jul 2021 22:13:22 +0000 (07:13 +0900)]
Rollup merge of #86477 - tlyu:e0716-clarification, r=JohnTitor

E0716: clarify that equivalent code example is erroneous

In E0716, there is a code block that is equivalent to the erroneous
code example. Especially when viewed with `rustc --explain`, it's
not obvious that it is also erroneous, and some users have been
confused when they try to change their code to match the erroneous
equivalent.

`@rustbot` label +A-diagnostics +D-newcomer-roadblock +T-compiler

2 years agoAuto merge of #86598 - yoshuawuyts:poll-method-docs, r=JohnTitor
bors [Sun, 4 Jul 2021 20:00:57 +0000 (20:00 +0000)]
Auto merge of #86598 - yoshuawuyts:poll-method-docs, r=JohnTitor

Add examples to the various methods of `core::task::Poll`

This improves the documentation of the various methods of [`core::task::Poll`](https://doc.rust-lang.org/std/task/enum.Poll.html). These currently have fairly simple docs with no examples. This PR changes these methods to be closer to `core::option::Option` and adds usage examples (and importantly: tests!) to `Poll`'s methods.

cc/ `@rust-lang/wg-async-foundations`

## Screenshots

<details>
<summary>View generated rustdoc page</summary>
<image src="https://user-images.githubusercontent.com/2467194/123286616-59ee9b00-d50e-11eb-9e02-40269070f904.png" alt="Poll in core::task"></details>

2 years agomiow v0.3.6 -> v0.3.7, drops socket2 v0.3.19
klensy [Sun, 4 Jul 2021 18:49:56 +0000 (21:49 +0300)]
miow v0.3.6 -> v0.3.7, drops socket2 v0.3.19
curl v0.4.36 -> v0.4.38
curl-sys v0.4.42+curl-7.76.0 -> v0.4.44+curl-7.77.0
fixes cve's https://curl.se/docs/vuln-7.76.0.html

2 years agoAuto merge of #86866 - nikomatsakis:issue-84841, r=oli-obk
bors [Sun, 4 Jul 2021 17:39:37 +0000 (17:39 +0000)]
Auto merge of #86866 - nikomatsakis:issue-84841, r=oli-obk

Hack: Ignore inference variables in certain queries

Fixes #84841
Fixes #86753

Some queries are not built to accept types with inference variables, which can lead to ICEs. These queries probably ought to be converted to canonical form, but as a quick workaround, we can return conservative results in the case that inference variables are found.

We should file a follow-up issue (and update the FIXMEs...) to do the proper refactoring.

cc `@arora-aman`

r? `@oli-obk`

2 years agoAdd missing code example for Write::write_vectored
Guillaume Gomez [Sun, 4 Jul 2021 13:39:45 +0000 (15:39 +0200)]
Add missing code example for Write::write_vectored

2 years agotidy: update cargo_metadata to 0.12
klensy [Sun, 4 Jul 2021 16:58:04 +0000 (19:58 +0300)]
tidy: update cargo_metadata to 0.12

2 years agorevert broken formatting
Niko Matsakis [Sun, 4 Jul 2021 16:50:41 +0000 (12:50 -0400)]
revert broken formatting

2 years agoremove outdated comment
Niko Matsakis [Sun, 4 Jul 2021 16:50:35 +0000 (12:50 -0400)]
remove outdated comment

2 years agotag issues with FIXME
Niko Matsakis [Sun, 4 Jul 2021 16:50:28 +0000 (12:50 -0400)]
tag issues with FIXME

2 years agoAdd a regression test for issue-69323
Yuki Okushi [Sun, 4 Jul 2021 05:39:27 +0000 (14:39 +0900)]
Add a regression test for issue-69323

2 years agoUpdate compiler/rustc_middle/src/ty/normalize_erasing_regions.rs
Niko Matsakis [Sun, 4 Jul 2021 16:37:25 +0000 (12:37 -0400)]
Update compiler/rustc_middle/src/ty/normalize_erasing_regions.rs

Co-authored-by: Rémy Rakic <remy.rakic+github@gmail.com>
2 years agoConvert `debug_assert!` to `assert!` in `Binder::dummy`
Yuki Okushi [Sun, 4 Jul 2021 16:22:33 +0000 (01:22 +0900)]
Convert `debug_assert!` to `assert!` in `Binder::dummy`

This is needed for #85350 not to be passed.

2 years agoremove some ad-hoc has_infer_types checks that aren't needed anymore
Niko Matsakis [Sun, 4 Jul 2021 15:43:22 +0000 (11:43 -0400)]
remove some ad-hoc has_infer_types checks that aren't needed anymore

2 years agobe conservative in has_significant_drop
Niko Matsakis [Sun, 4 Jul 2021 15:41:40 +0000 (11:41 -0400)]
be conservative in has_significant_drop

2 years agoallow inference vars in type_implements_trait
Niko Matsakis [Sun, 4 Jul 2021 15:26:32 +0000 (11:26 -0400)]
allow inference vars in  type_implements_trait

2 years agoremove unused Option
Niko Matsakis [Sun, 4 Jul 2021 15:09:32 +0000 (11:09 -0400)]
remove unused Option

2 years agoE0716: clarify that equivalent code example is erroneous
Taylor Yu [Sat, 19 Jun 2021 20:28:32 +0000 (15:28 -0500)]
E0716: clarify that equivalent code example is erroneous

In E0716, there is a code block that is equivalent to the erroneous
code example. Especially when viewed with `rustc --explain`, it's
not obvious that it is also erroneous, and some users have been
confused when they try to change their code to match the erroneous
equivalent.

2 years agoAuto merge of #86048 - nbdd0121:no_floating_point, r=Amanieu
bors [Sun, 4 Jul 2021 14:18:57 +0000 (14:18 +0000)]
Auto merge of #86048 - nbdd0121:no_floating_point, r=Amanieu

core: add unstable no_fp_fmt_parse to disable float formatting code

In some projects (e.g. kernel), floating point is forbidden. They can disable
hardware floating point support and use `+soft-float` to avoid fp instructions
from being generated, but as libcore contains the formatting code for `f32`
and `f64`, some fp intrinsics are depended. One could define stubs for these
intrinsics that just panic [1], but it means that if any formatting functions
are accidentally used, mistake can only be caught during the runtime rather
than during compile-time or link-time, and they consume a lot of space without
LTO.

This patch provides an unstable cfg `no_fp_fmt_parse` to disable these.
A panicking stub is still provided for the `Debug` implementation (unfortunately)
because there are some SIMD types that use `#[derive(Debug)]`.

[1]: https://lkml.org/lkml/2021/4/14/1028

2 years agoAuto merge of #86213 - jhpratt:stabilize-const-from_utf8_unchecked, r=JohnTitor
bors [Sun, 4 Jul 2021 11:56:55 +0000 (11:56 +0000)]
Auto merge of #86213 - jhpratt:stabilize-const-from_utf8_unchecked, r=JohnTitor

Stabilize `str::from_utf8_unchecked` as `const`

This stabilizes `unsafe fn str::from_utf8_unchecked` as `const` pending FCP on #75196. By the time FCP finishes, the beta will have already been cut, so I've set 1.55 as the stable-since version.

(should also be +relnotes but I don't have the permission to do that)

r? `@m-ou-se`

Closes #75196

2 years agore-export SwitchIntEdgeEffects
Tomasz Miąsko [Sun, 4 Jul 2021 00:00:00 +0000 (00:00 +0000)]
re-export SwitchIntEdgeEffects

This makes it possible to use `switch_int_edge_effects` outside
`rustc_mir::dataflow::impls`.

2 years agoAuto merge of #86255 - Smittyvb:mir-alloc-oom, r=RalfJung,oli-obk
bors [Sun, 4 Jul 2021 09:15:36 +0000 (09:15 +0000)]
Auto merge of #86255 - Smittyvb:mir-alloc-oom, r=RalfJung,oli-obk

Support allocation failures when interpreting MIR

This closes #79601 by handling the case where memory allocation fails during MIR interpretation, and translates that failure into an `InterpError`. The error message is "tried to allocate more memory than available to compiler" to make it clear that the memory shortage is happening at compile-time by the compiler itself, and that it is not a runtime issue.

Now that memory allocation can fail, it would be neat if Miri could simulate low-memory devices to make it easy to see how much memory a Rust program needs.

Note that this breaks Miri because it assumes that allocation can never fail.

2 years agoAuto merge of #86849 - jyn514:rustdoc-group, r=Manishearth
bors [Sun, 4 Jul 2021 06:34:31 +0000 (06:34 +0000)]
Auto merge of #86849 - jyn514:rustdoc-group, r=Manishearth

Warn when `rustdoc::` group is omitted from lint names

When rustdoc lints were first made a tool lint, they gave an unconditional warning when you used the original name:
```
warning: lint `broken_intra_doc_links` has been renamed to `rustdoc::broken_intra_doc_links`
  --> $DIR/renamed-lint-still-applies.rs:2:9
   |
LL | #![deny(broken_intra_doc_links)]
   |         ^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `rustdoc::broken_intra_doc_links`
   |
   = note: `#[warn(renamed_and_removed_lints)]` on by default
```
That was reverted in https://github.com/rust-lang/rust/pull/83203 because adding `rustdoc::x` lints would cause the code to break on old versions of the compiler (due to https://github.com/rust-lang/rust/issues/66079#issuecomment-788589193, "fixed" in https://github.com/rust-lang/rust/pull/83216 in the sense that you can now opt-in to not breaking on nightly, which is not ideal but `register_tool` is a long way from stabilizing). Since https://github.com/rust-lang/rust/pull/80527 is now on 1.52.0 stable, we can re-enable the warning. For nightly users, they can change immediately and still have their code work on stable; for stable users, they can change their code in 12 weeks and still have it work up to 3 releases back (about 18 weeks). That seems reasonable to me.

r? `@Manishearth` cc `@rust-lang/rustdoc`

2 years agoStabilize `string_drain_as_str`
Yuki Okushi [Sun, 4 Jul 2021 05:23:43 +0000 (14:23 +0900)]
Stabilize `string_drain_as_str`

2 years agoAuto merge of #86833 - crlf0710:remove-std-raw-mod, r=SimonSapin
bors [Sun, 4 Jul 2021 04:04:47 +0000 (04:04 +0000)]
Auto merge of #86833 - crlf0710:remove-std-raw-mod, r=SimonSapin

Remove the deprecated `core::raw` and `std::raw` module.

A few months has passed since #84207. I think now it's time for the final removal.

Closes #27751.

r? `@m-ou-se`

2 years agointroduce helper function
Niko Matsakis [Sun, 4 Jul 2021 02:15:32 +0000 (22:15 -0400)]
introduce helper function

2 years agoMake x.py less verbose on failures
Joshua Nelson [Sun, 4 Jul 2021 01:33:16 +0000 (21:33 -0400)]
Make x.py less verbose on failures

- Don't print the exact command run by rustbuild unless `--verbose` is set.
  This is almost always unhelpful, since it's just cargo with a lot of
  arguments.
- Don't print "Build completed unsuccessfully" unless --verbose is set.
  You can already tell the build failed by the errors above, and the
  time isn't particularly helpful.
- Don't print the full path to bootstrap. This is useless to everyone,
  even including when working on x.py itself. You can still opt-in to
  this being shown with `--verbose`, since it will throw an exception.

Before:

```
error[E0432]: unresolved import `x`
   --> library/std/src/lib.rs:343:5
    |
343 | use x;
    |     ^ no external crate `x`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0432`.
error: could not compile `std`

To learn more, run the command again with --verbose.
command did not execute successfully: "/home/joshua/rustc4/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "check" "--target" "x86_64-unknown-linux-gnu" "-Zbinary-dep-depinfo" "-j" "8" "--release" "--features" "panic-unwind backtrace" "--manifest-path" "/home/joshua/rustc4/library/test/Cargo.toml" "--message-format" "json-render-diagnostics"
expected success, got: exit status: 101
failed to run: /home/joshua/rustc4/build/bootstrap/debug/bootstrap check
Build completed unsuccessfully in 0:00:13
```

After:

```
error[E0432]: unresolved import `x`
   --> library/std/src/lib.rs:343:5
    |
343 | use x;
    |     ^ no external crate `x`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0432`.
error: could not compile `std`

To learn more, run the command again with --verbose.
```

2 years agoAuto merge of #85270 - ChrisDenton:win-env-case, r=m-ou-se
bors [Sun, 4 Jul 2021 01:24:05 +0000 (01:24 +0000)]
Auto merge of #85270 - ChrisDenton:win-env-case, r=m-ou-se

When using `process::Command` on Windows, environment variable names must be case-preserving but case-insensitive

When using `Command` to set the environment variables, the key should be compared as uppercase Unicode but when set it should preserve the original case.

Fixes #85242

2 years agoAuto merge of #85090 - Aaron1011:type-outlives-global, r=matthewjasper,jackh726
bors [Sat, 3 Jul 2021 22:42:58 +0000 (22:42 +0000)]
Auto merge of #85090 - Aaron1011:type-outlives-global, r=matthewjasper,jackh726

Return `EvaluatedToOk` when type in outlives predicate is global

A global type doesn't reference any local regions or types, so it's
guaranteed to outlive any region.

2 years agoadd test case
Niko Matsakis [Sat, 3 Jul 2021 22:32:26 +0000 (18:32 -0400)]
add test case

2 years agoAuto merge of #86825 - ehuss:update-cargo, r=ehuss
bors [Sat, 3 Jul 2021 20:21:39 +0000 (20:21 +0000)]
Auto merge of #86825 - ehuss:update-cargo, r=ehuss

Update cargo

5 commits in 4952979031e2cf1d901c817a32e25a156a19db4c..3ebb5f15a940810f250b68821149387af583a79e
2021-07-01 01:14:50 +0000 to 2021-07-02 20:35:38 +0000
- Adjust the edition2021 resolver diff report. (rust-lang/cargo#9649)
- Include the linker in the fingerprint. (rust-lang/cargo#9647)
- Temporarily disable windows env test. (rust-lang/cargo#9646)
- Handle git deleted files with dirty worktree. (rust-lang/cargo#9645)
- Adjust error message with offline and frozen. (rust-lang/cargo#9644)

2 years agoWarn when `rustdoc::` group is omitted from lint names
Joshua Nelson [Sat, 3 Jul 2021 19:20:29 +0000 (15:20 -0400)]
Warn when `rustdoc::` group is omitted from lint names

2 years agoAuto merge of #86778 - tmiasko:fast-multiline, r=davidtwco
bors [Sat, 3 Jul 2021 16:06:35 +0000 (16:06 +0000)]
Auto merge of #86778 - tmiasko:fast-multiline, r=davidtwco

Avoid byte to char position conversions in `is_multiline`

Converting a byte position into a char position is currently linear in
the number of multibyte characters in the source code. Avoid it when
checking if a range spans across lines.

This makes it feasible to compile source files with a large number of
multibyte characters.

2 years agoadd note about MAX_ALLOC_LIMIT
Smittyvb [Sat, 3 Jul 2021 15:15:14 +0000 (11:15 -0400)]
add note about MAX_ALLOC_LIMIT

Co-authored-by: Ralf Jung <post@ralfj.de>
2 years agoMake vtable_allocation always succeed
Smitty [Sat, 3 Jul 2021 15:14:19 +0000 (11:14 -0400)]
Make vtable_allocation always succeed

2 years agoAuto merge of #86810 - ojeda:alloc-gate, r=dtolnay
bors [Sat, 3 Jul 2021 13:23:28 +0000 (13:23 +0000)]
Auto merge of #86810 - ojeda:alloc-gate, r=dtolnay

alloc: `no_global_oom_handling`: disable `new()`s, `pin()`s, etc.

They are infallible, and could not be actually used because
they will trigger an error when monomorphized, but it is better
to just remove them.

Link: https://github.com/Rust-for-Linux/linux/pull/402
Suggested-by: Gary Guo <gary@garyguo.net>
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2 years agoAuto merge of #86799 - tlyu:stdio-locked, r=joshtriplett
bors [Sat, 3 Jul 2021 10:40:53 +0000 (10:40 +0000)]
Auto merge of #86799 - tlyu:stdio-locked, r=joshtriplett

add owned locked stdio handles

Add stderr_locked, stdin_locked, and stdout_locked free functions
to obtain owned locked stdio handles in a single step. Also add
into_lock methods to consume a stdio handle and return an owned
lock. These methods will make it easier to use locked stdio
handles without having to deal with lifetime problems or keeping
bindings to the unlocked handles around.

Fixes #85383; enables #86412.

r? `@joshtriplett`
`@rustbot` label +A-io +C-enhancement +D-newcomer-roadblock +T-libs-api

2 years agoAuto merge of #86571 - fee1-dead:const-trait-impl-fix, r=jackh726
bors [Sat, 3 Jul 2021 07:24:24 +0000 (07:24 +0000)]
Auto merge of #86571 - fee1-dead:const-trait-impl-fix, r=jackh726

deny using default function in impl const Trait

Fixes #79450.

I don't know if my implementation is correct:

 - The check is in `rustc_passes::check_const`, should I put it somewhere else instead?
 - Is my approach (to checking the impl) optimal? It works for the current tests, but it might have some issues or there might be a better way of doing this.

2 years agoRemove the deprecated `core::raw` and `std::raw` module.
Charles Lew [Sat, 3 Jul 2021 04:24:47 +0000 (12:24 +0800)]
Remove the deprecated `core::raw` and `std::raw` module.

2 years agoAuto merge of #79965 - ijackson:moreerrnos, r=joshtriplett
bors [Sat, 3 Jul 2021 04:12:36 +0000 (04:12 +0000)]
Auto merge of #79965 - ijackson:moreerrnos, r=joshtriplett

More ErrorKinds for common errnos

From the commit message of the main commit here (as revised):

```
There are a number of IO error situations which it would be very
useful for Rust code to be able to recognise without having to resort
to OS-specific code.  Taking some Unix examples, `ENOTEMPTY` and
`EXDEV` have obvious recovery strategies.  Recently I was surprised to
discover that `ENOSPC` came out as `ErrorKind::Other`.

Since I am familiar with Unix I reviwed the list of errno values in
  https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/errno.h.html

Here, I add those that most clearly seem to be needed.

`@CraftSpider` provided information about Windows, and references, which
I have tried to take into account.

This has to be insta-stable because we can't sensibly have a different
set of ErrorKinds depending on a std feature flag.

I have *not* added these to the mapping tables for any operating
systems other than Unix and Windows.  I hope that it is OK to add them
now for Unix and Windows now, and maybe add them to other OS's mapping
tables as and when someone on that OS is able to consider the
situation.

I adopted the general principle that it was usually a bad idea to map
two distinct error values to the same Rust error code.  I notice that
this principle is already violated in the case of `EACCES` and
`EPERM`, which both map to `PermissionDenied`.  I think this was
probably a mistake but it would be quite hard to change now, so I
don't propose to do anything about that.

However, for Windows, there are sometimes different error codes for
identical situations.  Eg there are WSA* versions of some error
codes as well as ERROR_* ones.  Also Windows seems to have a great
many more erorr codes.  I don't know precisely what best practice
would be for Windows.
```

<strike>

```
Errno values I wasn't sure about so *haven't* included:

EMFILE ENFILE ENOBUFS ENOLCK:

  These are all fairly Unix-specific resource exhaustion situations.
  In practice it seemed not very likely to me that anyone would want
  to handle these differently to `Other`.

ENOMEM ERANGE EDOM EOVERFLOW

  Normally these don't get exposed to the Rust callers I hope.  They
  don't tend to come out of filesystem APIs.

EILSEQ

  Hopefully Rust libraries open files in binary mode and do the
  converstion in Rust.  So Rust code ought not to be exposed to
  EILSEQ.

EIO

  The range of things that could cause this is troublesome.  I found
  it difficult to describe.  I do think it would be useful to add this
  at some point, because EIO on a filesystem operation is much more
  serious than most other errors.

ENETDOWN

  I wasn't sure if this was useful or, indeed, if any modern systems
  use it.

ENOEXEC

  It is not clear to me how a Rust program could respond to this.  It
  seems rather niche.

EPROTO ENETRESET ENODATA ENOMSG ENOPROTOOPT ENOSR ENOSTR ETIME
ENOTRECOVERABLE EOWNERDEAD EBADMSG EPROTONOSUPPORT EPROTOTYPE EIDRM

  These are network or STREAMS related errors which I have never in
  my own Unix programming found the need to do anything with.  I think
  someone who understands these better should be the one to try to
  find good Rust names and descriptions for them.

ENOTTY ENXIO ENODEV EOPNOTSUPP ESRCH EALREADY ECANCELED ECHILD
EINPROGRESS

  These are very hard to get unless you're already doing something
  very Unix-specific, in which case the raw_os_error interface is
  probably more suitable than relying on the Rust ErrorKind mapping.

EFAULT EBADF

  These would seem to be the result of application UB.
```
</strike>
<i>(omitted errnos are discussed below, especially in https://github.com/rust-lang/rust/pull/79965#issuecomment-810468334)

2 years agoAuto merge of #86795 - JohnTitor:fix-bind, r=jackh726
bors [Sat, 3 Jul 2021 01:42:06 +0000 (01:42 +0000)]
Auto merge of #86795 - JohnTitor:fix-bind, r=jackh726

Fix const-generics ICE related to binding

Fixes #83765, fixes #85848
r? `@jackh726` as you're familiar with `Binding`. I'd like to get some views if the current approach is right path.

2 years agoOnly run error code explanation removal check if on CI
Guillaume Gomez [Fri, 2 Jul 2021 21:59:42 +0000 (23:59 +0200)]
Only run error code explanation removal check if on CI

2 years agocore: add unstable `no_fp_fmt_parse` to disable float fmt/parse code
Gary Guo [Sun, 6 Jun 2021 01:28:05 +0000 (02:28 +0100)]
core: add unstable `no_fp_fmt_parse` to disable float fmt/parse code

In some projects (e.g. kernel), floating point is forbidden. They can disable
hardware floating point support and use `+soft-float` to avoid fp instructions
from being generated, but as libcore contains the formatting code for `f32`
and `f64`, some fp intrinsics are depended. One could define stubs for these
intrinsics that just panic [1], but it means that if any formatting functions
are accidentally used, mistake can only be caught during the runtime rather
than during compile-time or link-time, and they consume a lot of space without
LTO.

This patch provides an unstable cfg `no_fp_fmt_parse` to disable these.
A panicking stub is still provided for the `Debug` implementation (unfortunately)
because there are some SIMD types that use `#[derive(Debug)]`.

[1]: https://lkml.org/lkml/2021/4/14/1028

2 years agoUpdate cargo
Eric Huss [Fri, 2 Jul 2021 21:22:58 +0000 (14:22 -0700)]
Update cargo

2 years agostdio_locked: updates based on feedback
Taylor Yu [Fri, 2 Jul 2021 20:56:56 +0000 (15:56 -0500)]
stdio_locked: updates based on feedback

Rename methods to `into_locked`. Remove type aliases for owned locks.

2 years agoAllocation failure in constprop panics right away
Smitty [Fri, 2 Jul 2021 20:06:12 +0000 (16:06 -0400)]
Allocation failure in constprop panics right away

2 years agoAuto merge of #86817 - JohnTitor:rollup-rcysc95, r=JohnTitor
bors [Fri, 2 Jul 2021 20:00:51 +0000 (20:00 +0000)]
Auto merge of #86817 - JohnTitor:rollup-rcysc95, r=JohnTitor

Rollup of 7 pull requests

Successful merges:

 - #84029 (add `track_path::path` fn for usage in `proc_macro`s)
 - #85001 (Merge `sys_common::bytestring` back into `os_str_bytes`)
 - #86308 (Docs: clarify that certain intrinsics are not unsafe)
 - #86796 (Add a regression test for issue-70703)
 - #86803 (Remove & from Command::args calls in documentation)
 - #86807 (Fix double import in wasm thread )
 - #86813 (Add a help message to `unused_doc_comments` lint)

Failed merges:

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

2 years agoRollup merge of #86813 - JohnTitor:unused-doc-comments-help, r=jackh726
Yuki Okushi [Fri, 2 Jul 2021 18:15:14 +0000 (03:15 +0900)]
Rollup merge of #86813 - JohnTitor:unused-doc-comments-help, r=jackh726

Add a help message to `unused_doc_comments` lint

Fixes #83492
This adds a help message to suggest a plain comment like the E0658 error. I've yet to come up with the best message about the doc attribute but the current shouldn't harm anything.
I was thinking of recovering in the `doc_comment_between_if_else` case, but I came to the conclusion that it unlikely happened and was an overkill.

2 years agoRollup merge of #86807 - tversteeg:patch-1, r=bjorn3
Yuki Okushi [Fri, 2 Jul 2021 18:15:13 +0000 (03:15 +0900)]
Rollup merge of #86807 - tversteeg:patch-1, r=bjorn3

Fix double import in wasm thread

The `unsupported` type is imported two times, as `super::unsupported` and as `crate::sys::unsupported`, throwing an error. Remove `super::unsupported` in favor of the other.

As reported in #86802.

Fix #86802

2 years agoRollup merge of #86803 - xfix:remove-unnecessary-ampersand-from-command-args-calls...
Yuki Okushi [Fri, 2 Jul 2021 18:15:12 +0000 (03:15 +0900)]
Rollup merge of #86803 - xfix:remove-unnecessary-ampersand-from-command-args-calls, r=joshtriplett

Remove & from Command::args calls in documentation

Now that arrays implement `IntoIterator`, using `&` is no longer necessary. This makes examples easier to understand.

2 years agoRollup merge of #86796 - JohnTitor:test-70703, r=jonas-schievink
Yuki Okushi [Fri, 2 Jul 2021 18:15:11 +0000 (03:15 +0900)]
Rollup merge of #86796 - JohnTitor:test-70703, r=jonas-schievink

Add a regression test for issue-70703

Closes #70703

2 years agoRollup merge of #86308 - bstrie:intrinsafe, r=JohnTitor
Yuki Okushi [Fri, 2 Jul 2021 18:15:10 +0000 (03:15 +0900)]
Rollup merge of #86308 - bstrie:intrinsafe, r=JohnTitor

Docs: clarify that certain intrinsics are not unsafe

As determined by the hardcoded list at https://github.com/rust-lang/rust/blob/003b8eadd7a476c51956fe447894532d6e21937e/compiler/rustc_typeck/src/check/intrinsic.rs#L59-L92

2 years agoRollup merge of #85001 - CDirkx:bytestring, r=JohnTitor
Yuki Okushi [Fri, 2 Jul 2021 18:15:09 +0000 (03:15 +0900)]
Rollup merge of #85001 - CDirkx:bytestring, r=JohnTitor

Merge `sys_common::bytestring` back into `os_str_bytes`

`bytestring` contains code for correctly debug formatting a byte slice (`[u8]`). This functionality is and has historically only been used to provide the debug formatting of byte-based os-strings (on unix etc.).

Having this functionality in the separate `bytestring` module was useful in the past to reduce duplication, as [when it was added](https://github.com/rust-lang/rust/pull/46798) `os_str_bytes` was still split into `sys::{unix, redox, wasi, etc.}::os_str`. However, now that is no longer the case, there is not much reason for the `bytestring` functionality to be separate from `os_str_bytes`; I don't think it is very likely that another part of std will need to handle formatting byte strings that are not os-strings in the future (everything should be `utf8`). This is why this PR merges the functionality of `bytestring` directly into the debug implementation in `os_str_bytes`.

2 years agoRollup merge of #84029 - drahnr:master, r=petrochenkov
Yuki Okushi [Fri, 2 Jul 2021 18:15:07 +0000 (03:15 +0900)]
Rollup merge of #84029 - drahnr:master, r=petrochenkov

add `track_path::path` fn for usage in `proc_macro`s

Adds a way to declare a dependency on external files without including them, to either re-trigger the build of a file as well as covering the use case of including dependencies within the `rustc` invocation, such that tools like `sccache`/`cachepot` are able to handle references to external files which are not included.

Ref #73921

3 years agoSimplify `visit_region` implementation
Yuki Okushi [Fri, 2 Jul 2021 17:13:17 +0000 (02:13 +0900)]
Simplify `visit_region` implementation

3 years agoAuto merge of #85269 - dpaoliello:dpaoliello/DebugSymbols, r=michaelwoerister
bors [Fri, 2 Jul 2021 17:19:32 +0000 (17:19 +0000)]
Auto merge of #85269 - dpaoliello:dpaoliello/DebugSymbols, r=michaelwoerister

Improve debug symbol names to avoid ambiguity and work better with MSVC's debugger

There are several cases where names of types and functions in the debug info are either ambiguous, or not helpful, such as including ambiguous placeholders (e.g., `{{impl}}`, `{{closure}}` or `dyn _'`) or dropping qualifications (e.g., for dynamic types).

Instead, each debug symbol name should be unique and useful:
* Include disambiguators for anonymous `DefPathDataName` (closures and generators), and unify their formatting when used as a path-qualifier vs item being qualified.
* Qualify the principal trait for dynamic types.
* If there is no principal trait for a dynamic type, emit all other traits instead.
* Respect the `qualified` argument when emitting ref and pointer types.
* For implementations, emit the disambiguator.
* Print const generics when emitting generic parameters or arguments.

Additionally, when targeting MSVC, its debugger treats many command arguments as C++ expressions, even when the argument is defined to be a symbol name. As such names in the debug info need to be more C++-like to be parsed correctly:
* Avoid characters with special meaning (`#`, `[`, `"`, `+`).
* Never start a name with `<` or `{` as this is treated as an operator.
* `>>` is always treated as a right-shift, even when parsing generic arguments (so add a space to avoid this).
* Emit function declarations using C/C++ style syntax (e.g., leading return type).
* Emit arrays as a synthetic `array$<type, size>` type.
* Include a `$` in all synthetic types as this is a legal character for C++, but not Rust (thus we avoid collisions with user types).

3 years agoRemove `ty::Binder::bind()`
Yuki Okushi [Fri, 2 Jul 2021 09:48:34 +0000 (18:48 +0900)]
Remove `ty::Binder::bind()`

Co-authored-by: Noah Lev <camelidcamel@gmail.com>
3 years agoCorrect `visit_region` implementation
Yuki Okushi [Fri, 2 Jul 2021 09:14:28 +0000 (18:14 +0900)]
Correct `visit_region` implementation

3 years agoUse `BoundVarsCollector` for now
Yuki Okushi [Fri, 2 Jul 2021 01:14:13 +0000 (10:14 +0900)]
Use `BoundVarsCollector` for now

3 years agoFix const-generics ICE related to binding
Yuki Okushi [Thu, 1 Jul 2021 23:02:11 +0000 (08:02 +0900)]
Fix const-generics ICE related to binding

3 years agoAdd a help message to `unused_doc_comments` lint
Yuki Okushi [Fri, 2 Jul 2021 16:00:08 +0000 (01:00 +0900)]
Add a help message to `unused_doc_comments` lint

3 years agoFix type name difference between i686 and x86_64 for test
Wesley Wiser [Fri, 2 Jul 2021 14:31:22 +0000 (10:31 -0400)]
Fix type name difference between i686 and x86_64 for test

3 years agoAuto merge of #86805 - hyd-dev:miri, r=RalfJung
bors [Fri, 2 Jul 2021 14:23:32 +0000 (14:23 +0000)]
Auto merge of #86805 - hyd-dev:miri, r=RalfJung

Update Miri

Fixes #86792.

r? `@RalfJung`

3 years agoAdd check to ensure error code explanations are not removed anymore even if not emitted
Guillaume Gomez [Mon, 28 Jun 2021 15:55:01 +0000 (17:55 +0200)]
Add check to ensure error code explanations are not removed anymore even if not emitted

3 years agoalloc: `no_global_oom_handling`: disable `new()`s, `pin()`s, etc.
Miguel Ojeda [Fri, 2 Jul 2021 12:55:20 +0000 (14:55 +0200)]
alloc: `no_global_oom_handling`: disable `new()`s, `pin()`s, etc.

They are infallible, and could not be actually used because
they will trigger an error when monomorphized, but it is better
to just remove them.

Link: https://github.com/Rust-for-Linux/linux/pull/402
Suggested-by: Gary Guo <gary@garyguo.net>
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
3 years agoAuto merge of #86806 - GuillaumeGomez:rollup-pr5r37w, r=GuillaumeGomez
bors [Fri, 2 Jul 2021 11:42:38 +0000 (11:42 +0000)]
Auto merge of #86806 - GuillaumeGomez:rollup-pr5r37w, r=GuillaumeGomez

Rollup of 5 pull requests

Successful merges:

 - #85749 (Revert "Don't load all extern crates unconditionally")
 - #86714 (Add linked list cursor end methods)
 - #86737 (Document rustfmt on nightly-rustc)
 - #86776 (Skip layout query when computing integer type size during mangling)
 - #86797 (Stabilize `Bound::cloned()`)

Failed merges:

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

3 years agoFix double import in wasm thread
Thomas Versteeg [Fri, 2 Jul 2021 09:37:00 +0000 (09:37 +0000)]
Fix double import in wasm thread

The `unsupported` type is imported two times, as `super::unsupported` and as `crate::sys::unsupported`, throwing an error. Remove `super::unsupported` in favor of the other.

3 years agoRollup merge of #86797 - inquisitivecrystal:bound-cloned, r=jyn514
Guillaume Gomez [Fri, 2 Jul 2021 09:35:31 +0000 (11:35 +0200)]
Rollup merge of #86797 - inquisitivecrystal:bound-cloned, r=jyn514

Stabilize `Bound::cloned()`

This PR stabilizes the function `Bound::cloned()`.

Closes #61356.

3 years agoRollup merge of #86776 - tmiasko:v0-skip-layout-query, r=petrochenkov
Guillaume Gomez [Fri, 2 Jul 2021 09:35:30 +0000 (11:35 +0200)]
Rollup merge of #86776 - tmiasko:v0-skip-layout-query, r=petrochenkov

Skip layout query when computing integer type size during mangling

3 years agoRollup merge of #86737 - jyn514:doc-tools, r=Mark-Simulacrum
Guillaume Gomez [Fri, 2 Jul 2021 09:35:29 +0000 (11:35 +0200)]
Rollup merge of #86737 - jyn514:doc-tools, r=Mark-Simulacrum

Document rustfmt on nightly-rustc

- Refactor the doc step for Rustdoc into a macro
- Call the macro for both rustdoc and rustfmt
- Add a `recursion_limit` macro to avoid overflow errors

This does not currently pass --document-private-items for rustfmt due to https://github.com/rust-lang/cargo/pull/8422#issuecomment-871082935.

r? `@Mark-Simulacrum` cc `@calebcartwright`

3 years agoRollup merge of #86714 - iwahbe:add-linked-list-cursor-end-methods, r=Amanieu
Guillaume Gomez [Fri, 2 Jul 2021 09:35:28 +0000 (11:35 +0200)]
Rollup merge of #86714 - iwahbe:add-linked-list-cursor-end-methods, r=Amanieu

Add linked list cursor end methods

I add several methods to `LinkedList::CursorMut` and `LinkedList::Cursor`. These methods allow you to access/manipulate the ends of a list via the cursor. This is especially helpful when scanning through a list and reordering. For example:

```rust
let mut c = ll.back_cursor_mut();
let mut moves = 10;
while c.current().map(|x| x > 5).unwrap_or(false) {
    let n = c.remove_current();
    c.push_front(n);
    if moves > 0 { break; } else { moves -= 1; }
}
```
I encountered this problem working on my bachelors thesis doing graph index manipulation.

While this problem can be avoided by splicing, it is awkward. I asked about the problem [here](https://internals.rust-lang.org/t/linked-list-cursurmut-missing-methods/14921/4) and it was suggested I write a PR.

All methods added consist of
```rust
Cursor::front(&self) -> Option<&T>;
Cursor::back(&self) -> Option<&T>;
CursorMut::front(&self) -> Option<&T>;
CursorMut::back(&self) -> Option<&T>;
CursorMut::front_mut(&mut self) -> Option<&mut T>;
CursorMut::back_mut(&mut self) -> Option<&mut T>;
CursorMut::push_front(&mut self, elt: T);
CursorMut::push_back(&mut self, elt: T);
CursorMut::pop_front(&mut self) -> Option<T>;
CursorMut::pop_back(&mut self) -> Option<T>;
```
#### Design decisions:
I tried to remain as consistent as possible with what was already present for linked lists.
The methods `front`, `front_mut`, `back` and `back_mut` are identical to their `LinkedList` equivalents.

I tried to make the `pop_front` and `pop_back` methods work the same way (vis a vis the "ghost" node) as `remove_current`. I thought this was the closest analog.

`push_front` and `push_back` do not change the "current" node, even if it is the "ghost" node. I thought it was most intuitive to say that if you add to the list, current will never change.

Any feedback would be welcome :smile:

3 years agoRollup merge of #85749 - GuillaumeGomez:revert-smart-extern-crate-load, r=jyn514
Guillaume Gomez [Fri, 2 Jul 2021 09:35:27 +0000 (11:35 +0200)]
Rollup merge of #85749 - GuillaumeGomez:revert-smart-extern-crate-load, r=jyn514

Revert "Don't load all extern crates unconditionally"

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

This reverts https://github.com/rust-lang/rust/pull/83738.

For the "smart" load of external crates, we need to be able to access their items in order to check their doc comments, which seems, if not impossible, quite complicated using only the AST.

For some context, I first tried to extend the `IntraLinkCrateLoader` visitor by adding `visit_foreign_item`. Unfortunately, it never enters into this call, so definitely not the right place...

I then added `visit_use_tree` to then check all the imports outside with something like this:

```rust
let mut loader = crate::passes::collect_intra_doc_links::IntraLinkCrateLoader::new(resolver);
    ast::visit::walk_crate(&mut loader, krate);

    let mut items = Vec::new();
    for import in &loader.imports_to_check {
        if let Some(item) = krate.items.iter().find(|i| i.id == *import) {
            items.push(item);
        }
    }
    for item in items {
        ast::visit::walk_item(&mut item);
        for attr in &item.attrs {
            loader.check_attribute(attr);
        }
    }
```

This was, of course, a failure. We find the items without problems, but we still can't go into the external crate to check its items' attributes.

Finally, `@jyn514` suggested to look into the [`CrateLoader`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_metadata/creader/struct.CrateLoader.html), but it only seems to provide metadata (I went through [`CStore`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_metadata/creader/struct.CStore.html) and [`CrateMetadata`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_metadata/rmeta/decoder/struct.CrateMetadata.html)).

I think we are too limited here (with AST only) to be able to determine the crates we actually need to import, but it's very likely that I missed something. Maybe `@petrochenkov` or `@Aaron1011` have an idea?

So until we find a way to make it work completely, we need to revert it to fix the ICE. Once merged, we'll need to re-open #68427.

r? `@jyn514`

3 years agoUpdate Miri
hyd-dev [Fri, 2 Jul 2021 09:23:45 +0000 (17:23 +0800)]
Update Miri

3 years agoRemove & from Command::args calls in documentation
Konrad Borowski [Fri, 2 Jul 2021 09:10:00 +0000 (11:10 +0200)]
Remove & from Command::args calls in documentation

Now that arrays implement `IntoIterator`, using
`&` is no longer necessary. This makes examples
easier to understand.

3 years agoAuto merge of #85746 - m-ou-se:io-error-other, r=joshtriplett
bors [Fri, 2 Jul 2021 09:01:42 +0000 (09:01 +0000)]
Auto merge of #85746 - m-ou-se:io-error-other, r=joshtriplett

Redefine `ErrorKind::Other` and stop using it in std.

This implements the idea I shared yesterday in the libs meeting when we were discussing how to handle adding new `ErrorKind`s to the standard library: This redefines `Other` to be for *user defined errors only*, and changes all uses of `Other` in the standard library to a `#[doc(hidden)]` and permanently `#[unstable]` `ErrorKind` that users can not match on. This ensures that adding `ErrorKind`s at a later point in time is not a breaking change, since the user couldn't match on these errors anyway. This way, we use the `#[non_exhaustive]` property of the enum in a more effective way.

Open questions:
- How do we check this change doesn't cause too much breakage? Will a crate run help and be enough?
- How do we ensure we don't accidentally start using `Other` again in the standard library? We don't have a `pub(not crate)` or `#[deprecated(in this crate only)]`.

cc https://github.com/rust-lang/rust/pull/79965

cc `@rust-lang/libs` `@ijackson`

r? `@dtolnay`

3 years agoAuto merge of #80182 - in42:stack_trace, r=tmandry
bors [Fri, 2 Jul 2021 05:40:51 +0000 (05:40 +0000)]
Auto merge of #80182 - in42:stack_trace, r=tmandry

Implement printing of stack traces on LLVM segfaults and aborts

Implement #79153

Based on discussion, try to extend the rust_backtrace=1 feature to handle segfault or aborts in the llvm backend

3 years agoadd track_path::path fn for proc-macro usage
Bernhard Schuster [Fri, 9 Apr 2021 14:35:40 +0000 (16:35 +0200)]
add track_path::path fn for proc-macro usage

Ref #73921

3 years agoAuto merge of #86782 - flip1995:clippyup, r=Manishearth
bors [Fri, 2 Jul 2021 02:56:45 +0000 (02:56 +0000)]
Auto merge of #86782 - flip1995:clippyup, r=Manishearth

Update Clippy

Biweekly Clippy Update

r? `@Manishearth`

3 years agoadd owned locked stdio handles
Taylor Yu [Thu, 1 Jul 2021 23:05:24 +0000 (18:05 -0500)]
add owned locked stdio handles

Add stderr_locked, stdin_locked, and stdout_locked free functions
to obtain owned locked stdio handles in a single step. Also add
into_lock methods to consume a stdio handle and return an owned
lock. These methods will make it easier to use locked stdio
handles without having to deal with lifetime problems or keeping
bindings to the unlocked handles around.

3 years agoUse signal handler only on supported platforms
Tyler Mandry [Fri, 2 Jul 2021 00:20:04 +0000 (00:20 +0000)]
Use signal handler only on supported platforms

3 years agoAuto merge of #86777 - tmiasko:estimate-terminators, r=estebank
bors [Fri, 2 Jul 2021 00:15:58 +0000 (00:15 +0000)]
Auto merge of #86777 - tmiasko:estimate-terminators, r=estebank

Include terminators in instance size estimate

For example, drop glue generated for struct below, doesn't have any
statements, only terminators. Previously it received an estimate of 0,
the new estimate is 13 (6+5 drop terminators, +1 resume, +1 return).

```rust
struct S {
    a: String,
    b: String,
    c: String,
    d: String,
    e: String,
    f: String,
}
```

Originally reported in https://github.com/rust-lang/rust/issues/69382#issue-569392141

3 years agoStabilize `Bound::cloned()`
Aris Merchant [Fri, 2 Jul 2021 00:05:08 +0000 (17:05 -0700)]
Stabilize `Bound::cloned()`

3 years agoDocument rustfmt on nightly-rustc
Joshua Nelson [Wed, 30 Jun 2021 04:13:34 +0000 (00:13 -0400)]
Document rustfmt on nightly-rustc

The recursion_limit attribute avoids the following error:

```
error[E0275]: overflow evaluating the requirement `std::ptr::Unique<rustc_ast::Pat>: std::marker::Send`
  |
  = help: consider adding a `#![recursion_limit="256"]` attribute to your crate (`rustfmt_nightly`)
```

3 years agoAdd a regression test for issue-70703
Yuki Okushi [Thu, 1 Jul 2021 23:31:51 +0000 (08:31 +0900)]
Add a regression test for issue-70703

3 years agoAuto merge of #86791 - JohnTitor:rollup-96ltzpz, r=JohnTitor
bors [Thu, 1 Jul 2021 21:45:19 +0000 (21:45 +0000)]
Auto merge of #86791 - JohnTitor:rollup-96ltzpz, r=JohnTitor

Rollup of 7 pull requests

Successful merges:

 - #86148 (Check the number of generic lifetime and const parameters of intrinsics)
 - #86659 (fix(rustdoc): generics search)
 - #86768 (Add myself to mailmap)
 - #86775 (Test for const trait impls behind feature gates)
 - #86779 (Allow anyone to add or remove any label starting with perf-)
 - #86783 (Move Mutex::unlock to T: ?Sized)
 - #86785 (proc_macro/bridge: Remove dead code Slice type)

Failed merges:

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

3 years agoRollup merge of #86785 - lf-:dead-code, r=Mark-Simulacrum
Yuki Okushi [Thu, 1 Jul 2021 21:20:34 +0000 (06:20 +0900)]
Rollup merge of #86785 - lf-:dead-code, r=Mark-Simulacrum

proc_macro/bridge: Remove dead code Slice type

See https://github.com/rust-lang/rust/pull/85390#discussion_r662464868

3 years agoRollup merge of #86783 - mark-i-m:mutex-drop-unsized, r=Xanewok
Yuki Okushi [Thu, 1 Jul 2021 21:20:33 +0000 (06:20 +0900)]
Rollup merge of #86783 - mark-i-m:mutex-drop-unsized, r=Xanewok

Move Mutex::unlock to T: ?Sized

r? ``@mbrubeck``

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

3 years agoRollup merge of #86779 - rylev:all-perf-labels, r=Mark-Simulacrum
Yuki Okushi [Thu, 1 Jul 2021 21:20:32 +0000 (06:20 +0900)]
Rollup merge of #86779 - rylev:all-perf-labels, r=Mark-Simulacrum

Allow anyone to add or remove any label starting with perf-

In order to fully realize planned changes to the performance tracking process, we'd like to allow anyone to change the perf related labels.

r? ``@Mark-Simulacrum``

3 years agoRollup merge of #86775 - fee1-dead:impl-const-test, r=jonas-schievink
Yuki Okushi [Thu, 1 Jul 2021 21:20:31 +0000 (06:20 +0900)]
Rollup merge of #86775 - fee1-dead:impl-const-test, r=jonas-schievink

Test for const trait impls behind feature gates

 - Make the previous cross-crate tests use revisions instead of being separate files
 - Added test for gating const trait impls.

cc ``@oli-obk`` ``@jonas-schievink``

3 years agoRollup merge of #86768 - fee1-dead:patch-2, r=bjorn3
Yuki Okushi [Thu, 1 Jul 2021 21:20:30 +0000 (06:20 +0900)]
Rollup merge of #86768 - fee1-dead:patch-2, r=bjorn3

Add myself to mailmap

3 years agoRollup merge of #86659 - notriddle:notriddle/generics-rustdoc, r=GuillaumeGomez
Yuki Okushi [Thu, 1 Jul 2021 21:20:29 +0000 (06:20 +0900)]
Rollup merge of #86659 - notriddle:notriddle/generics-rustdoc, r=GuillaumeGomez

fix(rustdoc): generics search

This commit adds a test case for generics, re-adds generics data
to the search index, and tweaks function indexing to use less space in JSON.

This partially reverts commit 14ca89446c076bcf484d3d05bd991a4b7985a409.

3 years agoRollup merge of #86148 - FabianWolff:issue-85855, r=varkor
Yuki Okushi [Thu, 1 Jul 2021 21:20:28 +0000 (06:20 +0900)]
Rollup merge of #86148 - FabianWolff:issue-85855, r=varkor

Check the number of generic lifetime and const parameters of intrinsics

This pull request fixes #85855. The current code for type checking intrinsics only checks the number of generic _type_ parameters, but does not check for an incorrect number of lifetime or const parameters, which can cause problems later on, such as the ICE in #85855, where the code thought that it was looking at a type parameter but found a lifetime parameter:
```
error: internal compiler error: compiler/rustc_middle/src/ty/generics.rs:188:18:
    expected type parameter, but found another generic parameter
```

The changes in this PR add checks for the number of lifetime and const parameters, expand the scope of `E0094` to also apply to these cases, and improve the error message by properly pluralizing the number of expected generic parameters.