]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoRollup merge of #97805 - coolreader18:trace-suggestions, r=oli-obk
Yuki Okushi [Tue, 21 Jun 2022 11:08:09 +0000 (20:08 +0900)]
Rollup merge of #97805 - coolreader18:trace-suggestions, r=oli-obk

Add proper tracing spans to rustc_trait_selection::traits::error_reporting

While I was trying to figure out #97704 I did some of this to make the logs more legible, so I figured I'd do the whole module and open a PR with it. afaict this is an ongoing process in the compiler from the log->tracing transition? but lmk if there was a reason for the more verbose forms of logging as they are.

Also, for some of the functions with only one log in them, I put the function name as a message for that log instead of `#[instrument]`-ing the whole function with a span? but maybe the latter would actually be preferable, I'm not actually sure.

2 years agoRollup merge of #97269 - RalfJung:transmute, r=m-ou-se
Yuki Okushi [Tue, 21 Jun 2022 11:08:08 +0000 (20:08 +0900)]
Rollup merge of #97269 - RalfJung:transmute, r=m-ou-se

adjust transmute const stabilization version

With 1.46, this became callable only in `const`/`static` items.

Only since 1.56 is this callable in `const fn`: [changelog](https://github.com/rust-lang/rust/blob/master/RELEASES.md#version-1560-2021-10-21)

Also see [Zulip discussion](https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/transmute.20const.20fn.20stabilization).

2 years agoRollup merge of #94033 - joshtriplett:documentation-is-running-better-go-catch-it...
Yuki Okushi [Tue, 21 Jun 2022 11:08:07 +0000 (20:08 +0900)]
Rollup merge of #94033 - joshtriplett:documentation-is-running-better-go-catch-it, r=m-ou-se

Improve docs for `is_running` to explain use case

2 years agoAuto merge of #97657 - Urgau:check-cfg-many-mut, r=oli-obk
bors [Tue, 21 Jun 2022 07:40:32 +0000 (07:40 +0000)]
Auto merge of #97657 - Urgau:check-cfg-many-mut, r=oli-obk

Use get_many_mut to reduce the cost of setting up check cfg values

This PR use the newly added [`get_many_mut`](https://github.com/rust-lang/rust/issues/97601) function in [`HashMap`](https://doc.rust-lang.org/nightly/std/collections/hash_map/struct.HashMap.html#method.get_many_mut) to reduce the cost of setting up the initial check cfg values.

cc `@petrochenkov`

2 years agoAuto merge of #98148 - c410-f3r:assert-compiler, r=oli-obk
bors [Tue, 21 Jun 2022 03:44:54 +0000 (03:44 +0000)]
Auto merge of #98148 - c410-f3r:assert-compiler, r=oli-obk

[RFC 2011] Expand expressions where possible

Tracking issue: https://github.com/rust-lang/rust/issues/44838
Fourth step of https://github.com/rust-lang/rust/pull/96496

Extends https://github.com/rust-lang/rust/pull/97665 considering expressions that are good candidates for expansion.

r? `@oli-obk`

2 years agoAuto merge of #98307 - matthiaskrgr:rollup-rb3huha, r=matthiaskrgr
bors [Mon, 20 Jun 2022 22:34:50 +0000 (22:34 +0000)]
Auto merge of #98307 - matthiaskrgr:rollup-rb3huha, r=matthiaskrgr

Rollup of 4 pull requests

Successful merges:

 - #98235 (Drop magic value 3 from code)
 - #98267 (Don't omit comma when suggesting wildcard arm after macro expr)
 - #98276 (Mention formatting macros when encountering `ArgumentV1` method in const)
 - #98296 (Add a link to the unstable book page on Generator doc comment)

Failed merges:

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

2 years agoImprove docs for `is_running` to explain use case
Josh Triplett [Tue, 15 Feb 2022 22:51:24 +0000 (14:51 -0800)]
Improve docs for `is_running` to explain use case

2 years agoRollup merge of #98296 - JohnTitor:generator-unstable-book-link, r=Dylan-DPC
Matthias Krüger [Mon, 20 Jun 2022 18:13:12 +0000 (20:13 +0200)]
Rollup merge of #98296 - JohnTitor:generator-unstable-book-link, r=Dylan-DPC

Add a link to the unstable book page on Generator doc comment

This makes it easier to jump into the Generator section on the unstable book.

Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2 years agoRollup merge of #98276 - compiler-errors:const-format-macro, r=oli-obk
Matthias Krüger [Mon, 20 Jun 2022 18:13:11 +0000 (20:13 +0200)]
Rollup merge of #98276 - compiler-errors:const-format-macro, r=oli-obk

Mention formatting macros when encountering `ArgumentV1` method in const

Also open to just closing this if it's overkill. There are a lot of other distracting error messages around, so maybe it's not worth fixing just this one.

Fixes #93665

2 years agoRollup merge of #98267 - compiler-errors:suggest-wildcard-arm, r=oli-obk
Matthias Krüger [Mon, 20 Jun 2022 18:13:10 +0000 (20:13 +0200)]
Rollup merge of #98267 - compiler-errors:suggest-wildcard-arm, r=oli-obk

Don't omit comma when suggesting wildcard arm after macro expr

* Also adds `Span::eq_ctxt` to consolidate the various usages of `span.ctxt() == other.ctxt()`
* Also fixes an unhygenic usage of spans which caused the suggestion to render weirdly when we had one arm match in a macro
* Also always suggests a comma (i.e. even after a block) if we're rendering a wildcard arm in a single-line match (looks prettier :rose:)

Fixes #94866

2 years agoRollup merge of #98235 - liuw:mir-gen-drop-magic-value, r=davidtwco
Matthias Krüger [Mon, 20 Jun 2022 18:13:09 +0000 (20:13 +0200)]
Rollup merge of #98235 - liuw:mir-gen-drop-magic-value, r=davidtwco

Drop magic value 3 from code

Magic value 3 is used to create state for a yield point. It is in fact
the number of reserved variants.

Lift RESERVED_VARIANTS out to module scope and use it instead.

2 years agoAuto merge of #93765 - zhangyunhao116:heapsort, r=m-ou-se
bors [Mon, 20 Jun 2022 18:09:30 +0000 (18:09 +0000)]
Auto merge of #93765 - zhangyunhao116:heapsort, r=m-ou-se

Optimize heapsort

The new implementation is about 10% faster than the previous one(sorting random 1000 items).

2 years agoAdd a link to the unstable book page on Generator doc comment
Yuki Okushi [Mon, 20 Jun 2022 14:19:10 +0000 (23:19 +0900)]
Add a link to the unstable book page on Generator doc comment

Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2 years agoAuto merge of #98292 - Dylan-DPC:rollup-hueb8tm, r=Dylan-DPC
bors [Mon, 20 Jun 2022 13:24:31 +0000 (13:24 +0000)]
Auto merge of #98292 - Dylan-DPC:rollup-hueb8tm, r=Dylan-DPC

Rollup of 8 pull requests

Successful merges:

 - #93080 (Implement `core::slice::IterMut::as_mut_slice` and `impl<T> AsMut<[T]> for IterMut<'_, T>`)
 - #94855 (Panic when advance_slices()'ing too far and update docs.)
 - #96609 (Add `{Arc, Rc}::downcast_unchecked`)
 - #96719 (Fix the generator example for `pin!()`)
 - #97149 (Windows: `CommandExt::async_pipes`)
 - #97150 (`Stdio::makes_pipe`)
 - #97837 (Document Rust's stance on `/proc/self/mem`)
 - #98159 (Include ForeignItem when visiting types for WF check)

Failed merges:

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

2 years agoRollup merge of #98159 - PrestonFrom:issue_95665, r=petrochenkov
Dylan DPC [Mon, 20 Jun 2022 12:56:41 +0000 (14:56 +0200)]
Rollup merge of #98159 - PrestonFrom:issue_95665, r=petrochenkov

Include ForeignItem when visiting types for WF check

Addresses Issue 95665 by including `hir::Node::ForeignItem` as a valid
type to visit in `diagnostic_hir_wf_check`.

Fixes #95665

2 years agoRollup merge of #97837 - sunfishcode:sunfishcode/proc-self-mem, r=m-ou-se
Dylan DPC [Mon, 20 Jun 2022 12:56:40 +0000 (14:56 +0200)]
Rollup merge of #97837 - sunfishcode:sunfishcode/proc-self-mem, r=m-ou-se

Document Rust's stance on `/proc/self/mem`

Add documentation to `std::os::unix::io` describing Rust's stance on
`/proc/self/mem`, treating it as an external entity which is outside
the scope of Rust's safety guarantees.

2 years agoRollup merge of #97150 - ChrisDenton:stdio-create_pipe, r=m-ou-se
Dylan DPC [Mon, 20 Jun 2022 12:56:39 +0000 (14:56 +0200)]
Rollup merge of #97150 - ChrisDenton:stdio-create_pipe, r=m-ou-se

`Stdio::makes_pipe`

Wrappers around `std::process::Command` may want to be able to override pipe creation. However, [`std::process::Stdio`](https://doc.rust-lang.org/std/process/struct.Stdio.html) is opaque so there's no way to tell if `Command` was told to create new pipes or not.

This is in some ways a more generic (and cross-platform) alternative to #97149. However, unlike that feature, this comes with the price of the user needing to actually create their own pipes rather than reusing the std one. So I think it stands (or not) on its own.

# Example

```rust
#![feature(stdio_makes_pipe)]
use std::process::Stdio;

let io = Stdio::piped();
assert_eq!(io.makes_pipe(), true);
```

2 years agoRollup merge of #97149 - ChrisDenton:win_async_pipes, r=m-ou-se
Dylan DPC [Mon, 20 Jun 2022 12:56:38 +0000 (14:56 +0200)]
Rollup merge of #97149 - ChrisDenton:win_async_pipes, r=m-ou-se

Windows: `CommandExt::async_pipes`

Discussed in https://github.com/tokio-rs/tokio/issues/4670 was the need for third party crates to be able to force `process::Command::spawn` to create pipes as async.

This implements the suggestion for a `async_pipes` method that gives third party crates that option.

# Example:

```rust
use std::process::{Command, Stdio};

Command::new("cmd")
    .async_pipes(true)
    .stdin(Stdio::piped())
    .stdout(Stdio::piped())
    .stderr(Stdio::piped())
    .spawn()
    .unwrap();
```

2 years agoRollup merge of #96719 - mbartlett21:patch-4, r=Dylan-DPC
Dylan DPC [Mon, 20 Jun 2022 12:56:36 +0000 (14:56 +0200)]
Rollup merge of #96719 - mbartlett21:patch-4, r=Dylan-DPC

Fix the generator example for `pin!()`

The previous generator example is not actually self-referential, since the reference is created after the yield.

CC #93178 (tracking issue)

2 years agoRollup merge of #96609 - ibraheemdev:arc-downcast-unchecked, r=m-ou-se
Dylan DPC [Mon, 20 Jun 2022 12:56:35 +0000 (14:56 +0200)]
Rollup merge of #96609 - ibraheemdev:arc-downcast-unchecked, r=m-ou-se

Add `{Arc, Rc}::downcast_unchecked`

Part of #90850.

2 years agoRollup merge of #94855 - m-ou-se:advance-slice-panic-docs, r=kennytm
Dylan DPC [Mon, 20 Jun 2022 12:56:34 +0000 (14:56 +0200)]
Rollup merge of #94855 - m-ou-se:advance-slice-panic-docs, r=kennytm

Panic when advance_slices()'ing too far and update docs.

This updates advance_slices() to panic when advancing too far, like advance() already does. And updates the docs to say so.

See https://github.com/rust-lang/rust/issues/62726#issuecomment-1065253213

2 years agoRollup merge of #93080 - SkiFire13:itermut-as_mut_slice, r=m-ou-se
Dylan DPC [Mon, 20 Jun 2022 12:56:33 +0000 (14:56 +0200)]
Rollup merge of #93080 - SkiFire13:itermut-as_mut_slice, r=m-ou-se

Implement `core::slice::IterMut::as_mut_slice` and `impl<T> AsMut<[T]> for IterMut<'_, T>`

As per [the zulip discussion](https://rust-lang.zulipchat.com/#narrow/stream/219381-t-libs/topic/.60std.3A.3Aslice.3A.3AIterMut.3A.3Aas_mut_slice.60), the `AsMut` impl has been commented out, with a comment near the `#[unstable(...)]` to uncomment it when `as_mut_slice` gets stabilized.

2 years agoWindows: `CommandExt::async_pipes`
Chris Denton [Wed, 18 May 2022 18:52:10 +0000 (19:52 +0100)]
Windows: `CommandExt::async_pipes`

2 years agoAuto merge of #97674 - nnethercote:oblig-forest-tweaks, r=nikomatsakis
bors [Mon, 20 Jun 2022 10:58:56 +0000 (10:58 +0000)]
Auto merge of #97674 - nnethercote:oblig-forest-tweaks, r=nikomatsakis

Obligation forest tweaks

A few minor improvements to the code.

r? `@nikomatsakis`

2 years ago`Stdio::make_pipe`
Chris Denton [Wed, 18 May 2022 19:14:29 +0000 (20:14 +0100)]
`Stdio::make_pipe`

2 years agoDrop magic value 3 from code
Wei Liu [Sat, 18 Jun 2022 17:19:24 +0000 (17:19 +0000)]
Drop magic value 3 from code

Magic value 3 is used to create state for a yield point. It is in fact
the number of reserved variants.

Lift RESERVED_VARIANTS out to module scope and use it instead.

2 years agoOptimize heapsort
zhangyunhao [Mon, 20 Jun 2022 08:30:27 +0000 (08:30 +0000)]
Optimize heapsort

2 years agoAuto merge of #98284 - JohnTitor:rollup-7lbs143, r=JohnTitor
bors [Mon, 20 Jun 2022 08:18:07 +0000 (08:18 +0000)]
Auto merge of #98284 - JohnTitor:rollup-7lbs143, r=JohnTitor

Rollup of 5 pull requests

Successful merges:

 - #98183 (Fix pretty printing of empty bound lists in where-clause)
 - #98268 (Improve `lifetime arguments are not allowed on` error message)
 - #98273 (Fix minor documentation typo)
 - #98274 (Minor improvements on error for `Self` type in items that don't allow it)
 - #98281 (Fix typo in `HashMap::drain` docs)

Failed merges:

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

2 years agoShow #![feature] in example.
Mara Bos [Mon, 20 Jun 2022 08:00:55 +0000 (10:00 +0200)]
Show #![feature] in example.

2 years agoRollup merge of #98281 - Nilstrieb:map-drain-typo, r=JohnTitor
Yuki Okushi [Mon, 20 Jun 2022 07:41:50 +0000 (16:41 +0900)]
Rollup merge of #98281 - Nilstrieb:map-drain-typo, r=JohnTitor

Fix typo in `HashMap::drain` docs

It's a map, not a vector.

Fixes #98275.

2 years agoRollup merge of #98274 - compiler-errors:self-type-error, r=cjgillot
Yuki Okushi [Mon, 20 Jun 2022 07:41:49 +0000 (16:41 +0900)]
Rollup merge of #98274 - compiler-errors:self-type-error, r=cjgillot

Minor improvements on error for `Self` type in items that don't allow it

Fixes #93796

2 years agoRollup merge of #98273 - Piturnah:patch-1, r=compiler-errors
Yuki Okushi [Mon, 20 Jun 2022 07:41:48 +0000 (16:41 +0900)]
Rollup merge of #98273 - Piturnah:patch-1, r=compiler-errors

Fix minor documentation typo

Fixes incorrect pluralisation of `crate` in documentation for rustc_trait_selection

2 years agoRollup merge of #98268 - compiler-errors:disallowed-generics-better, r=lcnr
Yuki Okushi [Mon, 20 Jun 2022 07:41:47 +0000 (16:41 +0900)]
Rollup merge of #98268 - compiler-errors:disallowed-generics-better, r=lcnr

Improve `lifetime arguments are not allowed on` error message

Actually mention what thing we're improperly trying to add lifetime generics to.

2 years agoRollup merge of #98183 - dtolnay:emptybound, r=lcnr
Yuki Okushi [Mon, 20 Jun 2022 07:41:46 +0000 (16:41 +0900)]
Rollup merge of #98183 - dtolnay:emptybound, r=lcnr

Fix pretty printing of empty bound lists in where-clause

Repro:

```rust
macro_rules! assert_item_stringify {
    ($item:item $expected:literal) => {
        assert_eq!(stringify!($item), $expected);
    };
}

fn main() {
    assert_item_stringify! {
        fn f<'a, T>() where 'a:, T: {}
        "fn f<'a, T>() where 'a:, T: {}"
    }
}
```

Previously this assertion would fail because rustc renders the where-clause as `where 'a, T` which is invalid syntax.

This PR makes the above assertion pass.

This bug also affects `-Zunpretty=expanded`. The intention is for that to emit syntactically valid code, but the buggy output is not valid Rust syntax.

```console
$ rustc <(echo "fn f<'a, T>() where 'a:, T: {}") -Zunpretty=expanded
#![feature(prelude_import)]
#![no_std]
#[prelude_import]
use ::std::prelude::rust_2015::*;
#[macro_use]
extern crate std;
fn f<'a, T>() where 'a, T {}
```

```console
$ rustc <(echo "fn f<'a, T>() where 'a:, T: {}") -Zunpretty=expanded | rustc -
error: expected `:`, found `,`
 --> <anon>:7:23
  |
7 | fn f<'a, T>() where 'a, T {}
  |                       ^ expected `:`
```

2 years agoFix typo in `HashMap::drain` docs
nils [Mon, 20 Jun 2022 07:17:08 +0000 (09:17 +0200)]
Fix typo in `HashMap::drain` docs

It's a map, not a vector.

2 years agoAuto merge of #98264 - compiler-errors:missing-arg-placeholder, r=jackh726
bors [Mon, 20 Jun 2022 05:37:17 +0000 (05:37 +0000)]
Auto merge of #98264 - compiler-errors:missing-arg-placeholder, r=jackh726

Make missing argument placeholder more obvious that it's a placeholder

Use `/* ty */` instead of `{ty}`, since people might be misled into thinking that this is valid syntax, and not just a diagnostic placeholder.

Fixes #96880

2 years agoInclude ForeignItem when visiting types for WF check
Preston From [Thu, 16 Jun 2022 04:44:07 +0000 (22:44 -0600)]
Include ForeignItem when visiting types for WF check

Addresses Issue 95665 by including `hir::Node::ForeignItem` as a valid
type to visit in `diagnostic_hir_wf_check`.

Fixes #95665

2 years agoMention formatting macros when encountering ArgumentV1::new in const
Michael Goulet [Mon, 20 Jun 2022 03:13:08 +0000 (20:13 -0700)]
Mention formatting macros when encountering ArgumentV1::new in const

2 years agoAuto merge of #97931 - xldenis:fix-if-let-source-scopes, r=nagisa
bors [Mon, 20 Jun 2022 03:08:52 +0000 (03:08 +0000)]
Auto merge of #97931 - xldenis:fix-if-let-source-scopes, r=nagisa

Fix `SourceScope` for `if let` bindings.

Fixes #97799.

I'm not sure how to test this properly, is there any way to observe the difference in behavior apart from `ui` tests? I'm worried that they would be overlooked in the case of a regression.

2 years agoDon't suggest adding Self as a type parameter
Michael Goulet [Mon, 20 Jun 2022 02:25:50 +0000 (19:25 -0700)]
Don't suggest adding Self as a type parameter

2 years agoMention what item is using an invalid `Self` type
Michael Goulet [Mon, 20 Jun 2022 02:24:28 +0000 (19:24 -0700)]
Mention what item is using an invalid `Self` type

2 years agoFix minor documentation typo
Peter Hebden [Mon, 20 Jun 2022 02:30:21 +0000 (03:30 +0100)]
Fix minor documentation typo

Incorrect pluralisation of `crate`

2 years agoBe more specific for what lifetimes are not allowed on
Michael Goulet [Mon, 20 Jun 2022 00:54:19 +0000 (17:54 -0700)]
Be more specific for what lifetimes are not allowed on

2 years agoAuto merge of #98265 - JohnTitor:rollup-wtfqc4g, r=JohnTitor
bors [Mon, 20 Jun 2022 00:40:07 +0000 (00:40 +0000)]
Auto merge of #98265 - JohnTitor:rollup-wtfqc4g, r=JohnTitor

Rollup of 4 pull requests

Successful merges:

 - #95534 (Add `core::mem::copy` to complement `core::mem::drop`.)
 - #97912 (Stabilize `Path::try_exists()` and improve doc)
 - #98225 (Make debug_triple depend on target json file content rather than file path)
 - #98257 (Fix typos in `IntoFuture` docs)

Failed merges:

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

2 years agoBe more hygenic with spans
Michael Goulet [Sun, 19 Jun 2022 23:46:26 +0000 (16:46 -0700)]
Be more hygenic with spans

2 years agoUse `Span::eq_ctxt` method instead of `.ctxt() == .ctxt()`
Michael Goulet [Sun, 19 Jun 2022 23:27:29 +0000 (16:27 -0700)]
Use `Span::eq_ctxt` method instead of `.ctxt() == .ctxt()`

2 years agoOnly omit trailing comma if block doesn't come from macro expansion
Michael Goulet [Sun, 19 Jun 2022 23:27:26 +0000 (16:27 -0700)]
Only omit trailing comma if block doesn't come from macro expansion

2 years agoRollup merge of #98257 - kadiwa4:into_future_doc_typos, r=Dylan-DPC
Yuki Okushi [Sun, 19 Jun 2022 22:37:43 +0000 (07:37 +0900)]
Rollup merge of #98257 - kadiwa4:into_future_doc_typos, r=Dylan-DPC

Fix typos in `IntoFuture` docs

2 years agoRollup merge of #98225 - bjorn3:stable_target_json_hash, r=nagisa
Yuki Okushi [Sun, 19 Jun 2022 22:37:42 +0000 (07:37 +0900)]
Rollup merge of #98225 - bjorn3:stable_target_json_hash, r=nagisa

Make debug_triple depend on target json file content rather than file path

This ensures that changes to target json files will force a recompilation. And more importantly that moving the files doesn't force a recompilation.

This should fix https://github.com/Rust-for-Linux/linux/issues/792 (cc ``@ojeda)``

2 years agoRollup merge of #97912 - Kixunil:stabilize_path_try_exists, r=dtolnay
Yuki Okushi [Sun, 19 Jun 2022 22:37:41 +0000 (07:37 +0900)]
Rollup merge of #97912 - Kixunil:stabilize_path_try_exists, r=dtolnay

Stabilize `Path::try_exists()` and improve doc

This stabilizes the `Path::try_exists()` method which returns
`Result<bool, io::Error>` instead of `bool` allowing handling of errors
unrelated to the file not existing. (e.g permission errors)

Along with the stabilization it also:

* Warns that the `exists()` method is error-prone and suggests to use
  the newly stabilized one.
* Suggests it instead of `metadata()` to handle errors.
* Mentions TOCTOU bugs to avoid false assumption that `try_exists()` is
  completely safe fixed version of `exists()`.
* Renames the feature of still-unstable `std::fs::try_exists()` to
  `fs_try_exists` to avoid name conflict.

The tracking issue #83186 remains open to track `fs_try_exists`.

2 years agoRollup merge of #95534 - jyn514:std-mem-copy, r=joshtriplett
Yuki Okushi [Sun, 19 Jun 2022 22:37:40 +0000 (07:37 +0900)]
Rollup merge of #95534 - jyn514:std-mem-copy, r=joshtriplett

Add `core::mem::copy` to complement `core::mem::drop`.

This is useful for combinators. I didn't add `clone` since you can already
use `Clone::clone` in its place; copy has no such corresponding function.

2 years agoAuto merge of #97268 - jyn514:faster-assemble, r=Mark-Simulacrum
bors [Sun, 19 Jun 2022 22:22:07 +0000 (22:22 +0000)]
Auto merge of #97268 - jyn514:faster-assemble, r=Mark-Simulacrum

Make "Assemble stage1 compiler" orders of magnitude faster (take 2)

This used to take upwards of 5 seconds for me locally. I found that the culprit was copying the downloaded LLVM shared object:
```
[22:28:03] Install "/home/jnelson/rust-lang/rust/build/x86_64-unknown-linux-gnu/ci-llvm/lib/libLLVM-14-rust-1.62.0-nightly.so" to "/home/jnelson/rust-lang/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libLLVM-14-rust-1.62.0-nightly.so"
[22:28:09]   c Sysroot { compiler: Compiler { stage: 1, host: x86_64-unknown-linux-gnu(x86_64-unknown-linux-gnu) } }
```

It turned out that `install()` used full copies unconditionally. Change it to try using a hard-link before falling back to copying.

- Panic if we generate a symbolic link in a tarball
- Change install to use copy internally, like in my previous PR
- Change copy to dereference symbolic links, which avoids the previous regression in #96803.

I also took the liberty of fixing `x dist llvm-tools` to work even if you don't call `x build` previously.

2 years agoMake missing argument placeholder more obvious that it's a placeholder
Michael Goulet [Sun, 19 Jun 2022 22:10:42 +0000 (15:10 -0700)]
Make missing argument placeholder more obvious that it's a placeholder

2 years agoAdd `core::mem::copy` to complement `core::mem::drop`.
Joshua Nelson [Thu, 31 Mar 2022 18:01:26 +0000 (13:01 -0500)]
Add `core::mem::copy` to complement `core::mem::drop`.

This is useful for combinators. I didn't add `clone` since you can already
use `Clone::clone` in its place; copy has no such corresponding function.

2 years agoMake "Assemble stage1 compiler" orders of magnitude faster
Joshua Nelson [Sat, 7 May 2022 03:42:36 +0000 (22:42 -0500)]
Make "Assemble stage1 compiler" orders of magnitude faster

This used to take upwards of 5 seconds for me locally. I found that the
culprit was copying the downloaded LLVM shared object:
```
[22:28:03] Install "/home/jnelson/rust-lang/rust/build/x86_64-unknown-linux-gnu/ci-llvm/lib/libLLVM-14-rust-1.62.0-nightly.so" to "/home/jnelson/rust-lang/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libLLVM-14-rust-1.62.0-nightly.so"
[22:28:09]   c Sysroot { compiler: Compiler { stage: 1, host: x86_64-unknown-linux-gnu(x86_64-unknown-linux-gnu) } }
```

It turned out that `install()` used full copies unconditionally. Change
it to use `copy()` internally, which uses hard links instead when
available.

Note that this has a change in behavior: Installing a file will also
change permissions on the source, not just the destination, if hard
links are used.

To avoid changing the behavior on symlinks for existing code, I
introduce a new function `copy_internal` which only dereferences
symlinks when told to do so.

2 years agoPanic if `dist` generates a symbolic link in a generated tarball
Joshua Nelson [Thu, 26 May 2022 15:27:44 +0000 (11:27 -0400)]
Panic if `dist` generates a symbolic link in a generated tarball

This avoids regressions in rustup-toolchain-install-master

2 years agoAuto merge of #98247 - jackh726:regionkind-rustc-type-ir, r=compiler-errors
bors [Sun, 19 Jun 2022 19:55:45 +0000 (19:55 +0000)]
Auto merge of #98247 - jackh726:regionkind-rustc-type-ir, r=compiler-errors

Move RegionKind to rustc_type_ir

(Also UniverseIndex)

r? rust-lang/types

2 years agoAuto merge of #98224 - eddyb:proc-macro-spurious-repr, r=bjorn3
bors [Sun, 19 Jun 2022 17:32:12 +0000 (17:32 +0000)]
Auto merge of #98224 - eddyb:proc-macro-spurious-repr, r=bjorn3

proc_macro/bridge: remove `#[repr(C)]` from non-ABI-relevant types.

Not sure how this happened, maybe some of these were passed through the bridge a long time ago?

r? `@bjorn3`

2 years agoPreserve the path of the target spec json file for usage by rustdoc
bjorn3 [Sat, 18 Jun 2022 10:48:46 +0000 (10:48 +0000)]
Preserve the path of the target spec json file for usage by rustdoc

2 years agotypos in `IntoFuture` docs
KaDiWa4 [Sun, 19 Jun 2022 15:07:38 +0000 (17:07 +0200)]
typos in `IntoFuture` docs

2 years agoAuto merge of #98255 - Dylan-DPC:rollup-hr129rg, r=Dylan-DPC
bors [Sun, 19 Jun 2022 14:51:28 +0000 (14:51 +0000)]
Auto merge of #98255 - Dylan-DPC:rollup-hr129rg, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #98105 (rustdoc: remove tuple link on round braces)
 - #98136 (Rename `impl_constness` to `constness`)
 - #98146 (Remove --memory-init-file flag when linking with Emscripten)
 - #98219 (Skip late bound regions in GATSubstCollector)
 - #98233 (Remove accidental uses of `&A: Allocator`)

Failed merges:

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

2 years agoRollup merge of #98233 - RalfJung:ref-alloc, r=thomcc
Dylan DPC [Sun, 19 Jun 2022 13:26:31 +0000 (15:26 +0200)]
Rollup merge of #98233 - RalfJung:ref-alloc, r=thomcc

Remove accidental uses of `&A: Allocator`

Cc https://github.com/rust-lang/rust/issues/98232

Fixes https://github.com/rust-lang/rust/issues/98176 (for real this time)

2 years agoRollup merge of #98219 - eggyal:gatsubstcollector-without-folding, r=jackh726
Dylan DPC [Sun, 19 Jun 2022 13:26:30 +0000 (15:26 +0200)]
Rollup merge of #98219 - eggyal:gatsubstcollector-without-folding, r=jackh726

Skip late bound regions in GATSubstCollector

#93227 liberated late bound regions when collecting GAT substs in wfcheck.  It should simply skip late bound regions instead.

r? ``@compiler-errors``

2 years agoRollup merge of #98146 - hoodmane:remove-memory-init-flag, r=petrochenkov
Dylan DPC [Sun, 19 Jun 2022 13:26:29 +0000 (15:26 +0200)]
Rollup merge of #98146 - hoodmane:remove-memory-init-flag, r=petrochenkov

Remove --memory-init-file flag when linking with Emscripten

This flag does nothing. It only applies when generating asmjs JavaScript.
``@sbc100``

2 years agoRollup merge of #98136 - fee1-dead-contrib:rename_impl_constness, r=oli-obk
Dylan DPC [Sun, 19 Jun 2022 13:26:28 +0000 (15:26 +0200)]
Rollup merge of #98136 - fee1-dead-contrib:rename_impl_constness, r=oli-obk

Rename `impl_constness` to `constness`

The current code is a basis for `is_const_fn_raw`, and `impl_constness`
is no longer a valid name, which is previously used for determining the
constness of impls, and not items in general.

r? `@oli-obk`

2 years agoRollup merge of #98105 - notriddle:notriddle/tuple-links, r=jsha
Dylan DPC [Sun, 19 Jun 2022 13:26:27 +0000 (15:26 +0200)]
Rollup merge of #98105 - notriddle:notriddle/tuple-links, r=jsha

rustdoc: remove tuple link on round braces

This is #98069 but for tuples. The reasoning is the same:

* This PR also changes it so that tuples with all-generic elements still link to the primitive.tuple.html page, just like slices. So there still plenty of on-ramps for anybody who doesn't know about it.
* It's too hard to see when round braces are a separate link from the type inside of them.
* It's too hard to click even if you do notice them.

Before:

* impl [ToSocketAddrs](https://doc.rust-lang.org/nightly/std/net/trait.ToSocketAddrs.html) for [(](https://doc.rust-lang.org/nightly/std/primitive.tuple.html)[IpAddr](https://doc.rust-lang.org/nightly/std/net/enum.IpAddr.html), [u16](https://doc.rust-lang.org/nightly/std/primitive.u16.html)[)](https://doc.rust-lang.org/nightly/std/primitive.tuple.html)
* impl<K, V> [FromIterator](https://notriddle.com/notriddle-rustdoc-test/std/iter/trait.FromIterator.html)<[(](https://notriddle.com/notriddle-rustdoc-test/std/primitive.tuple.html)K, V[)](https://notriddle.com/notriddle-rustdoc-test/std/primitive.tuple.html)> for [BTreeMap](https://notriddle.com/notriddle-rustdoc-test/std/collections/struct.BTreeMap.html)<K, V>

After:

* impl [ToSocketAddrs](https://doc.rust-lang.org/nightly/std/net/trait.ToSocketAddrs.html) for ([IpAddr](https://doc.rust-lang.org/nightly/std/net/enum.IpAddr.html), [u16](https://doc.rust-lang.org/nightly/std/primitive.u16.html))
* impl<K, V> [FromIterator](https://notriddle.com/notriddle-rustdoc-test/std/iter/trait.FromIterator.html)<[(K, V)](https://notriddle.com/notriddle-rustdoc-test/std/primitive.tuple.html)> for [BTreeMap](https://notriddle.com/notriddle-rustdoc-test/std/collections/struct.BTreeMap.html)<K, V>

2 years agoAuto merge of #98238 - cjgillot:lint-mod, r=oli-obk
bors [Sun, 19 Jun 2022 12:28:59 +0000 (12:28 +0000)]
Auto merge of #98238 - cjgillot:lint-mod, r=oli-obk

Make some lints incremental.

Those lints do not track a state, so don't need to be performed for the full crate at once.

2 years agoAuto merge of #97791 - m-ou-se:const-locks, r=m-ou-se
bors [Sun, 19 Jun 2022 08:20:36 +0000 (08:20 +0000)]
Auto merge of #97791 - m-ou-se:const-locks, r=m-ou-se

Make {Mutex, Condvar, RwLock}::new() const.

This makes it possible to have `static M: Mutex<_> = Mutex::new(..);` 🎉

Our implementations [on Linux](https://github.com/rust-lang/rust/pull/95035), [on Windows](https://github.com/rust-lang/rust/pull/77380), and various BSDs and some tier 3 platforms have already been using a non-allocating const-constructible implementation. As of https://github.com/rust-lang/rust/pull/97647, the remaining platforms (most notably macOS) now have a const-constructible implementation as well. This means we can finally make these functions publicly const.

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

2 years agoBless 32bit ui tests.
Camille GILLOT [Sun, 19 Jun 2022 07:53:00 +0000 (09:53 +0200)]
Bless 32bit ui tests.

2 years agoUse `ensure` for `UnusedBrokenConst`.
Camille GILLOT [Sun, 19 Jun 2022 07:44:23 +0000 (09:44 +0200)]
Use `ensure` for `UnusedBrokenConst`.

2 years agoAuto merge of #97367 - WaffleLapkin:stabilize_checked_slice_to_str_conv, r=dtolnay
bors [Sun, 19 Jun 2022 05:51:42 +0000 (05:51 +0000)]
Auto merge of #97367 - WaffleLapkin:stabilize_checked_slice_to_str_conv, r=dtolnay

Stabilize checked slice->str conversion functions

This PR stabilizes the following APIs as `const` functions in Rust 1.63:
```rust
// core::str

pub const fn from_utf8(v: &[u8]) -> Result<&str, Utf8Error>;

impl Utf8Error {
    pub const fn valid_up_to(&self) -> usize;
    pub const fn error_len(&self) -> Option<usize>;
}
```

Note that the `from_utf8_mut` function is not stabilized as unique references (`&mut _`) are [unstable in const context].

FCP: https://github.com/rust-lang/rust/issues/91006#issuecomment-1134593095

[unstable in const context]: https://github.com/rust-lang/rust/issues/57349

2 years agoMove RegionKind to rustc_type_ir
Jack Huey [Sun, 19 Jun 2022 04:20:27 +0000 (00:20 -0400)]
Move RegionKind to rustc_type_ir

2 years agoAuto merge of #97944 - nikic:freebsd-update, r=Mark-Simulacrum
bors [Sun, 19 Jun 2022 03:30:05 +0000 (03:30 +0000)]
Auto merge of #97944 - nikic:freebsd-update, r=Mark-Simulacrum

Update FreeBSD toolchain to 12.3

Update the FreeBSD toolchain to 12.3. FreeBSD 11 is EOL since September 30, 2021.

I've locally verified that the `dist-x86_64-freebsd` docker image builds successfully.

r? `@Mark-Simulacrum`

2 years agoENH Move --memory-init-file flag from EmLinker to asmjs target spec
Hood Chatham [Wed, 15 Jun 2022 19:33:27 +0000 (12:33 -0700)]
ENH Move --memory-init-file flag from EmLinker to asmjs target spec

2 years agoAuto merge of #98242 - matthiaskrgr:rollup-qbbkwtf, r=matthiaskrgr
bors [Sun, 19 Jun 2022 00:25:25 +0000 (00:25 +0000)]
Auto merge of #98242 - matthiaskrgr:rollup-qbbkwtf, r=matthiaskrgr

Rollup of 5 pull requests

Successful merges:

 - #97511 (Don't build the compiler before building rust-demangler)
 - #98165 (once cell renamings)
 - #98207 (Update cargo)
 - #98229 (Add new eslint checks)
 - #98230 (Fix weird js condition)

Failed merges:

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

2 years agoRollup merge of #98230 - GuillaumeGomez:weird-js-condition, r=notriddle
Matthias Krüger [Sat, 18 Jun 2022 22:17:16 +0000 (00:17 +0200)]
Rollup merge of #98230 - GuillaumeGomez:weird-js-condition, r=notriddle

Fix weird js condition

While going around the code, I found this weird condition. Fixing also affects the generated results in some cases apparently (could only find this one).

Any idea maybe `@notriddle?`

r? `@notriddle`

2 years agoRollup merge of #98229 - GuillaumeGomez:eslint-checks, r=Dylan-DPC
Matthias Krüger [Sat, 18 Jun 2022 22:17:15 +0000 (00:17 +0200)]
Rollup merge of #98229 - GuillaumeGomez:eslint-checks, r=Dylan-DPC

Add new eslint checks

r? ```@Dylan-DPC```

2 years agoRollup merge of #98207 - arlosi:update-cargo, r=Dylan-DPC
Matthias Krüger [Sat, 18 Jun 2022 22:17:14 +0000 (00:17 +0200)]
Rollup merge of #98207 - arlosi:update-cargo, r=Dylan-DPC

Update cargo

4 commits in 4d92f07f34ba7fb7d7f207564942508f46c225d3..8d42b0e8794ce3787c9f7d6d88b02ae80ebe8d19
2022-06-10 01:11:04 +0000 to 2022-06-17 16:46:26 +0000
- Use specific terminology for sparse HTTP-based registry (rust-lang/cargo#10764)
- chore: Upgrade to clap 3.2 (rust-lang/cargo#10753)
- Improve testing framework for http registries (rust-lang/cargo#10738)
- doc: Improve example of using the links field (rust-lang/cargo#10728)

2 years agoRollup merge of #98165 - WaffleLapkin:once_things_renamings, r=m-ou-se
Matthias Krüger [Sat, 18 Jun 2022 22:17:13 +0000 (00:17 +0200)]
Rollup merge of #98165 - WaffleLapkin:once_things_renamings, r=m-ou-se

once cell renamings

This PR does the renamings proposed in https://github.com/rust-lang/rust/issues/74465#issuecomment-1153703128

- Move/rename `lazy::{OnceCell, Lazy}` to `cell::{OnceCell, LazyCell}`
- Move/rename `lazy::{SyncOnceCell, SyncLazy}` to `sync::{OnceLock, LazyLock}`

(I used `Lazy...` instead of `...Lazy` as it seems to be more consistent, easier to pronounce, etc)

```@rustbot``` label +T-libs-api -T-libs

2 years agoRollup merge of #97511 - jyn514:faster-cargo-build, r=Mark-Simulacrum
Matthias Krüger [Sat, 18 Jun 2022 22:17:12 +0000 (00:17 +0200)]
Rollup merge of #97511 - jyn514:faster-cargo-build, r=Mark-Simulacrum

Don't build the compiler before building rust-demangler

This saves a lot of time compiling, since rust-demangler doesn't actually use any unstable features.

This is not quite ideal because it uses ToolStd, not ToolBootstrap, so rust-demangler would be able to add unstable library features in the future. But it's a lot better than before, and `builder.cargo` doesn't currently know how to handle stages other than 0.

2 years agoMake some lints incremental.
Camille GILLOT [Sat, 18 Jun 2022 17:48:44 +0000 (19:48 +0200)]
Make some lints incremental.

2 years agoAuto merge of #98237 - RalfJung:miri, r=RalfJung
bors [Sat, 18 Jun 2022 21:44:34 +0000 (21:44 +0000)]
Auto merge of #98237 - RalfJung:miri, r=RalfJung

update Miri

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

2 years agoRemove weird JS condition
Guillaume Gomez [Sat, 18 Jun 2022 14:11:12 +0000 (16:11 +0200)]
Remove weird JS condition

2 years agoupdate Miri
Ralf Jung [Sat, 18 Jun 2022 18:31:21 +0000 (11:31 -0700)]
update Miri

2 years agoAuto merge of #96501 - jyn514:individual-paths, r=Mark-Simulacrum
bors [Sat, 18 Jun 2022 18:02:39 +0000 (18:02 +0000)]
Auto merge of #96501 - jyn514:individual-paths, r=Mark-Simulacrum

Pass all paths to `Step::run` at once when using `ShouldRun::krate`

Helps with https://github.com/rust-lang/rust/pull/95503. The goal is to run `cargo test -p rustc_data_structures -p rustc_lint_defs` instead of `cargo test -p rustc_data_structures; cargo test -p rustc_lint_defs`, which should both recompile less and avoid replaying cached warnings.

This was surprisingly complicated. The main changes are:
1. Invert the order of iteration in `StepDescription::run`.

    Previously, it did something like:
    ```python
    for path in paths:
    for (step, should_run) in should_runs:
        if let Some(set) = should_run.pathset_for_path(path):
        step.run(builder, set)
    ```

    That worked ok for individual paths, but didn't allow passing more than one path at a time to `Step::run`
    (since `pathset_for_paths` only had one path available to it).
    Change it to instead look at the intersection of `paths` and `should_run.paths`:

    ```python
    for (step, should_run) in should_runs:
    if let Some(set) = should_run.pathset_for_paths(paths):
        step.run(builder, set)
    ```

2. Change `pathset_for_path` to take multiple pathsets.

    The goal is to avoid `x test library/alloc` testing *all* library crates, instead of just alloc.
    The changes here are similarly subtle, to use the intersection between the paths rather than all
    paths in `should_run.paths`. I added a test for the behavior to try and make it more clear.

    Note that we use pathsets instead of just paths to allow for sets with multiple aliases (*cough* `all_krates` *cough*).
    See the documentation added in the next commit for more detail.

3. Change `StepDescription::run` to explicitly handle 0 paths.

    Before this was implicitly handled by the `for` loop, which just didn't excute when there were no paths.
    Now it needs a check, to avoid trying to run all steps (this is a problem for steps that use `default_condition`).

4. Change `RunDescription` to have a list of pathsets, rather than a single path.

5. Remove paths as they're matched

    This allows checking at the end that no invalid paths are left over.
    Note that if two steps matched the same path, this will no longer run both;
    but that's a bug anyway.

6. Handle suite paths separately from regular sets.

    Running multiple suite paths at once instead of in separate `make_run` invocations is both tricky and not particularly useful.
    The respective test Steps already handle this by introspecting the original paths.

    Avoid having to deal with it by moving suite handling into a seperate loop than `PathSet::Set` checks.

`@rustbot` label +A-rustbuild

2 years agoFix bug when using `--bless`
Michael Howell [Sat, 18 Jun 2022 17:36:12 +0000 (10:36 -0700)]
Fix bug when using `--bless`

2 years agoAdd test cases for tuples with links
Michael Howell [Sat, 18 Jun 2022 17:35:19 +0000 (10:35 -0700)]
Add test cases for tuples with links

2 years agoAuto merge of #97924 - cuviper:unguarded-poison, r=Mark-Simulacrum
bors [Sat, 18 Jun 2022 15:18:50 +0000 (15:18 +0000)]
Auto merge of #97924 - cuviper:unguarded-poison, r=Mark-Simulacrum

Avoid `thread::panicking()` in non-poisoning methods of `Mutex` and `RwLock`

`Mutex::lock()` and `RwLock::write()` are poison-guarded against panics,
in that they set the poison flag if a panic occurs while they're locked.
But if we're already in a panic (`thread::panicking()`), they leave the
poison flag alone.

That check is a bit of a waste for methods that never set the poison
flag though, namely `get_mut()`, `into_inner()`, and `RwLock::read()`.
These use-cases are now split to avoid that unnecessary call.

2 years agoAdd tests for fixed bugs
Joshua Nelson [Thu, 28 Apr 2022 04:43:33 +0000 (23:43 -0500)]
Add tests for fixed bugs

2 years agoPass all paths to `Step::run` at once when using `ShouldRun::krate`
Joshua Nelson [Fri, 22 Apr 2022 03:19:36 +0000 (22:19 -0500)]
Pass all paths to `Step::run` at once when using `ShouldRun::krate`

This was surprisingly complicated. The main changes are:
1. Invert the order of iteration in `StepDescription::run`.

    Previously, it did something like:
    ```python
    for path in paths:
    for (step, should_run) in should_runs:
        if let Some(set) = should_run.pathset_for_path(path):
        step.run(builder, set)
    ```

    That worked ok for individual paths, but didn't allow passing more than one path at a time to `Step::run`
    (since `pathset_for_paths` only had one path available to it).
    Change it to instead look at the intersection of `paths` and `should_run.paths`:

    ```python
    for (step, should_run) in should_runs:
    if let Some(set) = should_run.pathset_for_paths(paths):
        step.run(builder, set)
    ```

2. Change `pathset_for_path` to take multiple pathsets.

    The goal is to avoid `x test library/alloc` testing *all* library crates, instead of just alloc.
    The changes here are similarly subtle, to use the intersection between the paths rather than all
    paths in `should_run.paths`. I added a test for the behavior to try and make it more clear.

    Note that we use pathsets instead of just paths to allow for sets with multiple aliases (*cough* `all_krates` *cough*).
    See the documentation added in the next commit for more detail.

3. Change `StepDescription::run` to explicitly handle 0 paths.

   Before this was implicitly handled by the `for` loop, which just didn't excute when there were no paths.
   Now it needs a check, to avoid trying to run all steps (this is a problem for steps that use `default_condition`).

4. Change `RunDescription` to have a list of pathsets, rather than a single path.

5. Remove paths as they're matched

   This allows checking at the end that no invalid paths are left over.
   Note that if two steps matched the same path, this will no longer run both;
   but that's a bug anyway.

6. Handle suite paths separately from regular sets.

   Running multiple suite paths at once instead of in separate `make_run` invocations is both tricky and not particularly useful.
   The respective test Steps already handle this by introspecting the original paths.

   Avoid having to deal with it by moving suite handling into a seperate loop than `PathSet::Set` checks.

2 years agomake std not use &A: Allocator instance
Ralf Jung [Sat, 18 Jun 2022 14:38:28 +0000 (07:38 -0700)]
make std not use &A: Allocator instance

2 years agomake btree not use &A: Allocator instance
Ralf Jung [Sat, 18 Jun 2022 14:37:41 +0000 (07:37 -0700)]
make btree not use &A: Allocator instance

2 years agoAdding new eslint checks:
Guillaume Gomez [Sat, 18 Jun 2022 14:02:44 +0000 (16:02 +0200)]
Adding new eslint checks:
 * no-sequences
 * no-throw-literal

2 years agoAuto merge of #98004 - paolobarbolini:vecdeque-extend-trustedlen, r=the8472
bors [Sat, 18 Jun 2022 12:54:01 +0000 (12:54 +0000)]
Auto merge of #98004 - paolobarbolini:vecdeque-extend-trustedlen, r=the8472

Add VecDeque::extend from TrustedLen specialization

Continuation of #95904

Inspired by how [`VecDeque::copy_slice` works](https://github.com/rust-lang/rust/blob/c08b235a5ce10167632bb0fddcd0c5d67f2d42e3/library/alloc/src/collections/vec_deque/mod.rs#L437-L454).

## Benchmarks

Before

```
test vec_deque::bench_extend_chained_bytes      ... bench:       1,026 ns/iter (+/- 17)
test vec_deque::bench_extend_chained_trustedlen ... bench:       1,024 ns/iter (+/- 40)
test vec_deque::bench_extend_trustedlen         ... bench:         637 ns/iter (+/- 693)
```

After

```
test vec_deque::bench_extend_chained_bytes      ... bench:         828 ns/iter (+/- 24)
test vec_deque::bench_extend_chained_trustedlen ... bench:          25 ns/iter (+/- 1)
test vec_deque::bench_extend_trustedlen         ... bench:          21 ns/iter (+/- 0)
```

## Why do it this way

https://rust.godbolt.org/z/15qY1fMYh

The Compiler Explorer example shows how "just" removing the capacity check, like the [`Vec` `TrustedLen` specialization](https://github.com/rust-lang/rust/blob/c08b235a5ce10167632bb0fddcd0c5d67f2d42e3/library/alloc/src/vec/spec_extend.rs#L22-L58) does, wouldn't have been enough for `VecDeque`. `wrap_add` would still have greatly limited what LLVM could do while optimizing.

---

r? `@the8472`

2 years agoMake debug_triple depend on target json file content rather than file path
bjorn3 [Sat, 18 Jun 2022 10:19:24 +0000 (10:19 +0000)]
Make debug_triple depend on target json file content rather than file path

This ensures that changes to target json files will force a
recompilation. And more importantly that moving the files doesn't force
a recompilation.

2 years agoAuto merge of #98153 - nnethercote:fix-MissingDoc-quadratic-behaviour, r=cjgillot
bors [Sat, 18 Jun 2022 09:57:00 +0000 (09:57 +0000)]
Auto merge of #98153 - nnethercote:fix-MissingDoc-quadratic-behaviour, r=cjgillot

Fix `MissingDoc` quadratic behaviour

Best reviewed one commit at a time.

r? `@cjgillot`

2 years agoproc_macro/bridge: remove `#[repr(C)]` from non-ABI-relevant types.
Eduard-Mihai Burtescu [Sat, 18 Jun 2022 09:14:25 +0000 (09:14 +0000)]
proc_macro/bridge: remove `#[repr(C)]` from non-ABI-relevant types.

2 years agoAuto merge of #98186 - mystor:tokenstream_as_vec_tt, r=eddyb
bors [Sat, 18 Jun 2022 07:37:14 +0000 (07:37 +0000)]
Auto merge of #98186 - mystor:tokenstream_as_vec_tt, r=eddyb

Batch proc_macro RPC for TokenStream iteration and combination operations

This is the first part of #86822, split off as requested in https://github.com/rust-lang/rust/pull/86822#pullrequestreview-1008655452. It reduces the number of RPC calls required for common operations such as iterating over and concatenating TokenStreams.

2 years agoAuto merge of #98178 - RalfJung:btree-alloc, r=thomcc
bors [Sat, 18 Jun 2022 05:12:40 +0000 (05:12 +0000)]
Auto merge of #98178 - RalfJung:btree-alloc, r=thomcc

btree: avoid forcing the allocator to be a reference

The previous code forces the actual allocator used to be some `&A`. This generalizes the code to allow any `A: Copy`. If people truly want to use a reference, they can use `&A` themselves.

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

2 years agoSkip late bound regions in GATSubstCollector
Alan Egerton [Sat, 18 Jun 2022 03:11:47 +0000 (04:11 +0100)]
Skip late bound regions in GATSubstCollector

#93227 liberated late bound regions when collecting GAT substs in wfcheck.  It should simply skip late bound regions instead.

r? @compiler-errors