]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoSplit relate_substs into two functions
Martin Gammelsæter [Sun, 17 Apr 2022 09:04:58 +0000 (11:04 +0200)]
Split relate_substs into two functions

One for the case with variances, and one without.
All callers use an explicit Option for the variable anyway.

2 years agoOptimize relate_substs by extracting match
Martin Gammelsæter [Wed, 13 Apr 2022 15:46:29 +0000 (17:46 +0200)]
Optimize relate_substs by extracting match

There was no need to keep doing the match inside the iterator.

2 years agoAuto merge of #95399 - gilescope:plan_b, r=scottmcm
bors [Tue, 12 Apr 2022 05:54:50 +0000 (05:54 +0000)]
Auto merge of #95399 - gilescope:plan_b, r=scottmcm

Faster parsing for lower numbers for radix up to 16 (cont.)

( Continuation of https://github.com/rust-lang/rust/pull/83371 )

With LingMan's change I think this is potentially ready.

2 years agoAuto merge of #95893 - luqmana:no-prepopulate-passes-tweaks, r=nikic
bors [Tue, 12 Apr 2022 03:26:53 +0000 (03:26 +0000)]
Auto merge of #95893 - luqmana:no-prepopulate-passes-tweaks, r=nikic

Respect -Z verify-llvm-ir and other flags that add extra passes when combined with -C no-prepopulate-passes in the new LLVM Pass Manager.

As part of the switch to the new LLVM Pass Manager the behaviour of flags such as `-Z verify-llvm-ir` (e.g. sanitizer, instrumentation) was modified when combined with `-C no-prepopulate-passes`. With the old PM, rustc was the one manually constructing the pipeline and respected those flags but in the new pass manager, those flags are used to build a list of callbacks that get invoked at certain extension points in the pipeline. Unfortunately, `-C no-prepopulate-passes` would skip building the pipeline altogether meaning we'd never add the corresponding passes. The fix here is to just manually invoke those callbacks as needed.

Fixes #95874

Demonstrating the current vs fixed behaviour using the bug in #95864
```console
$ rustc +nightly asm-miscompile.rs --edition 2021 --emit=llvm-ir -C no-prepopulate-passes -Z verify-llvm-ir
$ echo $?
0
$ rustc +stage1 asm-miscompile.rs --edition 2021 --emit=llvm-ir -C no-prepopulate-passes -Z verify-llvm-ir
Basic Block in function '_ZN14asm_miscompile3foo28_$u7b$$u7b$closure$u7d$$u7d$17h360e2f7eee1275c5E' does not have terminator!
label %bb1
LLVM ERROR: Broken module found, compilation aborted!
```

2 years agoAuto merge of #93408 - liangyongrui:master, r=scottmcm
bors [Tue, 12 Apr 2022 00:18:51 +0000 (00:18 +0000)]
Auto merge of #93408 - liangyongrui:master, r=scottmcm

fix Layout struct member naming style

2 years agoAuto merge of #95944 - Dylan-DPC:rollup-idggkrh, r=Dylan-DPC
bors [Mon, 11 Apr 2022 21:55:58 +0000 (21:55 +0000)]
Auto merge of #95944 - Dylan-DPC:rollup-idggkrh, r=Dylan-DPC

Rollup of 7 pull requests

Successful merges:

 - #95008 ([`let_chains`] Forbid `let` inside parentheses)
 - #95801 (Replace RwLock by a futex based one on Linux)
 - #95864 (Fix miscompilation of inline assembly with outputs in cases where we emit an invoke instead of call instruction.)
 - #95894 (Fix formatting error in pin.rs docs)
 - #95895 (Clarify str::from_utf8_unchecked's invariants)
 - #95901 (Remove duplicate aliases for `check codegen_{cranelift,gcc}` and fix `build codegen_gcc`)
 - #95927 (CI: do not compile libcore twice when performing LLVM PGO)

Failed merges:

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

2 years agoAuto merge of #95796 - bzEq:bzEq/curl-redirect, r=Dylan-DPC
bors [Mon, 11 Apr 2022 18:59:40 +0000 (18:59 +0000)]
Auto merge of #95796 - bzEq:bzEq/curl-redirect, r=Dylan-DPC

[bootstrap.py] Instruct curl to follow redirect

Some mirror RUSTUP_DIST_SERVER (like https://mirrors.sjtug.sjtu.edu.cn/rust-static) perform redirection when downloading
stage0 compiler. Curl should be able to follow that.

2 years agoRollup merge of #95927 - Kobzol:ci-pgo-libcore, r=lqd
Dylan DPC [Mon, 11 Apr 2022 18:00:46 +0000 (20:00 +0200)]
Rollup merge of #95927 - Kobzol:ci-pgo-libcore, r=lqd

CI: do not compile libcore twice when performing LLVM PGO

I forgot the delete the first compilation when modifying this file in a previous PR.

r? ```@lqd```

2 years agoRollup merge of #95901 - jyn514:remove-duplicate-aliases, r=Mark-Simulacrum
Dylan DPC [Mon, 11 Apr 2022 18:00:45 +0000 (20:00 +0200)]
Rollup merge of #95901 - jyn514:remove-duplicate-aliases, r=Mark-Simulacrum

Remove duplicate aliases for `check codegen_{cranelift,gcc}` and fix `build codegen_gcc`

* Remove duplicate aliases
    Bootstrap already allows selecting these in `PathSet::has`, which allows
    any string that matches the end of a full path.

    I found these by adding `assert!(path.exists())` in `StepDescription::paths`.
    I think ideally we wouldn't have any aliases that aren't paths, but I've held
    off on enforcing that here since it may be controversial, I'll open a separate PR.

* Add `build compiler/rustc_codegen_gcc` as an alias for `CodegenBackend`

    These paths (`_cranelift` and `_gcc`) are somewhat misleading, since they
    actually tell bootstrap to build *all* codegen backends. But this seems like
    a useful improvement in the meantime.

cc ```@bjorn3``` ```@antoyo```

2 years agoRollup merge of #95895 - CAD97:patch-2, r=Dylan-DPC
Dylan DPC [Mon, 11 Apr 2022 18:00:44 +0000 (20:00 +0200)]
Rollup merge of #95895 - CAD97:patch-2, r=Dylan-DPC

Clarify str::from_utf8_unchecked's invariants

Specifically, make it clear that it is immediately UB to pass ill-formed UTF-8 into the function. The previous wording left space to interpret that the UB only occurred when calling another function, which "assumes that `&str`s are valid UTF-8."

This does not change whether str being UTF-8 is a safety or a validity invariant. (As per previous discussion, it is a safety invariant, not a validity invariant.) It just makes it clear that valid UTF-8 is a precondition of str::from_utf8_unchecked, and that emitting an Abstract Machine fault (e.g. UB or a sanitizer error) on invalid UTF-8 is a valid thing to do.

If user code wants to create an unsafe `&str` pointing to ill-formed UTF-8, it must be done via transmutes. Also, just, don't.

Zulip discussion: https://rust-lang.zulipchat.com/#narrow/stream/136281-t-lang.2Fwg-unsafe-code-guidelines/topic/str.3A.3Afrom_utf8_unchecked.20Safety.20requirement

2 years agoRollup merge of #95894 - nyanpasu64:fix-pin-docs, r=Dylan-DPC
Dylan DPC [Mon, 11 Apr 2022 18:00:43 +0000 (20:00 +0200)]
Rollup merge of #95894 - nyanpasu64:fix-pin-docs, r=Dylan-DPC

Fix formatting error in pin.rs docs

Not sure if there's more formatting issues I missed; I kinda lost interest reading midway through.

2 years agoRollup merge of #95864 - luqmana:inline-asm-unwind-store-miscompile, r=Amanieu
Dylan DPC [Mon, 11 Apr 2022 18:00:42 +0000 (20:00 +0200)]
Rollup merge of #95864 - luqmana:inline-asm-unwind-store-miscompile, r=Amanieu

Fix miscompilation of inline assembly with outputs in cases where we emit an invoke instead of call instruction.

We ran into this bug where rustc would segfault while trying to compile certain uses of inline assembly.

Here is a simple repro that demonstrates the issue:
```rust
#![feature(asm_unwind)]

fn main() {
    let _x = String::from("string here just cause we need something with a non-trivial drop");
    let foo: u64;
    unsafe {
        std::arch::asm!(
            "mov {}, 1",
            out(reg) foo,
            options(may_unwind)
        );
    }
    println!("{}", foo);
}
```
([playground link](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=7d6641e83370d2536a07234aca2498ff))

But crucially `feature(asm_unwind)` is not actually needed and this can be triggered on stable as a result of the way async functions/generators are handled in the compiler. e.g.:

```rust
extern crate futures; // 0.3.21

async fn bar() {
    let foo: u64;
    unsafe {
        std::arch::asm!(
            "mov {}, 1",
            out(reg) foo,
        );
    }
    println!("{}", foo);
}

fn main() {
    futures::executor::block_on(bar());
}
```
([playground link](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=1c7781c34dd4a3e80ae4bd936a0c82fc))

An example of the incorrect LLVM generated:
```llvm
bb1:                                              ; preds = %start
  %1 = invoke i64 asm sideeffect alignstack inteldialect unwind "mov ${0:q}, 1", "=&r,~{dirflag},~{fpsr},~{flags},~{memory}"()
          to label %bb2 unwind label %cleanup, !srcloc !9
  store i64 %1, i64* %foo, align 8

bb2:
[...snip...]
```

The store should not be placed after the asm invoke but rather should be in the normal control flow basic block (`bb2` in this case).

[Here](https://gist.github.com/luqmana/be1af5b64d2cda5a533e3e23a7830b44) is a writeup of the investigation that lead to finding this.

2 years agoRollup merge of #95801 - m-ou-se:futex-rwlock, r=Amanieu
Dylan DPC [Mon, 11 Apr 2022 18:00:41 +0000 (20:00 +0200)]
Rollup merge of #95801 - m-ou-se:futex-rwlock, r=Amanieu

Replace RwLock by a futex based one on Linux

This replaces the pthread-based RwLock on Linux by a futex based one.

This implementation is similar to [the algorithm](https://gist.github.com/kprotty/3042436aa55620d8ebcddf2bf25668bc) suggested by `@kprotty,` but modified to prefer writers and spin before sleeping. It uses two futexes: One for the readers to wait on, and one for the writers to wait on. The readers futex contains the state of the RwLock: The number of readers, a bit indicating whether writers are waiting, and a bit indicating whether readers are waiting. The writers futex is used as a simple condition variable and its contents are meaningless; it just needs to be changed on every notification.

Using two futexes rather than one has the obvious advantage of allowing a separate queue for readers and writers, but it also means we avoid the problem a single-futex RwLock would have of making it hard for a writer to go to sleep while the number of readers is rapidly changing up and down, as the writers futex is only changed when we actually want to wake up a writer.

It always prefers writers, as we decided [here](https://github.com/rust-lang/rust/issues/93740#issuecomment-1070696128).

To be able to prefer writers, it relies on futex_wake to return the number of awoken threads to be able to handle write-unlocking while both the readers-waiting and writers-waiting bits are set. Instead of waking both and letting them race, it first wakes writers and only continues to wake the readers too if futex_wake reported there were no writers to wake up.

r? `@Amanieu`

2 years agoRollup merge of #95008 - c410-f3r:let-chains-paren, r=wesleywiser
Dylan DPC [Mon, 11 Apr 2022 18:00:40 +0000 (20:00 +0200)]
Rollup merge of #95008 - c410-f3r:let-chains-paren, r=wesleywiser

[`let_chains`] Forbid `let` inside parentheses

Parenthesizes are mostly a no-op in let chains, in other words, they are mostly ignored.

```rust
let opt = Some(Some(1i32));

if (let Some(a) = opt && (let Some(b) = a)) && b == 1 {
    println!("`b` is declared inside but used outside");
}
```

As seen above, such behavior can lead to confusion.

A proper fix or nested encapsulation would probably require research, time and a modified MIR graph so in this PR I simply denied any `let` inside parentheses. Non-let stuff are still allowed.

```rust
fn main() {
    let fun = || true;

    if let true = (true && fun()) && (true) {
        println!("Allowed");
    }
}
```

It is worth noting that `let ...`  is not an expression and the RFC did not mention this specific situation.

cc `@matthewjasper`

2 years agoAuto merge of #95125 - JakobDegen:uninit-variant-rvalue, r=oli-obk
bors [Mon, 11 Apr 2022 14:49:30 +0000 (14:49 +0000)]
Auto merge of #95125 - JakobDegen:uninit-variant-rvalue, r=oli-obk

Add new `Deinit` statement

This rvalue replaces `SetDiscriminant` for ADTs. This PR is an alternative to #94590 , which only specifies that the behavior of `SetDiscriminant` is the same as what this rvalue would do. The motivation for this change are discussed in that PR and [on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/189540-t-compiler.2Fwg-mir-opt/topic/SetDiscriminant.20and.20aggregate.20initialization.20.2394590)

r? `@oli-obk`

2 years agoRemove inlining cost of `Deinit` statements
Jakob Degen [Mon, 11 Apr 2022 14:23:33 +0000 (10:23 -0400)]
Remove inlining cost of `Deinit` statements

2 years agoAdd new `MutatatingUseContext`s for deinit and `SetDiscriminant`
Jakob Degen [Mon, 11 Apr 2022 10:04:53 +0000 (06:04 -0400)]
Add new `MutatatingUseContext`s for deinit and `SetDiscriminant`

2 years agoAdd const eval tests ensuring padding gets correctly marked as deinit on deaggregation
Jakob Degen [Tue, 5 Apr 2022 23:12:09 +0000 (19:12 -0400)]
Add const eval tests ensuring padding gets correctly marked as deinit on deaggregation

2 years agoFix tests broken by deaggregation change
Jakob Degen [Tue, 5 Apr 2022 23:02:57 +0000 (19:02 -0400)]
Fix tests broken by deaggregation change

2 years agoBless tests that broke in a trivial way due to change in deaggregation
Jakob Degen [Tue, 5 Apr 2022 22:34:42 +0000 (18:34 -0400)]
Bless tests that broke in a trivial way due to change in deaggregation

2 years agoDocument semantics of `Deinit` and `SetDiscriminant` MIR statements
Jakob Degen [Tue, 5 Apr 2022 21:22:31 +0000 (17:22 -0400)]
Document semantics of `Deinit` and `SetDiscriminant` MIR statements

2 years agoAdd new `Deinit` statement kind
Jakob Degen [Tue, 5 Apr 2022 21:14:59 +0000 (17:14 -0400)]
Add new `Deinit` statement kind

2 years agoUse is_ or has_ prefix for pure `-> bool` functions.
Mara Bos [Mon, 11 Apr 2022 12:52:02 +0000 (14:52 +0200)]
Use is_ or has_ prefix for pure `-> bool` functions.

2 years agoUse compare_exchange_weak in futex rwlock implementation.
Mara Bos [Mon, 11 Apr 2022 12:29:32 +0000 (14:29 +0200)]
Use compare_exchange_weak in futex rwlock implementation.

2 years agoAdd comments to futex rwlock implementation.
Mara Bos [Mon, 11 Apr 2022 12:27:06 +0000 (14:27 +0200)]
Add comments to futex rwlock implementation.

2 years agoAdd doc comments to futex operations.
Mara Bos [Mon, 11 Apr 2022 12:26:52 +0000 (14:26 +0200)]
Add doc comments to futex operations.

2 years agoAuto merge of #95931 - matthiaskrgr:rollup-1c5zhit, r=matthiaskrgr
bors [Mon, 11 Apr 2022 11:12:26 +0000 (11:12 +0000)]
Auto merge of #95931 - matthiaskrgr:rollup-1c5zhit, r=matthiaskrgr

Rollup of 7 pull requests

Successful merges:

 - #95743 (Update binary_search example to instead redirect to partition_point)
 - #95771 (Update linker-plugin-lto.md to 1.60)
 - #95861 (Note that CI tests Windows 10)
 - #95875 (bootstrap: show available paths help text for aliased subcommands)
 - #95876 (Add a note for unsatisfied `~const Drop` bounds)
 - #95907 (address fixme for diagnostic variable name)
 - #95917 (thin_box test: import from std, not alloc)

Failed merges:

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

2 years agoRollup merge of #95917 - RalfJung:thin-box-test, r=dtolnay
Matthias Krüger [Mon, 11 Apr 2022 10:06:58 +0000 (12:06 +0200)]
Rollup merge of #95917 - RalfJung:thin-box-test, r=dtolnay

thin_box test: import from std, not alloc

Importing from `alloc` makes [Miri fail](https://github.com/rust-lang/miri-test-libstd/runs/5964922742?check_suite_focus=true), probably due to the hack that we used to resolve https://github.com/rust-lang/miri-test-libstd/issues/4. There might be better ways around this, but for now this is the easiest thing to do -- no other alloc integration test is importing from `alloc::`.

2 years agoRollup merge of #95907 - compiler-errors:diag, r=Dylan-DPC
Matthias Krüger [Mon, 11 Apr 2022 10:06:57 +0000 (12:06 +0200)]
Rollup merge of #95907 - compiler-errors:diag, r=Dylan-DPC

address fixme for diagnostic variable name

quick rename

2 years agoRollup merge of #95876 - fee1-dead:note-const-drop, r=oli-obk
Matthias Krüger [Mon, 11 Apr 2022 10:06:56 +0000 (12:06 +0200)]
Rollup merge of #95876 - fee1-dead:note-const-drop, r=oli-obk

Add a note for unsatisfied `~const Drop` bounds

r? ``@oli-obk``

2 years agoRollup merge of #95875 - aswild:pr/alias-cmd-paths, r=Mark-Simulacrum
Matthias Krüger [Mon, 11 Apr 2022 10:06:55 +0000 (12:06 +0200)]
Rollup merge of #95875 - aswild:pr/alias-cmd-paths, r=Mark-Simulacrum

bootstrap: show available paths help text for aliased subcommands

Running `./x.py build -h -v` shows a list of available build targets,
but the short alias `./x.py b -h -v` does not. Fix so that the aliases
behave the same as their spelled out counterparts.

2 years agoRollup merge of #95861 - ChrisDenton:windows7-support, r=Dylan-DPC
Matthias Krüger [Mon, 11 Apr 2022 10:06:54 +0000 (12:06 +0200)]
Rollup merge of #95861 - ChrisDenton:windows7-support, r=Dylan-DPC

Note that CI tests Windows 10

Currently being [discussed on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/219381-t-libs/topic/Windows.207).

r? `````@joshtriplett`````

2 years agoRollup merge of #95771 - str4d:update-linker-plugin-lto.md-to-1.60, r=pietroalbini
Matthias Krüger [Mon, 11 Apr 2022 10:06:53 +0000 (12:06 +0200)]
Rollup merge of #95771 - str4d:update-linker-plugin-lto.md-to-1.60, r=pietroalbini

Update linker-plugin-lto.md to 1.60

I remembered this table when I was looking into what version of LLVM 1.60.0 was using 🙂

2 years agoRollup merge of #95743 - yaahc:binary-search-clarification, r=Mark-Simulacrum
Matthias Krüger [Mon, 11 Apr 2022 10:06:52 +0000 (12:06 +0200)]
Rollup merge of #95743 - yaahc:binary-search-clarification, r=Mark-Simulacrum

Update binary_search example to instead redirect to partition_point

Inspired by discussion in the tracking issue for `Result::into_ok_or_err`: https://github.com/rust-lang/rust/issues/82223#issuecomment-1067098167

People are surprised by us not providing a `Result<T, T> -> T` conversion, and the main culprit for this confusion seems to be the `binary_search` API. We should instead redirect people to the equivalent API that implicitly does that `Result<T, T> -> T` conversion internally which should obviate the need for the `into_ok_or_err` function and give us time to work towards a more general solution that applies to all enums rather than just `Result` such as making or_patterns usable for situations like this via postfix `match`.

I choose to duplicate the example rather than simply moving it from `binary_search` to partition point because most of the confusion seems to arise when people are looking at `binary_search`. It makes sense to me to have the example presented immediately rather than requiring people to click through to even realize there is an example. If I had to put it in only one place I'd leave it in `binary_search` and remove it from `partition_point` but it seems pretty obviously relevant to `partition_point` so I figured the best option would be to duplicate it.

2 years agoAuto merge of #95758 - compiler-errors:issue-54771, r=estebank
bors [Mon, 11 Apr 2022 08:31:37 +0000 (08:31 +0000)]
Auto merge of #95758 - compiler-errors:issue-54771, r=estebank

Only suggest removing semicolon when expression is compatible with `impl Trait`

https://github.com/rust-lang/rust/issues/54771#issuecomment-476423690
> It still needs checking that the last statement's expr can actually conform to the trait, but the naïve behavior is there.

Only suggest removing a semicolon when the type behind the semicolon actually implements the trait in an RPIT `-> impl Trait`. Also upgrade the label that suggests removing the semicolon to a suggestion (should it be verbose?).

cc #54771

2 years agoCI: do not compile libcore twice when performing LLVM PGO
Jakub Beránek [Mon, 11 Apr 2022 08:05:05 +0000 (10:05 +0200)]
CI: do not compile libcore twice when performing LLVM PGO

2 years agobetter def of is signed in tests.
Giles Cope [Mon, 11 Apr 2022 06:37:53 +0000 (07:37 +0100)]
better def of is signed in tests.

2 years agofix Layout struct member naming style
liangyongrui [Mon, 11 Apr 2022 05:35:18 +0000 (13:35 +0800)]
fix Layout struct member naming style

2 years agoAuto merge of #95754 - compiler-errors:binder-assoc-ty, r=nagisa
bors [Mon, 11 Apr 2022 05:16:48 +0000 (05:16 +0000)]
Auto merge of #95754 - compiler-errors:binder-assoc-ty, r=nagisa

Better error for `for<...>` on associated type bound

With GATs just around the corner, we'll probably see more people trying out `Trait<for<'a> Assoc<'a> = ..>`.

This PR improves the syntax error slightly, and also makes it slightly easier to make this into real syntax in the future.

Feel free to push back if the reviewer thinks this should have a suggestion on how to fix it (i.e. push the `for<'a>` outside of the angle brackets), but that can also be handled in a follow-up PR.

2 years agothin_box test: import from std, not alloc
Ralf Jung [Mon, 11 Apr 2022 02:59:51 +0000 (22:59 -0400)]
thin_box test: import from std, not alloc

2 years agoAdd a note for unsatisfied `~const Drop` bounds
Deadbeef [Sun, 10 Apr 2022 07:36:08 +0000 (17:36 +1000)]
Add a note for unsatisfied `~const Drop` bounds

2 years agoAuto merge of #94243 - compiler-errors:compiler-flags-typo, r=Mark-Simulacrum
bors [Mon, 11 Apr 2022 00:58:22 +0000 (00:58 +0000)]
Auto merge of #94243 - compiler-errors:compiler-flags-typo, r=Mark-Simulacrum

`s/compiler-flags/compile-flags` in compiletest

Also make compiletest panic so this doesn't happen in the future! I literally always forget which it's called, so I wanted to make my life easier in the future.

Also open to the possibility of parsing both.

2 years agobetter error for binder on associated type bound
Michael Goulet [Thu, 7 Apr 2022 06:08:22 +0000 (23:08 -0700)]
better error for binder on associated type bound

2 years agoonly suggest removing semicolon when expr implements trait
Michael Goulet [Thu, 7 Apr 2022 08:21:35 +0000 (01:21 -0700)]
only suggest removing semicolon when expr implements trait

2 years agoAdd `build compiler/rustc_codegen_gcc` as an alias for `CodegenBackend`
Joshua Nelson [Sun, 10 Apr 2022 21:41:21 +0000 (16:41 -0500)]
Add `build compiler/rustc_codegen_gcc` as an alias for `CodegenBackend`

These paths (`_cranelift` and `_gcc`) are somewhat misleading, since they
actually tell bootstrap to build *all* codegen backends. But this seems like
a useful improvement in the meantime.

2 years agoRemove duplicate aliases for `codegen_{cranelift,gcc}`
Joshua Nelson [Sun, 10 Apr 2022 21:37:24 +0000 (16:37 -0500)]
Remove duplicate aliases for `codegen_{cranelift,gcc}`

Bootstrap already allows selecting these in `PathSet::has`, which allows
any string that matches the end of a full path.

I found these by adding `assert!(path.exists())` in `StepDescription::paths`.
I think ideally we wouldn't have any aliases that aren't paths, but I've held
off on enforcing that here since it may be controversial, I'll open a separate PR.

2 years agoAuto merge of #95889 - Dylan-DPC:rollup-1cmywu4, r=Dylan-DPC
bors [Sun, 10 Apr 2022 21:01:13 +0000 (21:01 +0000)]
Auto merge of #95889 - Dylan-DPC:rollup-1cmywu4, r=Dylan-DPC

Rollup of 7 pull requests

Successful merges:

 - #95566 (Avoid duplication of doc comments in `std::char` constants and functions)
 - #95784 (Suggest replacing `typeof(...)` with an actual type)
 - #95807 (Suggest adding a local for vector to fix borrowck errors)
 - #95849 (Check for git submodules in non-git source tree.)
 - #95852 (Fix missing space in lossy provenance cast lint)
 - #95857 (Allow multiple derefs to be splitted in deref_separator)
 - #95868 (rustdoc: Reduce allocations in a `html::markdown` function)

Failed merges:

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

2 years agoClarify str::from_utf8_unchecked's invariants
Christopher Durham [Sun, 10 Apr 2022 20:04:57 +0000 (15:04 -0500)]
Clarify str::from_utf8_unchecked's invariants

Specifically, make it clear that it is immediately UB to pass ill-formed UTF-8 into the function. The previous wording left space to interpret that the UB only occurred when calling another function, which "assumes that `&str`s are valid UTF-8."

This does not change whether str being UTF-8 is a safety or a validity invariant. (As per previous discussion, it is a safety invariant, not a validity invariant.) It just makes it clear that valid UTF-8 is a precondition of str::from_utf8_unchecked, and that emitting an Abstract Machine fault (e.g. UB or a sanitizer error) on invalid UTF-8 is a valid thing to do.

If user code wants to create an unsafe `&str` pointing to ill-formed UTF-8, it must be done via transmutes. Also, just, don't.

2 years agoFix formatting error in pin.rs docs
nyanpasu64 [Sun, 10 Apr 2022 19:41:31 +0000 (12:41 -0700)]
Fix formatting error in pin.rs docs

2 years agoRespect -Z verify-llvm-ir and other flags that add extra passes when combined with...
Luqman Aden [Sun, 10 Apr 2022 19:30:35 +0000 (15:30 -0400)]
Respect -Z verify-llvm-ir and other flags that add extra passes when combined with -C no-prepopulate-passes in the new LLVM Pass Manager.

2 years agoRollup merge of #95868 - vacuus:markdown-code-blocks, r=GuillaumeGomez
Dylan DPC [Sun, 10 Apr 2022 19:03:39 +0000 (21:03 +0200)]
Rollup merge of #95868 - vacuus:markdown-code-blocks, r=GuillaumeGomez

rustdoc: Reduce allocations in a `html::markdown` function

2 years agoRollup merge of #95857 - ouz-a:mir-opt, r=oli-obk
Dylan DPC [Sun, 10 Apr 2022 19:03:38 +0000 (21:03 +0200)]
Rollup merge of #95857 - ouz-a:mir-opt, r=oli-obk

Allow multiple derefs to be splitted in deref_separator

Previously in #95649 only a single deref within projection was supported and multiple derefs caused a bunch of issues, this PR fixes those issues.

```@oli-obk``` helped a ton again ❤️

2 years agoRollup merge of #95852 - niluxv:strict-provenance-lint-fixup, r=Dylan-DPC
Dylan DPC [Sun, 10 Apr 2022 19:03:37 +0000 (21:03 +0200)]
Rollup merge of #95852 - niluxv:strict-provenance-lint-fixup, r=Dylan-DPC

Fix missing space in lossy provenance cast lint

See https://github.com/rust-lang/rust/pull/95599#discussion_r846425050

2 years agoRollup merge of #95849 - ehuss:check-submodules, r=Mark-Simulacrum
Dylan DPC [Sun, 10 Apr 2022 19:03:36 +0000 (21:03 +0200)]
Rollup merge of #95849 - ehuss:check-submodules, r=Mark-Simulacrum

Check for git submodules in non-git source tree.

People occasionally download the source from https://github.com/rust-lang/rust/releases, but those source distributions will not work because they are missing the submodules. They will get a confusing `failed to load manifest for workspace member` error.

Unfortunately AFAIK there is no way to disable the GitHub source links. This change tries to detect this scenario and provide an error message that guides them toward a solution.

Closes #95608

2 years agoRollup merge of #95807 - TaKO8Ki:suggest-local-var-for-vector, r=fee1-dead
Dylan DPC [Sun, 10 Apr 2022 19:03:35 +0000 (21:03 +0200)]
Rollup merge of #95807 - TaKO8Ki:suggest-local-var-for-vector, r=fee1-dead

Suggest adding a local for vector to fix borrowck errors

closes #95574

2 years agoRollup merge of #95784 - WaffleLapkin:typeof_cool_suggestion, r=compiler-errors
Dylan DPC [Sun, 10 Apr 2022 19:03:34 +0000 (21:03 +0200)]
Rollup merge of #95784 - WaffleLapkin:typeof_cool_suggestion, r=compiler-errors

Suggest replacing `typeof(...)` with an actual type

This PR adds suggestion to replace `typeof(...)` with an actual type of `...`, for example in case of `typeof(1)` we suggest replacing it with `i32`.

If the expression
1. Is not const (`{ let a = 1; let _: typeof(a); }`)
2. Can't be found (`let _: typeof(this_variable_does_not_exist)`)
3. Or has non-suggestable type (closure, generator, error, etc)
we don't suggest anything.

The 1 one is sad, but it's not clear how to support non-consts expressions for `typeof`.

_This PR is inspired by [this tweet]._

[this tweet]: https://twitter.com/compiler_errors/status/1511945354752638976

2 years agoRollup merge of #95566 - eduardosm:std_char_consts_and_methods, r=Mark-Simulacrum
Dylan DPC [Sun, 10 Apr 2022 19:03:34 +0000 (21:03 +0200)]
Rollup merge of #95566 - eduardosm:std_char_consts_and_methods, r=Mark-Simulacrum

Avoid duplication of doc comments in `std::char` constants and functions

For those consts and functions, only the summary is kept and a reference to the `char` associated const/method is included.

Additionaly, re-exported functions have been converted to function definitions that call the previously re-exported function. This makes it easier to add a deprecated attribute to these functions in the future.

2 years agoFIXME for diagnostic variable name
Michael Goulet [Sun, 10 Apr 2022 18:11:25 +0000 (11:11 -0700)]
FIXME for diagnostic variable name

2 years agoAuto merge of #95487 - cjgillot:menhir, r=oli-obk
bors [Sun, 10 Apr 2022 17:59:27 +0000 (17:59 +0000)]
Auto merge of #95487 - cjgillot:menhir, r=oli-obk

Avoid accessing HIR from MIR passes

`hir_owner_nodes` contains a lot of information, and the query result is typically dirty. This forces dependent queries to be re-executed needlessly.

This PR refactors some accesses to HIR to go through more targeted queries that yield the same result.

Based on https://github.com/rust-lang/rust/pull/95435 and https://github.com/rust-lang/rust/pull/95436

2 years agoNo need to use Default
Giles Cope [Sun, 10 Apr 2022 17:20:13 +0000 (18:20 +0100)]
No need to use Default

2 years agoUse Add, Sub, Mul traits instead of unsafe
Giles Cope [Sun, 10 Apr 2022 17:13:48 +0000 (18:13 +0100)]
Use Add, Sub, Mul traits instead of unsafe

2 years agoAuto merge of #95848 - RalfJung:miri, r=RalfJung
bors [Sun, 10 Apr 2022 14:51:30 +0000 (14:51 +0000)]
Auto merge of #95848 - RalfJung:miri, r=RalfJung

update Miri

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

2 years ago--bless tests
Maybe Waffle [Sun, 10 Apr 2022 12:45:09 +0000 (16:45 +0400)]
--bless tests

2 years agoAuto merge of #95253 - jyn514:cargo-run, r=Mark-Simulacrum
bors [Sun, 10 Apr 2022 12:30:26 +0000 (12:30 +0000)]
Auto merge of #95253 - jyn514:cargo-run, r=Mark-Simulacrum

Make it possible to run `cargo test` for bootstrap

Note that this only runs bootstrap's self-tests, not compiler or library tests.

Helps with https://github.com/rust-lang/rust/issues/94829.

2 years agoAvoid checking HIR in variances_of.
Camille GILLOT [Wed, 30 Mar 2022 10:25:23 +0000 (12:25 +0200)]
Avoid checking HIR in variances_of.

2 years agoDo not access HIR to compute symbol_name.
Camille GILLOT [Wed, 30 Mar 2022 10:13:31 +0000 (12:13 +0200)]
Do not access HIR to compute symbol_name.

2 years agoStore LocalDefId in is_late_bound_map.
Camille GILLOT [Tue, 29 Mar 2022 22:17:41 +0000 (00:17 +0200)]
Store LocalDefId in is_late_bound_map.

This allows to avoid looking at HIR from borrowck.

2 years agoAvoid accessing HIR from MIR queries.
Camille GILLOT [Tue, 29 Mar 2022 21:50:01 +0000 (23:50 +0200)]
Avoid accessing HIR from MIR queries.

2 years agoAuto merge of #95621 - saethlin:remove-mpsc-transmute, r=RalfJung
bors [Sun, 10 Apr 2022 08:57:32 +0000 (08:57 +0000)]
Auto merge of #95621 - saethlin:remove-mpsc-transmute, r=RalfJung

Remove ptr-int transmute in std::sync::mpsc

Since https://github.com/rust-lang/rust/pull/95340 landed, Miri with `-Zmiri-check-number-validity` produces an error on the test suites of some crates which implement concurrency tools<sup>*</sup>, because it seems like such crates tend to use `std::sync::mpsc` in their tests. This fixes the problem by storing pointer bytes in a pointer.

<sup>*</sup> I have so far seen errors in the test suites of `once_cell`, `parking_lot`, and `crossbeam-utils`.
(just updating the list for fun, idk)
Also `threadpool`, `async-lock`, `futures-timer`, `fragile`, `scoped_threadpool`, `procfs`, `slog-async`, `scheduled-thread-pool`, `tokio-threadpool`, `mac`, `futures-cpupool`, `ntest`, `actix`, `zbus`, `jsonrpc-client-transports`, `fail`, `libp2p-gossipsub`, `parity-send-wrapper`, `async-broadcast,` `libp2p-relay`, `http-client`, `mockito`, `simple-mutex`, `surf`, `pollster`, and `pulse`. Then I turned the bot off.

2 years agobootstrap: show available paths help text for aliased subcommands
Allen Wild [Sun, 10 Apr 2022 07:10:04 +0000 (03:10 -0400)]
bootstrap: show available paths help text for aliased subcommands

Running `./x.py build -h -v` shows a list of available build targets,
but the short alias `./x.py b -h -v` does not. Fix so that the aliases
behave the same as their spelled out counterparts.

2 years agoAuto merge of #95502 - jyn514:doc-rustc, r=Mark-Simulacrum
bors [Sun, 10 Apr 2022 06:28:40 +0000 (06:28 +0000)]
Auto merge of #95502 - jyn514:doc-rustc, r=Mark-Simulacrum

Fix `x doc compiler/rustc`

This also has a few cleanups to `doc.rs`. The last two commits I don't care about, but the first commit I'd like to keep - it will be very useful for https://github.com/rust-lang/rust/issues/44293.

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

2 years agoAuto merge of #95254 - jyn514:fix-windows-builds, r=Mark-Simulacrum
bors [Sun, 10 Apr 2022 03:58:54 +0000 (03:58 +0000)]
Auto merge of #95254 - jyn514:fix-windows-builds, r=Mark-Simulacrum

Fix `cargo run` on Windows

Fixes the following error:
```
error: failed to run custom build command for `bootstrap v0.0.0 (C:\Users\Walther\git\rust\src\bootstrap)`

Caused by:
  process didn't exit successfully: `C:\Users\Walther\git\rust\target\debug\build\bootstrap-7757a4777dec0f86\build-script-build` (exit code: 101)
  --- stdout
  cargo:rerun-if-changed=build.rs
  cargo:rerun-if-env-changed=RUSTC
  cargo:rustc-env=BUILD_TRIPLE=x86_64-pc-windows-msvc
  cargo:rerun-if-env-changed=PATH

  --- stderr
  thread 'main' panicked at 'assertion failed: rustc.is_absolute()', src\bootstrap\build.rs:22:5
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: build failed
```

The problem was that the `dir.join` check only works with `rustc.exe`, not `rustc`.

Thanks `@Walther` for the help testing the fix!

Helps with https://github.com/rust-lang/rust/issues/94829.

2 years agorustdoc: Reduce allocations in a `html::markdown` function
Roc Yu [Sat, 9 Apr 2022 23:14:29 +0000 (19:14 -0400)]
rustdoc: Reduce allocations in a `html::markdown` function

2 years agoAuto merge of #95435 - cjgillot:one-name, r=oli-obk
bors [Sat, 9 Apr 2022 22:48:00 +0000 (22:48 +0000)]
Auto merge of #95435 - cjgillot:one-name, r=oli-obk

Make def names and HIR names consistent.

The name in the `DefKey` is interned to create the `DefId`, so it does not
require any query to access.  This can be leveraged to avoid a few useless
HIR accesses for names.

~In order to achieve that, generic parameters created from universal
impl-trait are given the pretty-printed ast as a name, instead of
`{{opaque}}`.~

~Drive-by: the `TyCtxt::opt_item_name` used a dummy span for non-local
definitions.  We have access to `def_ident_span`, so we use it.~

2 years agoUpdate asm-may_unwind test to handle use of asm with outputs.
Luqman Aden [Sat, 9 Apr 2022 22:16:38 +0000 (15:16 -0700)]
Update asm-may_unwind test to handle use of asm with outputs.

2 years agoAuto merge of #95855 - Dylan-DPC:rollup-h45xmpw, r=Dylan-DPC
bors [Sat, 9 Apr 2022 20:13:28 +0000 (20:13 +0000)]
Auto merge of #95855 - Dylan-DPC:rollup-h45xmpw, r=Dylan-DPC

Rollup of 7 pull requests

Successful merges:

 - #94794 (Clarify indexing into Strings)
 - #95361 (Make non-power-of-two alignments a validity error in `Layout`)
 - #95369 (Fix `x test src/librustdoc` with `download-rustc` enabled )
 - #95805 (Left overs of #95761)
 - #95808 (expand: Remove `ParseSess::missing_fragment_specifiers`)
 - #95817 (hide another #[allow] directive from a docs example)
 - #95831 (Use bitwise XOR in to_ascii_uppercase)

Failed merges:

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

2 years agoSwitch to the 'normal' basic block for writing asm outputs if needed.
Luqman Aden [Sat, 9 Apr 2022 19:25:46 +0000 (15:25 -0400)]
Switch to the 'normal' basic block for writing asm outputs if needed.

We may sometimes emit an `invoke` instead of a `call` for inline
assembly during the MIR -> LLVM IR lowering. But we failed to update
the IR builder's current basic block before writing the results to the
outputs. This would result in invalid IR because the basic block would
end in a `store` instruction, which isn't a valid terminator.

2 years agoremove the if block
ouz-a [Sat, 9 Apr 2022 19:23:49 +0000 (22:23 +0300)]
remove the if block

2 years agoNote that CI tests Windows 10
Chris Denton [Sat, 9 Apr 2022 17:55:23 +0000 (18:55 +0100)]
Note that CI tests Windows 10

2 years agosupport multiple derefs
ouz-a [Sat, 9 Apr 2022 17:38:06 +0000 (20:38 +0300)]
support multiple derefs

2 years agoMake it possible to run `cargo test` for bootstrap
Joshua Nelson [Wed, 23 Mar 2022 23:23:26 +0000 (18:23 -0500)]
Make it possible to run `cargo test` for bootstrap

Note that this only runs bootstrap's self-tests, not compiler or library tests.

2 years agoRollup merge of #95831 - redzic:xor-uppercase, r=workingjubilee
Dylan DPC [Sat, 9 Apr 2022 16:26:30 +0000 (18:26 +0200)]
Rollup merge of #95831 - redzic:xor-uppercase, r=workingjubilee

Use bitwise XOR in to_ascii_uppercase

This saves an instruction compared to the previous approach, which
was to unset the fifth bit with bitwise OR.

Comparison of generated assembly on x86: https://godbolt.org/z/GdfvdGs39

This can also affect autovectorization, saving SIMD instructions as well: https://godbolt.org/z/cnPcz75T9

Not sure if `u8::to_ascii_lowercase` should also be changed, since using bitwise OR for that function does not require an extra bitwise negate since the code is setting a bit rather than unsetting a bit. `char::to_ascii_uppercase` already uses XOR, so no change seems to be required there.

2 years agoRollup merge of #95817 - oconnor663:doc_comment2, r=yaahc
Dylan DPC [Sat, 9 Apr 2022 16:26:29 +0000 (18:26 +0200)]
Rollup merge of #95817 - oconnor663:doc_comment2, r=yaahc

hide another #[allow] directive from a docs example

This is a repeat for Rc of e0e64a89304de2b34dbafbc6cb354d2be9e67835,
which cleaned up the same thing for Arc.

2 years agoRollup merge of #95808 - petrochenkov:fragspec, r=nnethercote
Dylan DPC [Sat, 9 Apr 2022 16:26:28 +0000 (18:26 +0200)]
Rollup merge of #95808 - petrochenkov:fragspec, r=nnethercote

expand: Remove `ParseSess::missing_fragment_specifiers`

It was used for deduplicating some errors for legacy code which are mostly deduplicated even without that, but at cost of global mutable state, which is not a good tradeoff.

cc https://github.com/rust-lang/rust/pull/95747#issuecomment-1091619403
r? ``@nnethercote``

2 years agoRollup merge of #95805 - c410-f3r:meta-vars, r=petrochenkov
Dylan DPC [Sat, 9 Apr 2022 16:26:27 +0000 (18:26 +0200)]
Rollup merge of #95805 - c410-f3r:meta-vars, r=petrochenkov

Left overs of #95761

These are just nits. Feel free to close this PR if all modifications are not worth merging.

* `#![feature(decl_macro)]` is not needed anymore in `rustc_expand`
* `tuple_impls` does not require `$Tuple:ident`. I guess it is there to enhance readability?

r? ```@petrochenkov```

2 years agoRollup merge of #95369 - jyn514:test-rustdoc, r=Mark-Simulacrum
Dylan DPC [Sat, 9 Apr 2022 16:26:26 +0000 (18:26 +0200)]
Rollup merge of #95369 - jyn514:test-rustdoc, r=Mark-Simulacrum

Fix `x test src/librustdoc` with `download-rustc` enabled

The problem was two-fold:
- Bootstrap was hard-coding that unit tests should always run with stage1, not stage2, and
- It hard-coded the sysroot layout in stage1, which puts libLLVM.so in `lib/rustlib/` instead of just `lib/`.

This also takes the liberty of fixing `test src/librustdoc --no-doc`, which has been broken since it was first added. It would be nice at some point to unify this logic with other tests; I opened a Zulip thread: https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Inconsistency.20in.20.60x.20test.60

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

2 years agoRollup merge of #95361 - scottmcm:valid-align, r=Mark-Simulacrum
Dylan DPC [Sat, 9 Apr 2022 16:26:25 +0000 (18:26 +0200)]
Rollup merge of #95361 - scottmcm:valid-align, r=Mark-Simulacrum

Make non-power-of-two alignments a validity error in `Layout`

Inspired by the zulip conversation about how `Layout` should better enforce `size <= isize::MAX as usize`, this uses an N-variant enum on N-bit platforms to require at the validity level that the existing invariant of "must be a power of two" is upheld.

This was MIRI can catch it, and means there's a more-specific type for `Layout` to store than just `NonZeroUsize`.

It's left as `pub(crate)` here; a future PR could consider giving it a tracking issue for non-internal usage.

2 years agoRollup merge of #94794 - mlodato517:mlodato517-clarify-string-indexing-docs, r=Mark...
Dylan DPC [Sat, 9 Apr 2022 16:26:25 +0000 (18:26 +0200)]
Rollup merge of #94794 - mlodato517:mlodato517-clarify-string-indexing-docs, r=Mark-Simulacrum

Clarify indexing into Strings

**This Commit**
Adds some clarity around indexing into Strings.

**Why?**
I was reading through the `Range` documentation and saw an
implementation for `SliceIndex<str>`. I was surprised to see this and
went to read the [`String`][0] documentation and, to me, it seemed to
say (at least) three things:

1. you cannot index into a `String`
2. indexing into a `String` could not be constant-time
3. indexing into a `String` does not have an obvious return type

I absolutely agree with the last point but the first two seemed
contradictory to the documentation around [`SliceIndex<str>`][1]
which mention:

1. you can do substring slicing (which is probably different than
   "indexing" but, because the method is called `index` and I associate
   anything with square brackets with "indexing" it was enough to
   confuse me)
2. substring slicing is constant-time (this may be algorithmic ignorance
   on my part but if `&s[i..i+1]` is O(1) then it seems confusing that
   `&s[i]` _could not possibly_ be O(1))

So I was hoping to clarify a couple things and, hopefully, in this PR
review learn a little more about the nuances here that confused me in
the first place.

[0]: https://doc.rust-lang.org/stable/std/string/struct.String.html#utf-8
[1]: https://doc.rust-lang.org/stable/std/slice/trait.SliceIndex.html#impl-SliceIndex%3Cstr%3E

2 years agoFix missing space in lossy provenance cast lint
niluxv [Sat, 9 Apr 2022 15:39:07 +0000 (17:39 +0200)]
Fix missing space in lossy provenance cast lint

2 years agoCheck for git submodules in non-git source tree.
Eric Huss [Sat, 9 Apr 2022 15:10:34 +0000 (08:10 -0700)]
Check for git submodules in non-git source tree.

2 years agoupdate Miri
Ralf Jung [Sat, 9 Apr 2022 14:15:37 +0000 (10:15 -0400)]
update Miri

2 years agoRework String UTF-8 Documentation
Mark Lodato [Thu, 10 Mar 2022 02:43:04 +0000 (21:43 -0500)]
Rework String UTF-8 Documentation

**This Commit**
Adds some clarity around indexing into Strings and the constraints
driving various decisions there.

**Why?**
The [`String` documentation][0] mentions how `String`s can't be indexed
but `Range` has an implementation for `SliceIndex<str>`. This can be
confusing. There are also several statements to explain the lack of
`String` indexing:

- the inability to index into a `String` is an implication of UTF-8
  encoding
- indexing into a `String` could not be constant-time with UTF-8
  encoding
- indexing into a `String` does not have an obvious return type

This last statement made sense but the first two seemed contradictory to
the documentation around [`SliceIndex<str>`][1] which mention:

- one can index into a `String` with a `Range` (also called substring
  slicing but it uses the same syntax and the method name is `index`)
- `Range` indexing into a `String` is constant-time

To resolve this seeming contradiction the documentation is reworked to
more clearly explain what factors drive the decision to disallow
indexing into a `String` with a single number.

[0]: https://doc.rust-lang.org/stable/std/string/struct.String.html#utf-8
[1]: https://doc.rust-lang.org/stable/std/slice/trait.SliceIndex.html#impl-SliceIndex%3Cstr%3E

2 years agoAuto merge of #95697 - klensy:no-strings, r=petrochenkov
bors [Sat, 9 Apr 2022 13:15:26 +0000 (13:15 +0000)]
Auto merge of #95697 - klensy:no-strings, r=petrochenkov

refactor: simplify few string related interactions

Few small optimizations:

check_doc_keyword: don't alloc string for emptiness check
check_doc_alias_value: get argument as Symbol to prevent needless string convertions
check_doc_attrs: don't alloc vec, iterate over slice.
replace as_str() check with symbol check
get_single_str_from_tts: don't prealloc string
trivial string to str replace
LifetimeScopeForPath::NonElided use Vec<Symbol> instead of Vec<String>
AssertModuleSource use FxHashSet<Symbol> instead of BTreeSet<String>
CrateInfo.crate_name replace FxHashMap<CrateNum, String> with FxHashMap<CrateNum, Symbol>

2 years agoexpand: Remove `ParseSess::missing_fragment_specifiers`
Vadim Petrochenkov [Fri, 8 Apr 2022 13:04:37 +0000 (16:04 +0300)]
expand: Remove `ParseSess::missing_fragment_specifiers`

It was used for deduplicating some errors for legacy code which are mostly deduplicated even without that, but at cost of global mutable state, which is not a good tradeoff.

2 years agoAuto merge of #95840 - Dylan-DPC:rollup-erz5u6w, r=Dylan-DPC
bors [Sat, 9 Apr 2022 11:05:30 +0000 (11:05 +0000)]
Auto merge of #95840 - Dylan-DPC:rollup-erz5u6w, r=Dylan-DPC

Rollup of 6 pull requests

Successful merges:

 - #95308 (Reduce the amount of unstable features used in libproc_macro)
 - #95676 (Update RLS)
 - #95769 (Hide cross-crate `#[doc(hidden)]` associated items in trait impls)
 - #95785 (interpret: err instead of ICE on size mismatches in to_bits_or_ptr_internal)
 - #95802 (fix unused constant warning on some Windows targets)
 - #95810 (Use `format-args-capture` and remove unnecessary nested blocks)

Failed merges:

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

2 years agoRollup merge of #95810 - TaKO8Ki:use-format-args-capture-and-remove-unnecessary-nesti...
Dylan DPC [Sat, 9 Apr 2022 10:52:07 +0000 (12:52 +0200)]
Rollup merge of #95810 - TaKO8Ki:use-format-args-capture-and-remove-unnecessary-nesting-in-rustc-borrowck, r=davidtwco

Use `format-args-capture` and remove unnecessary nested blocks

2 years agoRollup merge of #95802 - RalfJung:unused-win, r=Dylan-DPC
Dylan DPC [Sat, 9 Apr 2022 10:52:06 +0000 (12:52 +0200)]
Rollup merge of #95802 - RalfJung:unused-win, r=Dylan-DPC

fix unused constant warning on some Windows targets

When none of those `cfg_if!` apply (and on Miri), the constant remains unused.

2 years agoRollup merge of #95785 - RalfJung:interpret-size-mismatch, r=oli-obk
Dylan DPC [Sat, 9 Apr 2022 10:52:05 +0000 (12:52 +0200)]
Rollup merge of #95785 - RalfJung:interpret-size-mismatch, r=oli-obk

interpret: err instead of ICE on size mismatches in to_bits_or_ptr_internal

We did this a while ago already for `to_i32()` and friends, but missed this one. That became quite annoying when I was debugging an ICE caused by `read_pointer` in a Miri shim where the code was passing an argument at the wrong type.

Having `scalar_to_ptr` be fallible is consistent with all the other `Scalar::to_*` methods being fallible. I added `unwrap` only in code outside the interpreter, which is no worse off than before now in terms of panics.

r? ````@oli-obk````

2 years agoRollup merge of #95769 - fmease:fix-issue-95717, r=GuillaumeGomez
Dylan DPC [Sat, 9 Apr 2022 10:52:04 +0000 (12:52 +0200)]
Rollup merge of #95769 - fmease:fix-issue-95717, r=GuillaumeGomez

Hide cross-crate `#[doc(hidden)]` associated items in trait impls

Fixes #95717.

r? ```@GuillaumeGomez```
This is the bug I ran into in #95316.

```@rustbot``` label T-rustdoc A-cross-crate-reexports

2 years agoRollup merge of #95676 - pietroalbini:pa-bump-rls, r=pietroalbini
Dylan DPC [Sat, 9 Apr 2022 10:52:03 +0000 (12:52 +0200)]
Rollup merge of #95676 - pietroalbini:pa-bump-rls, r=pietroalbini

Update RLS

This PR updates RLS to include the following PRs:

* https://github.com/rust-lang/rls/pull/1766
* https://github.com/rust-lang/rls/pull/1767
* https://github.com/rust-lang/rls/pull/1771
* https://github.com/rust-lang/rls/pull/1772

It also updates racer to fix RLS compilation with the parallel compiler enabled.