]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoRollup merge of #83174 - camelid:borrow-help, r=oli-obk
Matthias Krüger [Sat, 11 Dec 2021 16:35:23 +0000 (17:35 +0100)]
Rollup merge of #83174 - camelid:borrow-help, r=oli-obk

Suggest using a temporary variable to fix borrowck errors

Fixes #77834.

In Rust, nesting method calls with both require `&mut` access to `self`
produces a borrow-check error:

    error[E0499]: cannot borrow `*self` as mutable more than once at a time
     --> src/lib.rs:7:14
      |
    7 |     self.foo(self.bar());
      |     ---------^^^^^^^^^^-
      |     |    |   |
      |     |    |   second mutable borrow occurs here
      |     |    first borrow later used by call
      |     first mutable borrow occurs here

That's because Rust has a left-to-right evaluation order, and the method
receiver is passed first. Thus, the argument to the method cannot then
mutate `self`.

There's an easy solution to this error: just extract a local variable
for the inner argument:

    let tmp = self.bar();
    self.foo(tmp);

However, the error doesn't give any suggestion of how to solve the
problem. As a result, new users may assume that it's impossible to
express their code correctly and get stuck.

This commit adds a (non-structured) suggestion to extract a local
variable for the inner argument to solve the error. The suggestion uses
heuristics that eliminate most false positives, though there are a few
false negatives (cases where the suggestion should be emitted but is
not). Those other cases can be implemented in a future change.

2 years agoAuto merge of #91776 - matthiaskrgr:rollup-tlb4bw1, r=matthiaskrgr
bors [Sat, 11 Dec 2021 10:37:52 +0000 (10:37 +0000)]
Auto merge of #91776 - matthiaskrgr:rollup-tlb4bw1, r=matthiaskrgr

Rollup of 6 pull requests

Successful merges:

 - #91127 (Add `<*{const|mut} T>::{to|from}_bits`)
 - #91310 (Add --out-dir flag for rustdoc)
 - #91373 (Add needs-unwind to tests that depend on panicking)
 - #91426 (Make IdFunctor::try_map_id panic-safe)
 - #91515 (Add rsplit_array variants to slices and arrays)
 - #91553 (socket ancillary data implementation for dragonflybsd.)

Failed merges:

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

2 years agoRollup merge of #91553 - devnexen:anc_data_dfbsd, r=yaahc
Matthias Krüger [Sat, 11 Dec 2021 07:22:33 +0000 (08:22 +0100)]
Rollup merge of #91553 - devnexen:anc_data_dfbsd, r=yaahc

socket ancillary data implementation for dragonflybsd.

2 years agoRollup merge of #91515 - jethrogb:rsplit_array, r=yaahc
Matthias Krüger [Sat, 11 Dec 2021 07:22:32 +0000 (08:22 +0100)]
Rollup merge of #91515 - jethrogb:rsplit_array, r=yaahc

Add rsplit_array variants to slices and arrays

By request: https://github.com/rust-lang/rust/issues/90091#issuecomment-985903239

r? `@yaahc`

2 years agoRollup merge of #91426 - eggyal:idfunctor-panic-safety, r=lcnr
Matthias Krüger [Sat, 11 Dec 2021 07:22:32 +0000 (08:22 +0100)]
Rollup merge of #91426 - eggyal:idfunctor-panic-safety, r=lcnr

Make IdFunctor::try_map_id panic-safe

Addresses FIXME comment created in #78313

r? ```@lcnr```

2 years agoRollup merge of #91373 - djkoloski:fuchsia_test_suite, r=Mark-Simulacrum
Matthias Krüger [Sat, 11 Dec 2021 07:22:31 +0000 (08:22 +0100)]
Rollup merge of #91373 - djkoloski:fuchsia_test_suite, r=Mark-Simulacrum

Add needs-unwind to tests that depend on panicking

These tests were found by running the test suite on fuchsia which compiles with `panic=abort` by default, then picking through the failures manually to locate the tests that require unwinding support.

Most of these tests are already opted-out on platforms that compile with `panic=abort` by default. This just generalizes it a bit more so that fuchsia tests can be run properly. Currently, the `needs-unwind` directive needs to be manually passed to compiletest (e.g. via `--test-args '--target-panic=abort'`). Eventually, I would like `x.py` or compiletest to determine whether the directive should be used automatically based on the target panic settings.

2 years agoRollup merge of #91310 - hi-rustin:rustin-patch-rustdoc, r=jyn514
Matthias Krüger [Sat, 11 Dec 2021 07:22:30 +0000 (08:22 +0100)]
Rollup merge of #91310 - hi-rustin:rustin-patch-rustdoc, r=jyn514

Add --out-dir flag for rustdoc

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

Add --out-dir flag for rustdoc and change the `-o` option to point to out-dir.

I'm not quite sure if it should be stable, also I'm not sure if this parameter priority is appropriate? Or should I just refuse to pass both parameters at the same time?

r? `@jyn514`

2 years agoRollup merge of #91127 - scottmcm:ptr_to_from_bits, r=dtolnay
Matthias Krüger [Sat, 11 Dec 2021 07:22:29 +0000 (08:22 +0100)]
Rollup merge of #91127 - scottmcm:ptr_to_from_bits, r=dtolnay

Add `<*{const|mut} T>::{to|from}_bits`

Named based on the floating-point methods of the same name, as those are also about returning the *representation* of the value.

Tracking issue: https://github.com/rust-lang/rust/issues/91126

Based on the conversation in https://rust-lang.zulipchat.com/#narrow/stream/219381-t-libs/topic/Adding.20methods.20as.20more.20specific.20versions.20of.20.60as.60/near/238391074

r? `@joshtriplett`

2 years agoAuto merge of #91720 - Aaron1011:skip-llvm-ci-tools, r=Mark-Simulacrum
bors [Sat, 11 Dec 2021 06:58:24 +0000 (06:58 +0000)]
Auto merge of #91720 - Aaron1011:skip-llvm-ci-tools, r=Mark-Simulacrum

Don't copy llvm tools to sysroot when using download-ci-llvm

Fixes #91710

2 years agoAuto merge of #91761 - matthiaskrgr:rollup-bjowmvz, r=matthiaskrgr
bors [Sat, 11 Dec 2021 03:52:12 +0000 (03:52 +0000)]
Auto merge of #91761 - matthiaskrgr:rollup-bjowmvz, r=matthiaskrgr

Rollup of 11 pull requests

Successful merges:

 - #91668 (Remove the match on `ErrorKind::Other`)
 - #91678 (Add tests fixed by #90023)
 - #91679 (Move core/stream/stream/mod.rs to core/stream/stream.rs)
 - #91681 (fix typo in `intrinsics::raw_eq` docs)
 - #91686 (Fix `Vec::reserve_exact` documentation)
 - #91697 (Delete Utf8Lossy::from_str)
 - #91706 (Add unstable book entries for parts of asm that are not being stabilized)
 - #91709 (Replace iterator-based set construction by *Set::From<[T; N]>)
 - #91716 (Improve x.py logging and defaults a bit more)
 - #91747 (Add pierwill to .mailmap)
 - #91755 (Fix since attribute for const_linked_list_new feature)

Failed merges:

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

2 years agoAuto merge of #91715 - the8472:bump-rmeta-fromat-version, r=Mark-Simulacrum
bors [Sat, 11 Dec 2021 01:00:14 +0000 (01:00 +0000)]
Auto merge of #91715 - the8472:bump-rmeta-fromat-version, r=Mark-Simulacrum

Bump rmeta version to fix rustc_serialize ICE

#91407 changed the serialization format which leads to ICEs for nightly users such as #91663 and linked issues. The issue can be solved by running `cargo clean`. But bumping the metadata version should lead to the cached files being discarded, avoiding the issue entirely.

2 years agoSuggest using a temporary variable to fix borrowck errors
Noah Lev [Mon, 15 Mar 2021 22:09:06 +0000 (15:09 -0700)]
Suggest using a temporary variable to fix borrowck errors

In Rust, nesting method calls with both require `&mut` access to `self`
produces a borrow-check error:

    error[E0499]: cannot borrow `*self` as mutable more than once at a time
     --> src/lib.rs:7:14
      |
    7 |     self.foo(self.bar());
      |     ---------^^^^^^^^^^-
      |     |    |   |
      |     |    |   second mutable borrow occurs here
      |     |    first borrow later used by call
      |     first mutable borrow occurs here

That's because Rust has a left-to-right evaluation order, and the method
receiver is passed first. Thus, the argument to the method cannot then
mutate `self`.

There's an easy solution to this error: just extract a local variable
for the inner argument:

    let tmp = self.bar();
    self.foo(tmp);

However, the error doesn't give any suggestion of how to solve the
problem. As a result, new users may assume that it's impossible to
express their code correctly and get stuck.

This commit adds a (non-structured) suggestion to extract a local
variable for the inner argument to solve the error. The suggestion uses
heuristics that eliminate most false positives, though there are a few
false negatives (cases where the suggestion should be emitted but is
not). Those other cases can be implemented in a future change.

2 years agoAuto merge of #91760 - matthiaskrgr:rollup-zcemh6j, r=matthiaskrgr
bors [Fri, 10 Dec 2021 21:59:07 +0000 (21:59 +0000)]
Auto merge of #91760 - matthiaskrgr:rollup-zcemh6j, r=matthiaskrgr

Rollup of 10 pull requests

Successful merges:

 - #90407 (Document all public items in `rustc_incremental`)
 - #90897 (Fix incorrect stability attributes)
 - #91105 (Fix method name reference in stream documentation)
 - #91325 (adjust const_eval_select documentation)
 - #91470 (code-cov: generate dead functions with private/default linkage)
 - #91482 (Update documentation to use `from()` to initialize `HashMap`s and `BTreeMap`s)
 - #91524 (Fix Vec::extend_from_slice docs)
 - #91575 (Fix ICE on format string of macro with secondary-label)
 - #91625 (Remove redundant [..]s)
 - #91646 (Fix documentation for `core::ready::Ready`)

Failed merges:

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

2 years agoRollup merge of #91755 - not-my-profile:fix-const_linked_list_new-since, r=dtolnay
Matthias Krüger [Fri, 10 Dec 2021 21:41:31 +0000 (22:41 +0100)]
Rollup merge of #91755 - not-my-profile:fix-const_linked_list_new-since, r=dtolnay

Fix since attribute for const_linked_list_new feature

https://github.com/rust-lang/rust/pull/63684
was merged for 1.39 not 1.32

2 years agoRollup merge of #91747 - pierwill:patch-1, r=Mark-Simulacrum
Matthias Krüger [Fri, 10 Dec 2021 21:41:30 +0000 (22:41 +0100)]
Rollup merge of #91747 - pierwill:patch-1, r=Mark-Simulacrum

Add pierwill to .mailmap

2 years agoRollup merge of #91716 - jyn514:x.py-defaults, r=Mark-Simulacrum
Matthias Krüger [Fri, 10 Dec 2021 21:41:29 +0000 (22:41 +0100)]
Rollup merge of #91716 - jyn514:x.py-defaults, r=Mark-Simulacrum

Improve x.py logging and defaults a bit more

r? ```@Mark-Simulacrum```

2 years agoRollup merge of #91709 - juniorbassani:use-from-array-in-set-examples, r=jyn514
Matthias Krüger [Fri, 10 Dec 2021 21:41:28 +0000 (22:41 +0100)]
Rollup merge of #91709 - juniorbassani:use-from-array-in-set-examples, r=jyn514

Replace iterator-based set construction by *Set::From<[T; N]>

This uses the array-based construction for `BtreeSet`s and `HashSet`s instead of first creating an iterator. I could also replace the `let mut a = Set::new(); a.insert(...);` fragments if desired.

2 years agoRollup merge of #91706 - Amanieu:asm_unstable_book2, r=joshtriplett
Matthias Krüger [Fri, 10 Dec 2021 21:41:27 +0000 (22:41 +0100)]
Rollup merge of #91706 - Amanieu:asm_unstable_book2, r=joshtriplett

Add unstable book entries for parts of asm that are not being stabilized

These are extracted from the existing `asm` documentation in the unstable book that will be removed when `asm` is stabilized.

r? ```@joshtriplett```

2 years agoRollup merge of #91697 - dtolnay:lossyfromstr, r=Mark-Simulacrum
Matthias Krüger [Fri, 10 Dec 2021 21:41:26 +0000 (22:41 +0100)]
Rollup merge of #91697 - dtolnay:lossyfromstr, r=Mark-Simulacrum

Delete Utf8Lossy::from_str

This whole type is marked as being for str internals only, but this constructor is never used by str internals. If you had a &amp;str already and wanted to lossy display it or iterate its lossy utf8 chunks, you would simply not use Utf8Lossy because the whole &amp;str is known to be one contiguous valid utf8 chunk.

If code really does need to obtain a value of type &amp;Utf8Lossy somewhere, and has only a &amp;str, `Utf8Lossy::from_bytes(s.as_bytes())` remains available. As currently implemented, there is no performance penalty relative to `from_str` i.e. the Utf8Lossy does not "remember" that it was constructed using `from_str` to bypass later utf8 decoding.

2 years agoRollup merge of #91686 - dalcde:patch-1, r=dtolnay
Matthias Krüger [Fri, 10 Dec 2021 21:41:25 +0000 (22:41 +0100)]
Rollup merge of #91686 - dalcde:patch-1, r=dtolnay

Fix `Vec::reserve_exact` documentation

The documentation previously said the new capacity cannot overflow `usize`, but in fact it cannot exceed `isize::MAX`.

2 years agoRollup merge of #91681 - WaffleLapkin:patch-3, r=scottmcm
Matthias Krüger [Fri, 10 Dec 2021 21:41:24 +0000 (22:41 +0100)]
Rollup merge of #91681 - WaffleLapkin:patch-3, r=scottmcm

fix typo in `intrinsics::raw_eq` docs

2 years agoRollup merge of #91679 - ibraheemdev:stream-mod, r=Mark-Simulacrum
Matthias Krüger [Fri, 10 Dec 2021 21:41:23 +0000 (22:41 +0100)]
Rollup merge of #91679 - ibraheemdev:stream-mod, r=Mark-Simulacrum

Move core/stream/stream/mod.rs to core/stream/stream.rs

Removes an unnecessary nested module.

2 years agoRollup merge of #91678 - b-naber:tests-for-postpone-const-eval, r=jackh726
Matthias Krüger [Fri, 10 Dec 2021 21:41:22 +0000 (22:41 +0100)]
Rollup merge of #91678 - b-naber:tests-for-postpone-const-eval, r=jackh726

Add tests fixed by #90023

The following issues were fixed by https://github.com/rust-lang/rust/pull/90023

Fixes https://github.com/rust-lang/rust/issues/79674
Fixes https://github.com/rust-lang/rust/issues/83765
Fixes https://github.com/rust-lang/rust/issues/86033
Fixes https://github.com/rust-lang/rust/issues/90318
Fixes https://github.com/rust-lang/rust/issues/88468

The following issues were duplicates of https://github.com/rust-lang/rust/issues/90654

Fixes https://github.com/rust-lang/rust/issues/86850
Fixes https://github.com/rust-lang/rust/issues/89022

r? ````@jackh726````

2 years agoRollup merge of #91668 - ChrisDenton:bootstrap-clean-error, r=Mark-Simulacrum
Matthias Krüger [Fri, 10 Dec 2021 21:41:22 +0000 (22:41 +0100)]
Rollup merge of #91668 - ChrisDenton:bootstrap-clean-error, r=Mark-Simulacrum

Remove the match on `ErrorKind::Other`

It's a) superfluous and b) doesn't work any more.

2 years agoRollup merge of #91646 - ibraheemdev:patch-9, r=dtolnay
Matthias Krüger [Fri, 10 Dec 2021 21:40:37 +0000 (22:40 +0100)]
Rollup merge of #91646 - ibraheemdev:patch-9, r=dtolnay

Fix documentation for `core::ready::Ready`

2 years agoRollup merge of #91625 - est31:remove_indexes, r=oli-obk
Matthias Krüger [Fri, 10 Dec 2021 21:40:36 +0000 (22:40 +0100)]
Rollup merge of #91625 - est31:remove_indexes, r=oli-obk

Remove redundant [..]s

2 years agoRollup merge of #91575 - compiler-errors:issue-91556, r=cjgillot
Matthias Krüger [Fri, 10 Dec 2021 21:40:35 +0000 (22:40 +0100)]
Rollup merge of #91575 - compiler-errors:issue-91556, r=cjgillot

Fix ICE on format string of macro with secondary-label

This generalizes the fix #86104 to also correctly skip `Span::from_inner` for the `secondary_label` of a format macro parsing error as well.

We can alternatively skip the `span_label` diagnostic call for the secondary label as well, since that label probably only makes sense when the _proper_ span is computed.

Fixes #91556

2 years agoRollup merge of #91524 - rukai:fix_extend_from_slice_docs, r=dtolnay
Matthias Krüger [Fri, 10 Dec 2021 21:40:34 +0000 (22:40 +0100)]
Rollup merge of #91524 - rukai:fix_extend_from_slice_docs, r=dtolnay

Fix Vec::extend_from_slice docs

`other` is a slice not a vector.

2 years agoRollup merge of #91482 - JosephTLyons:update-HashMap-and-BTreeMap-documentation,...
Matthias Krüger [Fri, 10 Dec 2021 21:40:33 +0000 (22:40 +0100)]
Rollup merge of #91482 - JosephTLyons:update-HashMap-and-BTreeMap-documentation, r=yaahc

Update documentation to use `from()` to initialize `HashMap`s and `BTreeMap`s

As of Rust 1.56, `HashMap` and `BTreeMap` both have associated `from()` functions.  I think using these in the documentation cleans things up a bit.  It allows us to remove some of the `mut`s and avoids the Initialize-Then-Modify anti-pattern.

2 years agoRollup merge of #91470 - wesleywiser:code_coverage_link_error, r=tmandry
Matthias Krüger [Fri, 10 Dec 2021 21:40:32 +0000 (22:40 +0100)]
Rollup merge of #91470 - wesleywiser:code_coverage_link_error, r=tmandry

code-cov: generate dead functions with private/default linkage

As discovered in #85461, the MSVC linker treats weak symbols slightly
differently than unix-y linkers do. This causes link.exe to fail with
LNK1227 "conflicting weak extern definition" where as other targets are
able to link successfully.

This changes the dead functions from being generated as weak/hidden to
private/default which, as the LLVM reference says:

> Global values with “private” linkage are only directly accessible by
objects in the current module. In particular, linking code into a module
with a private global value may cause the private to be renamed as
necessary to avoid collisions. Because the symbol is private to the
module, all references can be updated. This doesn’t show up in any
symbol table in the object file.

This fixes the conflicting weak symbols but doesn't address the reason
*why* we have conflicting symbols for these dead functions. The test
cases added in this commit contain a minimal repro of the fundamental
issue which is that the logic used to decide what dead code functions
should be codegen'd in the current CGU doesn't take into account that
functions can be duplicated across multiple CGUs (for instance, in the
case of `#[inline(always)]` functions).

Fixing that is likely to be a more complex change (see
https://github.com/rust-lang/rust/issues/85461#issuecomment-985005805).

Fixes #85461

2 years agoRollup merge of #91325 - RalfJung:const_eval_select, r=dtolnay
Matthias Krüger [Fri, 10 Dec 2021 21:40:32 +0000 (22:40 +0100)]
Rollup merge of #91325 - RalfJung:const_eval_select, r=dtolnay

adjust const_eval_select documentation

"The Rust compiler assumes" indicates that this is language UB, but [I don't think that is a good idea](https://rust-lang.zulipchat.com/#narrow/stream/146212-t-compiler.2Fconst-eval/topic/const_eval_select.20assumptions). This UB would be very hard to test for and looks like a way-too-big footgun. ``@oli-obk`` suggested this is meant to be more like "library UB", so I tried to adjust the docs accordingly.

I also removed all references to "referential transparency". That is a rather vague concept used to mean many different things, and I honestly have no idea what exactly is meant by it in this specific instance. But I assume ``@fee1-dead`` had in their mind a property that all `const fn` code upholds, so by demanding that the runtime code and the const-time code are *observably equivalent*, whatever that property is would also be enforced here.

Cc ``@rust-lang/wg-const-eval``

2 years agoRollup merge of #91105 - jplatte:stream-docs, r=dtolnay
Matthias Krüger [Fri, 10 Dec 2021 21:40:31 +0000 (22:40 +0100)]
Rollup merge of #91105 - jplatte:stream-docs, r=dtolnay

Fix method name reference in stream documentation

2 years agoRollup merge of #90897 - jhpratt:fix-incorrect-feature-flags, r=dtolnay
Matthias Krüger [Fri, 10 Dec 2021 21:40:29 +0000 (22:40 +0100)]
Rollup merge of #90897 - jhpratt:fix-incorrect-feature-flags, r=dtolnay

Fix incorrect stability attributes

These two instances were caught in #90356, but that PR isn't going to be merged. I've extracted these to ensure it's still correct.

``@rustbot`` label: +A-stability +C-cleanup +S-waiting-on-review

2 years agoRollup merge of #90407 - pierwill:edit-rustc-incremental-docs, r=cjgillot
Matthias Krüger [Fri, 10 Dec 2021 21:40:28 +0000 (22:40 +0100)]
Rollup merge of #90407 - pierwill:edit-rustc-incremental-docs, r=cjgillot

Document all public items in `rustc_incremental`

Also:

- Review and edit current docs
- Enforce documentation for the module.

2 years agoAdd rsplit_array variants to slices and arrays
Jethro Beekman [Sat, 4 Dec 2021 09:32:09 +0000 (10:32 +0100)]
Add rsplit_array variants to slices and arrays

2 years agoFix since attribute for const_linked_list_new feature
Martin Fischer [Fri, 10 Dec 2021 19:20:24 +0000 (20:20 +0100)]
Fix since attribute for const_linked_list_new feature

https://github.com/rust-lang/rust/pull/63684
was merged for 1.39 not 1.32

2 years agoAdd pierwill to .mailmap
pierwill [Fri, 10 Dec 2021 16:06:20 +0000 (10:06 -0600)]
Add pierwill to .mailmap

2 years agoAdd needs-unwind to tests that depend on panicking
David Koloski [Fri, 3 Dec 2021 15:32:51 +0000 (15:32 +0000)]
Add needs-unwind to tests that depend on panicking

This directive isn't automatically set by compiletest or x.py, but can
be turned on manually for targets that require it.

2 years agoDon't copy llvm tools to sysroot when using download-ci-llvm
Aaron Hill [Thu, 9 Dec 2021 18:21:00 +0000 (12:21 -0600)]
Don't copy llvm tools to sysroot when using download-ci-llvm

Fixes #91710

2 years agoDefault to `doc-stage = 2` for the tools profile
Joshua Nelson [Thu, 9 Dec 2021 17:20:55 +0000 (11:20 -0600)]
Default to `doc-stage = 2` for the tools profile

This already enables `download-rustc`, so it's quick to build rustdoc,
and this makes it less confusing when changes to rustdoc aren't reflected in the docs.

Note that this uses 2 and not 1 because `download-rustc` only affects stage 2 runs.

2 years agoDon't print bootstrap caching/ensure info unless `-vv` is passed
Joshua Nelson [Thu, 9 Dec 2021 17:15:38 +0000 (11:15 -0600)]
Don't print bootstrap caching/ensure info unless `-vv` is passed

Previously, passing `-v` would emit an overwhelming amount of logging:

```
> Std { stage: 1, target: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } }
  > Assemble { target_compiler: Compiler { stage: 1, host: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } } }
    > Assemble { target_compiler: Compiler { stage: 0, host: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } } }
    < Assemble { target_compiler: Compiler { stage: 0, host: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } } }
    > Rustc { target: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None }, compiler: Compiler { stage: 0, host: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } } }
      > Std { target: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None }, compiler: Compiler { stage: 0, host: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } } }
        > StartupObjects { compiler: Compiler { stage: 0, host: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } }, target: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } }
        < StartupObjects { compiler: Compiler { stage: 0, host: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } }, target: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } }
        c Assemble { target_compiler: Compiler { stage: 0, host: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } } }
        > Libdir { compiler: Compiler { stage: 0, host: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } }, target: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } }
          > Sysroot { compiler: Compiler { stage: 0, host: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } } }
          < Sysroot { compiler: Compiler { stage: 0, host: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } } }
        < Libdir { compiler: Compiler { stage: 0, host: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } }, target: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } }
        c Libdir { compiler: Compiler { stage: 0, host: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } }, target: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } }
        c Sysroot { compiler: Compiler { stage: 0, host: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } } }
        c Assemble { target_compiler: Compiler { stage: 0, host: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } } }
        > StdLink { compiler: Compiler { stage: 0, host: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } }, target_compiler: Compiler { stage: 0, host: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } }, target: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } }
          c Libdir { compiler: Compiler { stage: 0, host: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } }, target: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } }
          c Libdir { compiler: Compiler { stage: 0, host: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } }, target: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } }
        < StdLink { compiler: Compiler { stage: 0, host: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } }, target_compiler: Compiler { stage: 0, host: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } }, target: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } }
      < Std { target: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None }, compiler: Compiler { stage: 0, host: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } } }
... continues for another 150 lines ...
```

This info is occasionally useful when debugging bootstrap itself, but not very useful for figuring
out why a config option was ignored or command wasn't run.  Demote it to `-vv` logging so that `-v`
is more useful.

2 years agoIf --verbose is passed, print a warning in `bootstrap.py` when download-rustc is...
Joshua Nelson [Thu, 9 Dec 2021 17:15:05 +0000 (11:15 -0600)]
If --verbose is passed, print a warning in `bootstrap.py` when download-rustc is ignored

2 years agoUse more accurate wording in `bootstrap.py` logging
Joshua Nelson [Thu, 9 Dec 2021 17:14:49 +0000 (11:14 -0600)]
Use more accurate wording in `bootstrap.py` logging

2 years agoFix span calculation on secondary_label as well
Michael Goulet [Sun, 5 Dec 2021 23:55:41 +0000 (15:55 -0800)]
Fix span calculation on secondary_label as well

2 years agoBump rmeta version to fix rustc_serialize ICE
The 8472 [Thu, 9 Dec 2021 17:00:36 +0000 (18:00 +0100)]
Bump rmeta version to fix rustc_serialize ICE

#91407 changed the serialization format which leads to ICEs for nightly users such as #91663 and linked issue.
Bumping the metadata version should lead to the cached files being discarded instead.

2 years agoAuto merge of #85157 - the8472:drain-drop-in-place, r=Mark-Simulacrum
bors [Thu, 9 Dec 2021 15:01:42 +0000 (15:01 +0000)]
Auto merge of #85157 - the8472:drain-drop-in-place, r=Mark-Simulacrum

replace vec::Drain drop loops with drop_in_place

The `Drain::drop` implementation came up in https://github.com/rust-lang/rust/pull/82185#issuecomment-789584796 as potentially interfering with other optimization work due its widespread use somewhere in `println!`

`@rustbot` label T-libs-impl

2 years agoReplace iterator-based set construction by *Set::From<[T; N]>
Júnior Bassani [Thu, 9 Dec 2021 14:56:19 +0000 (11:56 -0300)]
Replace iterator-based set construction by *Set::From<[T; N]>

2 years agoAdd reminder to match the error kind once ` DirectoryNotEmpty` is stabilized
Chris Denton [Thu, 9 Dec 2021 14:39:30 +0000 (14:39 +0000)]
Add reminder to match the error kind once ` DirectoryNotEmpty` is stabilized

2 years agoAdd unstable book entries for parts of asm that are not being stabilized
Amanieu d'Antras [Thu, 9 Dec 2021 13:55:16 +0000 (13:55 +0000)]
Add unstable book entries for parts of asm that are not being stabilized

2 years agoAuto merge of #81156 - DrMeepster:read_buf, r=joshtriplett
bors [Thu, 9 Dec 2021 10:11:55 +0000 (10:11 +0000)]
Auto merge of #81156 - DrMeepster:read_buf, r=joshtriplett

Implement most of RFC 2930, providing the ReadBuf abstraction

This replaces the `Initializer` abstraction for permitting reading into uninitialized buffers, closing #42788.

This leaves several APIs described in the RFC out of scope for the initial implementation:

* read_buf_vectored
* `ReadBufs`

Closes #42788, by removing the relevant APIs.

2 years agoAuto merge of #91692 - matthiaskrgr:rollup-u7dvh0n, r=matthiaskrgr
bors [Thu, 9 Dec 2021 07:08:32 +0000 (07:08 +0000)]
Auto merge of #91692 - matthiaskrgr:rollup-u7dvh0n, r=matthiaskrgr

Rollup of 6 pull requests

Successful merges:

 - #87599 (Implement concat_bytes!)
 - #89999 (Update std::env::temp_dir to use GetTempPath2 on Windows when available.)
 - #90796 (Remove the reg_thumb register class for asm! on ARM)
 - #91042 (Use Vec extend instead of repeated pushes on several places)
 - #91634 (Do not attempt to suggest help for overly malformed struct/function call)
 - #91685 (Install llvm tools to sysroot when assembling local toolchain)

Failed merges:

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

2 years agoDelete Utf8Lossy::from_str
David Tolnay [Thu, 9 Dec 2021 06:54:51 +0000 (22:54 -0800)]
Delete Utf8Lossy::from_str

2 years agoRollup merge of #91685 - Aaron1011:install-llvm-tools, r=Mark-Simulacrum
Matthias Krüger [Thu, 9 Dec 2021 04:08:34 +0000 (05:08 +0100)]
Rollup merge of #91685 - Aaron1011:install-llvm-tools, r=Mark-Simulacrum

Install llvm tools to sysroot when assembling local toolchain

Some projects (e.g. the `bootimage` crate) may require the
user to install the `llvm-tools-preview` rustup component.
However, this cannot be easily done with a locally built toolchain.

To allow a local toolchain to be used a drop-in replacement for
a normal rustup toolchain in more cases, this PR copies the built
LLVM tools to the sysoot. From the perspective a tool looking
at the sysroot, this is equivalent to installing `llvm-tools-preview`.

2 years agoRollup merge of #91634 - terrarier2111:fix-recover-from-variant-ice, r=nagisa
Matthias Krüger [Thu, 9 Dec 2021 04:08:33 +0000 (05:08 +0100)]
Rollup merge of #91634 - terrarier2111:fix-recover-from-variant-ice, r=nagisa

Do not attempt to suggest help for overly malformed struct/function call

This fixes: https://github.com/rust-lang/rust/issues/91461

2 years agoRollup merge of #91042 - Kobzol:vec-extend-cleanup, r=nagisa
Matthias Krüger [Thu, 9 Dec 2021 04:08:33 +0000 (05:08 +0100)]
Rollup merge of #91042 - Kobzol:vec-extend-cleanup, r=nagisa

Use Vec extend instead of repeated pushes on several places

Inspired by https://github.com/rust-lang/rust/pull/90813, I tried to use a simple regex (`for .*in.*\{\n.*push\(.*\);\n\s+}`) to search for more places that would use `Vec::push` in a loop and replace them with `Vec::extend`.

These probably won't have as much perf. impact as the original PR (if any), but it would probably be better to do a perf run to see if there are not any regressions.

2 years agoRollup merge of #90796 - Amanieu:remove_reg_thumb, r=joshtriplett
Matthias Krüger [Thu, 9 Dec 2021 04:08:32 +0000 (05:08 +0100)]
Rollup merge of #90796 - Amanieu:remove_reg_thumb, r=joshtriplett

Remove the reg_thumb register class for asm! on ARM

Also restricts r8-r14 from being used on Thumb1 targets as per #90736.

cc ``@Lokathor``

r? ``@joshtriplett``

2 years agoRollup merge of #89999 - talagrand:GetTempPath2, r=m-ou-se
Matthias Krüger [Thu, 9 Dec 2021 04:08:31 +0000 (05:08 +0100)]
Rollup merge of #89999 - talagrand:GetTempPath2, r=m-ou-se

Update std::env::temp_dir to use GetTempPath2 on Windows when available.

As a security measure, Windows 11 introduces a new temporary directory API, GetTempPath2.
When the calling process is running as SYSTEM, a separate temporary directory
will be returned inaccessible to non-SYSTEM processes. For non-SYSTEM processes
the behavior will be the same as before.

This can help mitigate against attacks such as this one:
https://medium.com/csis-techblog/cve-2020-1088-yet-another-arbitrary-delete-eop-a00b97d8c3e2

Compatibility risk: Software which relies on temporary files to communicate between SYSTEM and non-SYSTEM
processes may be affected by this change. In many cases, such patterns may be vulnerable to the very
attacks the new API was introduced to harden against.
I'm unclear on the Rust project's tolerance for such change-of-behavior in the standard library. If anything,
this PR is meant to raise awareness of the issue and hopefully start the conversation.

How tested: Taking the example code from the documentation and running it through psexec (from SysInternals) on
Win10 and Win11.
On Win10:
C:\test>psexec -s C:\test\main.exe
<...>
Temporary directory: C:\WINDOWS\TEMP\

On Win11:
C:\test>psexec -s C:\test\main.exe
<...>
Temporary directory: C:\Windows\SystemTemp\

2 years agoRollup merge of #87599 - Smittyvb:concat_bytes, r=Mark-Simulacrum
Matthias Krüger [Thu, 9 Dec 2021 04:08:30 +0000 (05:08 +0100)]
Rollup merge of #87599 - Smittyvb:concat_bytes, r=Mark-Simulacrum

Implement concat_bytes!

This implements the unstable `concat_bytes!` macro, which has tracking issue #87555. It can be used like:
```rust
#![feature(concat_bytes)]

fn main() {
    assert_eq!(concat_bytes!(), &[]);
    assert_eq!(concat_bytes!(b'A', b"BC", [68, b'E', 70]), b"ABCDEF");
}
```
If strings or characters are used where byte strings or byte characters are required, it suggests adding a `b` prefix. If a number is used outside of an array it suggests arrayifying it. If a boolean is used it suggests replacing it with the numeric value of that number. Doubly nested arrays of bytes are disallowed.

2 years agoAuto merge of #91691 - matthiaskrgr:rollup-wfommdr, r=matthiaskrgr
bors [Thu, 9 Dec 2021 04:04:01 +0000 (04:04 +0000)]
Auto merge of #91691 - matthiaskrgr:rollup-wfommdr, r=matthiaskrgr

Rollup of 5 pull requests

Successful merges:

 - #91042 (Use Vec extend instead of repeated pushes on several places)
 - #91476 (Improve 'cannot contain emoji' error.)
 - #91568 (Pretty print break and continue without redundant space)
 - #91645 (Implement `core::future::join!`)
 - #91666 (update Miri)

Failed merges:

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

2 years agoRollup merge of #91666 - RalfJung:miri, r=RalfJung
Matthias Krüger [Thu, 9 Dec 2021 04:02:23 +0000 (05:02 +0100)]
Rollup merge of #91666 - RalfJung:miri, r=RalfJung

update Miri

Fixes https://github.com/rust-lang/rust/issues/91649
r? `@ghost`

2 years agoRollup merge of #91645 - ibraheemdev:future-join, r=joshtriplett
Matthias Krüger [Thu, 9 Dec 2021 04:02:22 +0000 (05:02 +0100)]
Rollup merge of #91645 - ibraheemdev:future-join, r=joshtriplett

Implement `core::future::join!`

`join!` polls multiple futures concurrently and returns their outputs.

```rust
async fn run() {
    let (a, b) = join!(async { 0 }, async { 1 });
}
```

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

2 years agoRollup merge of #91568 - dtolnay:breakspace, r=nagisa
Matthias Krüger [Thu, 9 Dec 2021 04:02:21 +0000 (05:02 +0100)]
Rollup merge of #91568 - dtolnay:breakspace, r=nagisa

Pretty print break and continue without redundant space

**Repro:**

```rust
macro_rules! m {
    ($e:expr) => { stringify!($e) };
}
fn main() {
    println!("{:?}", m!(loop { break; }));
    println!("{:?}", m!(loop { break 'a; }));
    println!("{:?}", m!(loop { break false; }));
}
```

**Before:**

- `"loop { break ; }"`
- `"loop { break 'a ; }"`
- `"loop { break false ; }"`

**After:**

- `"loop { break; }"`
- `"loop { break 'a; }"`
- `"loop { break false; }"`

<br>

Notice that `return` and `yield` already follow the same approach as this PR of printing the space *before* each additional piece following the keyword, rather than *after* each thing.

https://github.com/rust-lang/rust/blob/772d51f887fa407216860bf8ecf3f1a32fb795b4/compiler/rustc_ast_pretty/src/pprust/state.rs#L2148-L2154

https://github.com/rust-lang/rust/blob/772d51f887fa407216860bf8ecf3f1a32fb795b4/compiler/rustc_ast_pretty/src/pprust/state.rs#L2221-L2228

2 years agoRollup merge of #91476 - m-ou-se:ferris-identifier, r=estebank
Matthias Krüger [Thu, 9 Dec 2021 04:02:20 +0000 (05:02 +0100)]
Rollup merge of #91476 - m-ou-se:ferris-identifier, r=estebank

Improve 'cannot contain emoji' error.

Before:

```
error: identifiers cannot contain emoji: `🦀`
 --> src/main.rs:2:9
  |
2 |     let 🦀 = 1;
  |         ^^
```

After:
```
error: Ferris cannot be used as an identifier
 --> src/main.rs:2:9
  |
2 |     let 🦀 = 1;
  |         ^^ help: try using their name instead: `ferris`
```

r? `@estebank`

2 years agoRollup merge of #91042 - Kobzol:vec-extend-cleanup, r=nagisa
Matthias Krüger [Thu, 9 Dec 2021 04:02:19 +0000 (05:02 +0100)]
Rollup merge of #91042 - Kobzol:vec-extend-cleanup, r=nagisa

Use Vec extend instead of repeated pushes on several places

Inspired by https://github.com/rust-lang/rust/pull/90813, I tried to use a simple regex (`for .*in.*\{\n.*push\(.*\);\n\s+}`) to search for more places that would use `Vec::push` in a loop and replace them with `Vec::extend`.

These probably won't have as much perf. impact as the original PR (if any), but it would probably be better to do a perf run to see if there are not any regressions.

2 years agoFix `Vec::reserve_exact` documentation
Dexter Chua [Thu, 9 Dec 2021 01:00:19 +0000 (20:00 -0500)]
Fix `Vec::reserve_exact` documentation

The documentation previously said the new capacity cannot overflow `usize`, but in fact it cannot exceed `isize::MAX`.

2 years agoAuto merge of #91677 - matthiaskrgr:rollup-yiczced, r=matthiaskrgr
bors [Thu, 9 Dec 2021 00:55:49 +0000 (00:55 +0000)]
Auto merge of #91677 - matthiaskrgr:rollup-yiczced, r=matthiaskrgr

Rollup of 5 pull requests

Successful merges:

 - #91245 (suggest casting between i/u32 and char)
 - #91337 (Add a suggestion if `macro_rules` is misspelled)
 - #91534 (Make rustdoc headings black, and markdown blue)
 - #91637 (Add test for packed drops in generators)
 - #91667 (Fix indent of itemTypes in search.js)

Failed merges:

 - #91568 (Pretty print break and continue without redundant space)

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

2 years agoInstall llvm tools to sysroot when assembling local toolchain
Aaron Hill [Thu, 9 Dec 2021 00:35:53 +0000 (18:35 -0600)]
Install llvm tools to sysroot when assembling local toolchain

Some projects (e.g. the `bootimage` crate) may require the
user to install the `llvm-tools-preview` rustup component.
However, this cannot be easily done with a locally built toolchain.

To allow a local toolchain to be used a drop-in replacement for
a normal rustup toolchain in more cases, this PR copies the built
LLVM tools to the sysoot. From the perspective a tool looking
at the sysroot, this is equivalent to installing `llvm-tools-preview`.

2 years agofix typo in `intrinsics::raw_eq` docs
Waffle Maybe [Wed, 8 Dec 2021 23:23:11 +0000 (02:23 +0300)]
fix typo in `intrinsics::raw_eq` docs

2 years agoUse `*mut [T]` instead of `[MaybeUninit<T>]`
The 8472 [Wed, 8 Dec 2021 23:20:13 +0000 (00:20 +0100)]
Use `*mut [T]` instead of `[MaybeUninit<T>]`

2 years agoRemove redundant [..]s
est31 [Fri, 3 Dec 2021 02:06:36 +0000 (03:06 +0100)]
Remove redundant [..]s

2 years agomove core/stream/stream/mod.rs to core/stream/stream.rs
Ibraheem Ahmed [Wed, 8 Dec 2021 22:54:05 +0000 (17:54 -0500)]
move core/stream/stream/mod.rs to core/stream/stream.rs

2 years agoadd tests
b-naber [Wed, 8 Dec 2021 22:25:52 +0000 (23:25 +0100)]
add tests

2 years agoPretty print break and continue without redundant space
David Tolnay [Sun, 5 Dec 2021 20:35:09 +0000 (12:35 -0800)]
Pretty print break and continue without redundant space

2 years agotrim down expansion of `core::future::join`
Ibraheem Ahmed [Wed, 8 Dec 2021 22:08:23 +0000 (17:08 -0500)]
trim down expansion of `core::future::join`

2 years agoRollup merge of #91667 - GuillaumeGomez:fix-index-itemtypes, r=notriddle
Matthias Krüger [Wed, 8 Dec 2021 22:18:07 +0000 (23:18 +0100)]
Rollup merge of #91667 - GuillaumeGomez:fix-index-itemtypes, r=notriddle

Fix indent of itemTypes in search.js

It has been bugging me for quite some time now. Finally took the time to clean it up a bit.

r? ```@notriddle```

2 years agoRollup merge of #91637 - tmiasko:generator-packed-drop, r=ecstatic-morse
Matthias Krüger [Wed, 8 Dec 2021 22:18:06 +0000 (23:18 +0100)]
Rollup merge of #91637 - tmiasko:generator-packed-drop, r=ecstatic-morse

Add test for packed drops in generators

r? ```@ecstatic-morse```

2 years agoRollup merge of #91534 - jsha:heading-color, r=GuillaumeGomez
Matthias Krüger [Wed, 8 Dec 2021 22:18:05 +0000 (23:18 +0100)]
Rollup merge of #91534 - jsha:heading-color, r=GuillaumeGomez

Make rustdoc headings black, and markdown blue

Demo:

https://rustdoc.crud.net/jsha/heading-color/std/string/index.html#structs
https://rustdoc.crud.net/jsha/heading-color/std/string/struct.String.html#examples

Fixes #91304

r? ```@camelid``` /cc ```@GuillaumeGomez```

(Note: we may want to make rustdoc headings and markdown headings the same color -- #90245 -- but we would want to do that intentionally; this is fixing up a change that did so accidentally)

2 years agoRollup merge of #91337 - FabianWolff:issue-91227-misspelled-macro, r=nagisa
Matthias Krüger [Wed, 8 Dec 2021 22:18:04 +0000 (23:18 +0100)]
Rollup merge of #91337 - FabianWolff:issue-91227-misspelled-macro, r=nagisa

Add a suggestion if `macro_rules` is misspelled

Fixes #91227.

2 years agoRollup merge of #91245 - cameron1024:suggest-i32-u32-char-cast, r=nagisa
Matthias Krüger [Wed, 8 Dec 2021 22:18:03 +0000 (23:18 +0100)]
Rollup merge of #91245 - cameron1024:suggest-i32-u32-char-cast, r=nagisa

suggest casting between i/u32 and char

As discussed in https://github.com/rust-lang/rust/issues/91063 , this adds a suggestion for converting between i32/u32 <-> char with `as`, and a short explanation for why this is safe

2 years agoUse Vec extend instead of repeated pushes in several places
Jakub Beránek [Wed, 8 Dec 2021 21:56:26 +0000 (22:56 +0100)]
Use Vec extend instead of repeated pushes in several places

2 years agoremove implicit .await from `core::future::join`
Ibraheem Ahmed [Wed, 8 Dec 2021 21:44:48 +0000 (16:44 -0500)]
remove implicit .await from `core::future::join`

2 years agoDo not attempt to suggest help for overly malformed struct/function call
threadexception [Tue, 7 Dec 2021 15:44:51 +0000 (16:44 +0100)]
Do not attempt to suggest help for overly malformed struct/function call

2 years agoAuto merge of #91665 - matthiaskrgr:rollup-o3wnkam, r=matthiaskrgr
bors [Wed, 8 Dec 2021 18:45:03 +0000 (18:45 +0000)]
Auto merge of #91665 - matthiaskrgr:rollup-o3wnkam, r=matthiaskrgr

Rollup of 7 pull requests

Successful merges:

 - #90709 (Only shown relevant type params in E0283 label)
 - #91551 (Allow for failure of subst_normalize_erasing_regions in const_eval)
 - #91570 (Evaluate inline const pat early and report error if too generic)
 - #91571 (Remove unneeded access to pretty printer's `s` field in favor of deref)
 - #91610 (Link to rustdoc_json_types docs instead of rustdoc-json RFC)
 - #91619 (Update cargo)
 - #91630 (Add missing whitespace before disabled HTML attribute)

Failed merges:

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

2 years agoRemove the match on `ErrorKind::Other`
Chris Denton [Wed, 8 Dec 2021 17:12:59 +0000 (17:12 +0000)]
Remove the match on `ErrorKind::Other`

It's a) superfluous and b) doesn't work any more.

2 years agoFix indent of itemTypes in search.js
Guillaume Gomez [Wed, 8 Dec 2021 16:31:56 +0000 (17:31 +0100)]
Fix indent of itemTypes in search.js

2 years agoupdate Miri
Ralf Jung [Wed, 8 Dec 2021 15:53:12 +0000 (10:53 -0500)]
update Miri

2 years agoRollup merge of #91630 - GuillaumeGomez:missing-whitespace, r=notriddle
Matthias Krüger [Wed, 8 Dec 2021 15:08:12 +0000 (16:08 +0100)]
Rollup merge of #91630 - GuillaumeGomez:missing-whitespace, r=notriddle

Add missing whitespace before disabled HTML attribute

On the [w3c HTML checker](https://validator.w3.org/nu/#textarea), with the current generated HTML we get:

![Screenshot from 2021-12-07 15-10-38](https://user-images.githubusercontent.com/3050060/145044653-b38fb679-da76-4890-853f-b696d8fdc06e.png)

The problem was that we were telling tera to remove too many whitespace.

r? ````@notriddle````

2 years agoRollup merge of #91619 - ehuss:update-cargo, r=ehuss
Matthias Krüger [Wed, 8 Dec 2021 15:08:11 +0000 (16:08 +0100)]
Rollup merge of #91619 - ehuss:update-cargo, r=ehuss

Update cargo

8 commits in 294967c53f0c70d598fc54ca189313c86c576ea7..40dc281755137ee804bc9b3b08e782773b726e44
2021-11-29 19:04:22 +0000 to 2021-12-06 21:54:44 +0000
- Unify the description of quiet flag (rust-lang/cargo#10168)
- Stabilize future-incompat-report (rust-lang/cargo#10165)
- Support abbreviating `--release` as `-r` (rust-lang/cargo#10133)
- doc: nudge towards simple version requirements (rust-lang/cargo#10158)
- Upgrade clap to 2.34.0 (rust-lang/cargo#10164)
- Treat EOPNOTSUPP the same as ENOTSUP when ignoring failed flock calls. (rust-lang/cargo#10157)
- Add note about RUSTFLAGS removal from build scripts. (rust-lang/cargo#10141)
- Make clippy happy (rust-lang/cargo#10139)

2 years agoRollup merge of #91610 - aDotInTheVoid:patch-2, r=GuillaumeGomez
Matthias Krüger [Wed, 8 Dec 2021 15:08:10 +0000 (16:08 +0100)]
Rollup merge of #91610 - aDotInTheVoid:patch-2, r=GuillaumeGomez

Link to rustdoc_json_types docs instead of rustdoc-json RFC

The JSON format has had [many changes](https://github.com/rust-lang/rust/commits/master/src/rustdoc-json-types) since the RFC, so the rustdoc output is the only up to date reference

```@rustdoc``` modify labels: +A-rustdoc-json +A-docs

2 years agoRollup merge of #91571 - dtolnay:printerderef, r=Mark-Simulacrum
Matthias Krüger [Wed, 8 Dec 2021 15:08:09 +0000 (16:08 +0100)]
Rollup merge of #91571 - dtolnay:printerderef, r=Mark-Simulacrum

Remove unneeded access to pretty printer's `s` field in favor of deref

I found it taxing in some of my recent PRs touching the pretty printer to maintain consistency with the surrounding code, since the current code is all over the place about whether it uses `self.s.…()` or `self.…()` for invoking methods of `rustc_ast_pretty::pp::Printer`.

This PR standardizes on `self.…()` &mdash; relying on the `Deref` and `DerefMut` impls introduced by [#62532](https://github.com/rust-lang/rust/pull/62532/commits/cab453250a3ceae5cf0cf7eac836c03b37e4ca8e).

2 years agoRollup merge of #91570 - nbdd0121:const_typeck, r=oli-obk
Matthias Krüger [Wed, 8 Dec 2021 15:08:08 +0000 (16:08 +0100)]
Rollup merge of #91570 - nbdd0121:const_typeck, r=oli-obk

Evaluate inline const pat early and report error if too generic

Fix #90150

````@rustbot```` label: T-compiler F-inline_const

2 years agoRollup merge of #91551 - b-naber:const-eval-normalization-ice, r=oli-obk
Matthias Krüger [Wed, 8 Dec 2021 15:08:07 +0000 (16:08 +0100)]
Rollup merge of #91551 - b-naber:const-eval-normalization-ice, r=oli-obk

Allow for failure of subst_normalize_erasing_regions in const_eval

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

Using associated types that cannot be normalized previously resulted in an ICE. We now allow for normalization failure and return a "TooGeneric" error in that case.

r? ```@RalfJung``` maybe?

2 years agoRollup merge of #90709 - estebank:erase-known-type-params, r=nagisa
Matthias Krüger [Wed, 8 Dec 2021 15:08:06 +0000 (16:08 +0100)]
Rollup merge of #90709 - estebank:erase-known-type-params, r=nagisa

Only shown relevant type params in E0283 label

When we point at a binding to suggest giving it a type, erase all the
type for ADTs that have been resolved, leaving only the ones that could
not be inferred. For small shallow types this is not a problem, but for
big nested types with lots of params, this can otherwise cause a lot of
unnecessary visual output.

2 years agoAuto merge of #91604 - nikic:section-flags, r=nagisa
bors [Wed, 8 Dec 2021 14:58:48 +0000 (14:58 +0000)]
Auto merge of #91604 - nikic:section-flags, r=nagisa

Use object crate for .rustc metadata generation

We already use the object crate for generating uncompressed .rmeta
metadata object files. This switches the generation of compressed
.rustc object files to use the object crate as well. These have
slightly different requirements in that .rmeta should be completely
excluded from any final compilation artifacts, while .rustc should
be part of shared objects, but not loaded into memory.

The primary motivation for this change is #90326: In LLVM 14, the
current way of setting section flags (and in particular, preventing
the setting of SHF_ALLOC) will no longer work. There are other ways
we could work around this, but switching to the object crate seems
like the most elegant, as we already use it for .rmeta, and as it
makes this independent of the codegen backend. In particular, we
don't need separate handling in codegen_llvm and codegen_gcc.
codegen_cranelift should be able to reuse the implementation as
well, though I have omitted that here, as it is not based on
codegen_ssa.

This change mostly extracts the existing code for .rmeta handling
to allow using it for .rustc as well, and adjusts the codegen
infrastructure to handle the metadata object file separately: We
no longer create a backend-specific module for it, and directly
produce the compiled module instead.

This does not `fix` #90326 by itself yet, as .llvmbc will need to be
handled separately.

r? `@nagisa`

2 years agoAuto merge of #91656 - matthiaskrgr:rollup-lk96y6d, r=matthiaskrgr
bors [Wed, 8 Dec 2021 11:22:02 +0000 (11:22 +0000)]
Auto merge of #91656 - matthiaskrgr:rollup-lk96y6d, r=matthiaskrgr

Rollup of 7 pull requests

Successful merges:

 - #83744 (Deprecate crate_type and crate_name nested inside #![cfg_attr])
 - #90550 (Update certificates in some Ubuntu 16 images.)
 - #91272 (Print a suggestion when comparing references to primitive types in `const fn`)
 - #91467 (Emphasise that an OsStr[ing] is not necessarily a platform string)
 - #91531 (Do not add `;` to expected tokens list when it's wrong)
 - #91577 (Address some FIXMEs left over from #91475)
 - #91638 (Remove `in_band_lifetimes` from `rustc_mir_transform`)

Failed merges:

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

2 years agoRollup merge of #91638 - scottmcm:less-inband-2-of-28, r=petrochenkov
Matthias Krüger [Wed, 8 Dec 2021 10:09:01 +0000 (11:09 +0100)]
Rollup merge of #91638 - scottmcm:less-inband-2-of-28, r=petrochenkov

Remove `in_band_lifetimes` from `rustc_mir_transform`

Like #91580, this was inspired by the conversation in #44524 about possibly removing the feature from the compiler.  This crate is a heavy `'tcx` user, so is a nice case study.

r? ``@petrochenkov``

Three interesting ones:

This one had the `'tcx` declared on the function, despite the trait taking a `'tcx`:
```diff
-impl Visitor<'_> for UsedLocals {
+impl<'tcx> Visitor<'tcx> for UsedLocals {
     fn visit_statement(&mut self, statement: &Statement<'tcx>, location: Location) {
```

This one use in-band for one, and underscore for the other:
```diff
-pub fn remove_dead_blocks(tcx: TyCtxt<'tcx>, body: &mut Body<'_>) {
+pub fn remove_dead_blocks<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
```

A spurious name, since there's no single-use-lifetime warning:
```diff
-pub fn run_passes(tcx: TyCtxt<'tcx>, body: &'mir mut Body<'tcx>, passes: &[&dyn MirPass<'tcx>]) {
+pub fn run_passes<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>, passes: &[&dyn MirPass<'tcx>]) {
```

2 years agoRollup merge of #91577 - ecstatic-morse:mir-pass-manager-cleanup, r=oli-obk
Matthias Krüger [Wed, 8 Dec 2021 10:09:00 +0000 (11:09 +0100)]
Rollup merge of #91577 - ecstatic-morse:mir-pass-manager-cleanup, r=oli-obk

Address some FIXMEs left over from #91475

This shouldn't change behavior, only clarify what we're currently doing. I filed #91576 to see if the treatment of generator drop shims is intentional.

cc #91475

2 years agoRollup merge of #91531 - notriddle:notriddle/issue-87647-expected-semicolon, r=estebank
Matthias Krüger [Wed, 8 Dec 2021 10:08:59 +0000 (11:08 +0100)]
Rollup merge of #91531 - notriddle:notriddle/issue-87647-expected-semicolon, r=estebank

Do not add `;` to expected tokens list when it's wrong

There's a few spots where semicolons are checked for to do error recovery, and should not be suggested (or checked for other stuff).

Fixes #87647

2 years agoRollup merge of #91467 - ChrisDenton:confusing-os-string, r=Mark-Simulacrum
Matthias Krüger [Wed, 8 Dec 2021 10:08:58 +0000 (11:08 +0100)]
Rollup merge of #91467 - ChrisDenton:confusing-os-string, r=Mark-Simulacrum

Emphasise that an OsStr[ing] is not necessarily a platform string

Fixes #53261

Since that issue was filed, #56141 added a further clarification to the `OsString` docs. However the ffi docs may still leave the impression that an `OsStr` is in the platform native form. This PR aims to further emphasise that an `OsStr` is not necessarily a platform string.

2 years agoRollup merge of #91272 - FabianWolff:issue-90870-const-fn-eq, r=wesleywiser
Matthias Krüger [Wed, 8 Dec 2021 10:08:57 +0000 (11:08 +0100)]
Rollup merge of #91272 - FabianWolff:issue-90870-const-fn-eq, r=wesleywiser

Print a suggestion when comparing references to primitive types in `const fn`

Fixes #90870.