Commit Graph

170921 Commits

Author SHA1 Message Date
Joshua Nelson
d16187c47f Remove references to ./tmp in-tree
These used to be used by codegen-units tests, but were switched from manually specifying directories
to just using `// incremental` in https://github.com/rust-lang/rust/pull/89101.
Remove the old references.
2022-06-26 23:25:12 -05:00
bors
0e1a6fb463 Auto merge of #98521 - JohnTitor:rollup-tl9sblx, r=JohnTitor
Rollup of 8 pull requests

Successful merges:

 - #98371 (Fix printing `impl trait` under binders)
 - #98385 (Work around llvm 12's memory ordering restrictions.)
 - #98474 (x.py: Support systems with only `python3` not `python`)
 - #98488 (Bump RLS to latest master on rust-lang/rls)
 - #98491 (Fix backtrace UI test when panic=abort is used)
 - #98502 (Fix source sidebar hover in ayu theme)
 - #98509 (diagnostics: consider parameter count when suggesting smart pointers)
 - #98513 (Fix LLVM rebuild with download-ci-llvm.)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-06-26 07:12:16 +00:00
Yuki Okushi
fba8dfd75f
Rollup merge of #98513 - ehuss:rebuild-llvm-download, r=Mark-Simulacrum
Fix LLVM rebuild with download-ci-llvm.

This fixes an issue where updating a local checkout that includes a change in `src/version` causes a linking failure.

The cause is that the `rustc_llvm` build script uses `rerun-if-changed` of `llvm-config` to know if it needs to rerun. Cargo only compares the timestamp of the last time the build script to the file. However, extracting the tar files retains the timestamps in the tarball which may be some time in the past. Since `src/version` is included in the LLVM `.so` filename, `rustc` attempts to load the wrong shared library since the `rustc_llvm` build script doesn't rerun.

https://github.com/rust-lang/cargo/issues/10791 contains a more detailed explanation.

The solution here is a hack which updates the timestamp of `llvm-config` to the current time when it is extracted.

This is a bit of a hack, but seems to be the best solution I can think of until https://github.com/rust-lang/cargo/issues/10791 is fixed. There are likely several other situations where this is a problem (such as using system LLVM), and this isn't really a complete fix.

Note that apple platforms are not directly affected by this problem because they don't have a version in the dylib filename.

How to test this:

1. On a linux host, enable download-ci-llvm
2. Check out 7036449c77 (the commit just before the last version bump)
3. `./x.py build library/std`
4. Check out 5f015a24f9 (the commit that bumped the version)
5. `./x.py build library/std`

Fixes #98495
2022-06-26 13:15:03 +09:00
Yuki Okushi
c3b2291dc3
Rollup merge of #98509 - rust-lang:notriddle/precise-pin-diag, r=compiler-errors
diagnostics: consider parameter count when suggesting smart pointers

Fixes #96834
2022-06-26 13:15:02 +09:00
Yuki Okushi
d774bc39e0
Rollup merge of #98502 - GuillaumeGomez:source-sidebar-hover, r=notriddle
Fix source sidebar hover in ayu theme

In the screenshot below, `rc.rs` should be orange:

![Screenshot from 2022-06-25 22-24-06](https://user-images.githubusercontent.com/3050060/175789532-99e8781d-2e62-43f7-bbd9-1b1151e1f8c1.png)

It's because the CSS selector was not precise enough and was "overloaded" with another one. This PR fixes it and adds a test for the colors in the source sidebar.

cc `@jsha`
r? `@notriddle`
2022-06-26 13:15:01 +09:00
Yuki Okushi
b1d66d810d
Rollup merge of #98491 - antoyo:fix/ui-test-backtrace-panic-abort, r=Dylan-DPC
Fix backtrace UI test when panic=abort is used

The function `contains_verbose_expected` is only used when the panic strategy is not abort, so it caused a warning when it was abort, which made the UI test failed on stderr comparison.
2022-06-26 13:15:00 +09:00
Yuki Okushi
d0828a3915
Rollup merge of #98488 - Mark-Simulacrum:bump-rls, r=pietroalbini
Bump RLS to latest master on rust-lang/rls

Of primary interest, this merges
rust-lang/rls@ece09b88c0 into rust-lang/rust,
which brings in the changes that fix RLS tests broken by #97853. #97853 already
introduced that commit's changes (under
rust-lang/rls@27f4044df0) but without putting those changes on
rust-lang/rls as a branch, so we ended up with an orphan commit that caused
trouble when updating submodules in rust-lang/rust.

This commit, once merged into rust-lang/rust, should continue to let RLS tests
to pass on rust-lang/rust's side and move us back into a healthy state where tip
of the submodule points to a valid master commit in the rust-lang/rls
repository.

cc https://github.com/rust-lang/rust/issues/98451, but not marking as fixed as I believe we need to add verification to prevent future oversights.
2022-06-26 13:14:59 +09:00
Yuki Okushi
e1862ca51c
Rollup merge of #98474 - dtolnay:python3, r=Mark-Simulacrum
x.py: Support systems with only `python3` not `python`

Fixes #71818 without the pitfalls so far described in previous attempts.
2022-06-26 13:14:58 +09:00
Yuki Okushi
7c3977669b
Rollup merge of #98385 - m-ou-se:llvm-12-memory-order, r=petrochenkov
Work around llvm 12's memory ordering restrictions.

Older llvm has the pre-C++17 restriction on success and failure memory ordering, requiring the former to be at least as strong as the latter. So, for llvm 12, this upgrades the success ordering to a stronger one if necessary.

See https://github.com/rust-lang/rust/issues/68464
2022-06-26 13:14:57 +09:00
Yuki Okushi
645e5c475a
Rollup merge of #98371 - compiler-errors:better-opaque-printing, r=oli-obk
Fix printing `impl trait` under binders

Before, we would render `impl for<'a> Trait<'a>` like `impl Trait<for<'a> 'a>`, lol.
2022-06-26 13:14:56 +09:00
bors
639a655e11 Auto merge of #98140 - klensy:compiletest-strip, r=Mark-Simulacrum
compiletest: strip debuginfo by default for mode=ui

This reduces occupied disk space, for example for src/test/ui it drops from 1972mb to 132mb (x86_64-pc-windows-msvc).

Individual tests that require debuginfo/symbols should turn this option off (as in fixed tests).
2022-06-26 00:03:07 +00:00
Eric Huss
418b1fa77a Fix LLVM rebuild with download-ci-llvm. 2022-06-25 16:49:00 -07:00
Michael Howell
0ea59f3bd6 diagnostics: consider parameter count when suggesting smart pointers 2022-06-25 15:50:00 -07:00
bors
20a6f3a8a8 Auto merge of #97513 - jyn514:submodule-handling, r=Mark-Simulacrum
Fully remove submodule handling from bootstrap.py

These submodules were previously updated in python because Cargo gives a hard error if toml files
are missing from the workspace:

```
error: failed to load manifest for workspace member `/home/jnelson/rust-lang/rust/src/tools/rls`

Caused by:
  failed to read `/home/jnelson/rust-lang/rust/src/tools/rls/Cargo.toml`

Caused by:
  No such file or directory (os error 2)
failed to run: /home/jnelson/rust-lang/rust/build/x86_64-unknown-linux-gnu/stage0/bin/cargo build --manifest-path /home/jnelson/rust-lang/rust/src/bootstrap/Cargo.toml
```

However, bootstrap doesn't actually need to be part of the workspace.
Remove it so we can move submodule handling fully to Rust, avoiding duplicate code between Rust and Python.

Note that this does break `cargo run`; it has to be `cd src/bootstrap && cargo run` now.
Given that we're planning to make the main entrypoint a shell script (or rust binary),
I think this is a good tradeoff for reduced complexity in bootstrap.py.

To get this working, I also had to remove support for vendoring when using the git sources, because `cargo vendor` requires all submodules to be checked out. I think this is ok; people who care about this are likely already using the pre-vendored `rustc-src` tarball.

Fixes https://github.com/rust-lang/rust/issues/90764. Helps with #94829
2022-06-25 21:01:10 +00:00
Guillaume Gomez
2bb46bedfc Add test for source sidebar elements colors 2022-06-25 22:22:35 +02:00
Guillaume Gomez
4c9e336c45 Fix CSS rule for selected and hovered items in the source sidebar 2022-06-25 21:43:54 +02:00
bors
9cf699d2ff Auto merge of #98412 - calebcartwright:sync-rustfmt, r=calebcartwright
Sync rustfmt

We had a bug in the update we made ~1 week ago, so running a somewhat early sync to pull the fix in
2022-06-25 18:00:12 +00:00
Antoni Boucher
50a46b92f6 Fix backtrace UI test when panic=abort is used 2022-06-25 11:48:26 -04:00
bors
8aab472d52 Auto merge of #98486 - matthiaskrgr:rollup-u7m508x, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #96412 (Windows: Iterative `remove_dir_all`)
 - #98126 (Mitigate MMIO stale data vulnerability)
 - #98149 (Set relocation_model to Pic on emscripten target)
 - #98194 (Leak pthread_{mutex,rwlock}_t if it's dropped while locked.)
 - #98298 (Point to type parameter definition when not finding variant, method and associated item)
 - #98311 (Reverse folder hierarchy)
 - #98401 (Add tracking issues to `--extern` option docs.)
 - #98429 (Use correct substs in enum discriminant cast)
 - #98431 (Suggest defining variable as mutable on `&mut _` type mismatch in pats)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-06-25 15:19:31 +00:00
Mark Rousskov
557793c2a4 Bump RLS to latest master on rust-lang/rls
Of primary interest, this merges
rust-lang/rls@ece09b88c0 into rust-lang/rust,
which brings in the changes that fix RLS tests broken by #97853. #97853 already
introduced that commit's changes (under
27f4044df03d15c7c38a483c3e4635cf4f51807d) but without putting those changes on
rust-lang/rls as a branch, so we ended up with an orphan commit that caused
trouble when updating submodules in rust-lang/rust.

This commit, once merged into rust-lang/rust, should continue to let RLS tests
to pass on rust-lang/rust's side and move us back into a healthy state where tip
of the submodule points to a valid master commit in the rust-lang/rls
repository.
2022-06-25 10:05:31 -04:00
Matthias Krüger
1f923c2a41
Rollup merge of #98431 - WaffleLapkin:mut_pat_suggestions, r=compiler-errors
Suggest defining variable as mutable on `&mut _` type mismatch in pats

Suggest writing `mut a` where `&mut a` was written but a non-ref type provided.

Since we still don't have "apply either one of the suggestions but not both" kind of thing, the interaction with the suggestion of removing `&[mut]` or moving it to the type is weird, and idk how to make it better..

r? ``@compiler-errors``
2022-06-25 15:14:14 +02:00
Matthias Krüger
ea07b969ea
Rollup merge of #98429 - b-naber:use-correct-substs-discriminant-cast, r=lcnr
Use correct substs in enum discriminant cast

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

r? ```@lcnr```
2022-06-25 15:14:13 +02:00
Matthias Krüger
95ba108b60
Rollup merge of #98401 - ehuss:extern-tracking, r=Dylan-DPC
Add tracking issues to `--extern` option docs.
2022-06-25 15:14:12 +02:00
Matthias Krüger
65187f51dc
Rollup merge of #98311 - eggyal:reverse-folder-hierarchy, r=jackh726
Reverse folder hierarchy

#91318 introduced a trait for infallible folders distinct from the fallible version.  For some reason (completely unfathomable to me now that I look at it with fresh eyes), the infallible trait was a supertrait of the fallible one: that is, all fallible folders were required to also be infallible.  Moreover the `Error` associated type was defined on the infallible trait!  It's so absurd that it has me questioning whether I was entirely sane.

This trait reverses the hierarchy, so that the fallible trait is a supertrait of the infallible one: all infallible folders are required to also be fallible (which is a trivial blanket implementation).  This of course makes much more sense!  It also enables the `Error` associated type to sit on the fallible trait, where it sensibly belongs.

There is one downside however: folders expose a `tcx` accessor method.  Since the blanket fallible implementation for infallible folders only has access to a generic `F: TypeFolder`, we need that trait to expose such an accessor to which we can delegate.  Alternatively it's possible to extract that accessor into a separate `HasTcx` trait (or similar) that would then be a supertrait of both the fallible and infallible folder traits: this would ensure that there's only one unambiguous `tcx` method, at the cost of a little additional boilerplate.  If desired, I can submit that as a separate PR.

r? ````@jackh726````
2022-06-25 15:14:11 +02:00
Matthias Krüger
8257ba29ef
Rollup merge of #98298 - TaKO8Ki:point-to-type-param-definition, r=compiler-errors
Point to type parameter definition when not finding variant, method and associated item

fixes #77391
2022-06-25 15:14:10 +02:00
Matthias Krüger
ecefccd8d2
Rollup merge of #98194 - m-ou-se:leak-locked-pthread-mutex, r=Amanieu
Leak pthread_{mutex,rwlock}_t if it's dropped while locked.

Fixes https://github.com/rust-lang/rust/issues/85434.
2022-06-25 15:14:09 +02:00
Matthias Krüger
45ef23d78e
Rollup merge of #98149 - hoodmane:emscripten-pic, r=petrochenkov
Set relocation_model to Pic on emscripten target

So we can support dynamically linking libraries with Emscripten (otherwise we need to use nightly and `-Zbuild-std` to rebuild std with relocations).
`````@sbc100`````
2022-06-25 15:14:08 +02:00
Matthias Krüger
a130521189
Rollup merge of #98126 - fortanix:raoul/mitigate_stale_data_vulnerability, r=cuviper
Mitigate MMIO stale data vulnerability

Intel publicly disclosed the MMIO stale data vulnerability on June 14. To mitigate this vulnerability, compiler changes are required for the `x86_64-fortanix-unknown-sgx` target.
cc: ````@jethrogb````
2022-06-25 15:14:07 +02:00
Matthias Krüger
d7388d1857
Rollup merge of #96412 - ChrisDenton:remove-dir-all, r=thomcc
Windows: Iterative `remove_dir_all`

This will allow better strategies for use of memory and File handles. However, fully taking advantage of that is left to future work.

Note to reviewer: It's probably best to view the `remove_dir_all_recursive` as a new function. The diff is not very helpful (imho).
2022-06-25 15:14:06 +02:00
bors
00ce47209d Auto merge of #96820 - r-raymond:master, r=cuviper
Make RwLockReadGuard covariant

Hi, first time contributor here, if anything is not as expected, please let me know.

`RwLockReadGoard`'s type constructor is invariant. Since it behaves like a smart pointer to an immutable reference, there is no reason that it should not be covariant. Take e.g.

```
fn test_read_guard_covariance() {
    fn do_stuff<'a>(_: RwLockReadGuard<'_, &'a i32>, _: &'a i32) {}
    let j: i32 = 5;
    let lock = RwLock::new(&j);
    {
        let i = 6;
        do_stuff(lock.read().unwrap(), &i);
    }
    drop(lock);
}
```
where the compiler complains that &i doesn't live long enough. If `RwLockReadGuard` is covariant, then the above code is accepted because the lifetime can be shorter than `'a`.

In order for `RwLockReadGuard` to be covariant, it can't contain a full reference to the `RwLock`, which can never be covariant (because it exposes a mutable reference to the underlying data structure). By reducing the data structure to the required pieces of `RwLock`, the rest falls in place.

If there is a better way to do a test that tests successful compilation, please let me know.

Fixes #80392
2022-06-25 13:03:53 +00:00
bors
1aabd8a4a6 Auto merge of #93700 - rossmacarthur:ft/iter-next-chunk, r=m-ou-se
Add `Iterator::next_chunk`

See also https://github.com/rust-lang/rust/pull/92393

### Prior art

-  [`Itertools::next_tuple()`](https://docs.rs/itertools/latest/itertools/trait.Itertools.html#method.next_tuple)

### Unresolved questions

- Should we also add `next_chunk_back` to `DoubleEndedIterator`?
- Should we rather call this `next_array()` or `next_array_chunk`?
2022-06-25 09:40:54 +00:00
David Tolnay
9169905eb2
x.py: Support systems with only python3 not python 2022-06-24 18:03:09 -07:00
bors
e02d645110 Auto merge of #98459 - pietroalbini:pa-1.64, r=pietroalbini
Bump version to 1.64.0

r? `@ghost`
2022-06-24 23:27:05 +00:00
Michael Goulet
e80ccedbae Use write! instead of p! to avoid having to use weird scoping 2022-06-24 15:47:59 -07:00
Michael Goulet
20cea3ebb4 Fix printing impl trait under binders 2022-06-24 15:36:55 -07:00
Maybe Waffle
1dfb53b7da improve wording of a suggestion 2022-06-24 21:18:26 +04:00
Waffle Maybe
e25129b055 take advantage of a labelled block
Co-authored-by: Michael Goulet <michael@errs.io>
2022-06-24 21:14:34 +04:00
Pietro Albini
5f015a24f9
bump version to 1.64.0 2022-06-24 17:27:24 +02:00
b-naber
bf48b622a5 fmt 2022-06-24 16:43:38 +02:00
Hood Chatham
ada2accf8e Set relocation_model to Pic on emscripten target 2022-06-24 06:20:46 -07:00
bors
fdca237d51 Auto merge of #98397 - RalfJung:miri, r=RalfJung
update Miri

Fixes https://github.com/rust-lang/rust/issues/98366
r? `@ghost` Cc `@rust-lang/miri`
2022-06-24 12:58:32 +00:00
b-naber
f39c0d6b0a address review 2022-06-24 13:43:56 +02:00
b-naber
38814fc039 small refactor 2022-06-24 13:19:23 +02:00
bors
7036449c77 Auto merge of #98447 - JohnTitor:rollup-pponoo3, r=JohnTitor
Rollup of 9 pull requests

Successful merges:

 - #91264 (Add macro support in jump to definition feature)
 - #96955 (Remove (transitive) reliance on sorting by DefId in pretty-printer)
 - #97633 (Session object: Set OS/ABI)
 - #98039 (Fix `panic` message for `BTreeSet`'s `range` API and document `panic` cases)
 - #98214 (rustc_target: Remove some redundant target properties)
 - #98280 (Improve suggestion for calling fn-like expr on type mismatch)
 - #98394 (Fixup missing renames from `#[main]` to `#[rustc_main]`)
 - #98411 (Update tendril)
 - #98419 (Remove excess rib while resolving closures)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-06-24 10:35:00 +00:00
b-naber
2e3221a927 use correct substs in enum discriminant hack 2022-06-24 11:11:40 +02:00
b-naber
4c4fb7152b add test 2022-06-24 11:11:40 +02:00
Yuki Okushi
5e98e55668
Rollup merge of #98419 - WaffleLapkin:remove_excess_rib, r=compiler-errors
Remove excess rib while resolving closures

I've mentioned this on [zulip](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/.60ClosureOrAsyncRibKind.60.20weirdness/near/286982959), in `rustc_resolve`, while resolving closures we add an excess `ClosureOrAsyncRibKind`. It's excess because we later add another one in `visit_fn`.

I couldn't find a way in which removing this will break anything, all test seem to pass, etc.

r? ``@compiler-errors``
cc ``@davidtwco``
2022-06-24 16:43:49 +09:00
Yuki Okushi
d26b03c429
Rollup merge of #98411 - ehuss:update-tendril, r=Mark-Simulacrum
Update tendril

The 0.4.1 version of `tendril` (used by mdbook) triggers the `unaligned_references` lint which is now reported as a future-compatibility warning as of #95372. This updates it to 0.4.3 which does not trigger the warning. This update also triggered the update of `futf` from 0.1.4 to 0.1.5.

tendril changes: https://github.com/servo/tendril/compare/v0.4.1...v0.4.3
futf changes: https://github.com/servo/futf/compare/v0.1.4...v0.1.5
2022-06-24 16:43:48 +09:00
Yuki Okushi
f3078d0f44
Rollup merge of #98394 - Enselic:fixup-rustc_main-renames, r=petrochenkov
Fixup missing renames from `#[main]` to `#[rustc_main]`

In #84217 `#[main]` was removed and replaced with `#[rustc_main]`. In some places the rename was forgotten, which makes the current code confusing, because at first glance it seems that `#[main]` is still around. Perform the renames also in these places.

I noticed this (after first being confused by it) when working on #97802.

r? `@petrochenkov`

(since you reviewed the other PR)
2022-06-24 16:43:47 +09:00
Yuki Okushi
964fc41b89
Rollup merge of #98280 - compiler-errors:better-call-closure-on-type-err, r=estebank
Improve suggestion for calling fn-like expr on type mismatch

1.) Suggest calling values of with RPIT types (and probably TAIT) when we expect `Ty` and have `impl Fn() -> Ty`
2.) Suggest calling closures even when they're not assigned to a local variable first
3.) Drive-by fix of a pretty-printing bug (`impl Fn()-> Ty` => `impl Fn() -> Ty`)

r? ```@estebank```
2022-06-24 16:43:46 +09:00