Commit graph

158359 commits

Author SHA1 Message Date
bors
faea820643 Auto merge of #90954 - Amanieu:fix-aarch64-asm, r=nikic
Update llvm submodule

- [DIArgList] Re-unique after changing operands to fix non-determinism
- [AArch64][GlobalISel] Fix an crash in RBS due to a new regclass being added.
2021-11-17 14:07:42 +00:00
Guillaume Gomez
bf10c88fbd Make scrollbar in the sidebar always visible for visual consistency 2021-11-17 14:45:17 +01:00
bors
41301c3b23 Auto merge of #90966 - matthiaskrgr:rollup-4akzcrh, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #90733 (Build musl dist artifacts with debuginfo enabled)
 - #90787 (Add `#[inline]`s to `SortedIndexMultiMap`)
 - #90920 (⬆️ rust-analyzer)
 - #90933 (Fix await suggestion on non-future type)
 - #90935 (Alphabetize language features)
 - #90949 (update miri)
 - #90958 (Mark `<*const _>::align_offset` and `<*mut _>::align_offset` as `const fn`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-11-17 02:58:29 +00:00
Matthias Krüger
0c3a662ba9
Rollup merge of #90958 - WaffleLapkin:const_align_offset, r=oli-obk
Mark `<*const _>::align_offset` and `<*mut _>::align_offset` as `const fn`

This PR marks the following APIs as `const`:
```rust
impl<T> *const T {
    pub const fn align_offset(self, align: usize) -> usize;
}

impl<T> *mut T {
    pub const fn align_offset(self, align: usize) -> usize;
}
```

`const` implementation simply returns `usize::MAX`.

---

Previous discussion: https://github.com/rust-lang/rust/pull/90607#discussion_r743638164

---

r? `@oli-obk`
2021-11-16 23:58:27 +01:00
Matthias Krüger
862565c3af
Rollup merge of #90949 - RalfJung:miri, r=RalfJung
update miri

This is needed to fix https://github.com/rust-lang/miri-test-libstd
r? ````@ghost````
2021-11-16 23:58:26 +01:00
Matthias Krüger
3f550078c9
Rollup merge of #90935 - jhpratt:alphabetize-features, r=joshtriplett
Alphabetize language features

This should significantly reduce the frequency of merge conflicts.

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

````@rustbot```` label: +A-contributor-roadblock +S-waiting-on-review
2021-11-16 23:58:25 +01:00
Matthias Krüger
eb9859f00d
Rollup merge of #90933 - compiler-errors:master, r=estebank
Fix await suggestion on non-future type

Remove a match block that would suggest to add `.await` in the case where the expected type's `Future::Output` equals the found type. We only want to suggest `.await`ing in the opposite case (the found type's `Future::Output` equals the expected type).

The code sample is here: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=6ba6b83d4dddda263553b79dca9f6bcb

Before:
```
➜  ~ rustc --edition=2021 --crate-type=lib test.rs
error[E0308]: `match` arms have incompatible types
 --> test.rs:4:14
  |
2 |       let x = match 1 {
  |  _____________-
3 | |         1 => other(),
  | |              ------- this is found to be of type `impl Future`
4 | |         2 => other().await,
  | |              ^^^^^^^^^^^^^ expected opaque type, found enum `Result`
5 | |     };
  | |_____- `match` arms have incompatible types
  |
  = note: expected type `impl Future`
             found enum `Result<(), ()>`
help: consider `await`ing on the `Future`
  |
4 |         2 => other().await.await,
  |                           ++++++

error: aborting due to previous error

For more information about this error, try `rustc --explain E0308`.
```

After:
```
➜  ~ rustc +stage1 --edition=2021 --crate-type=lib test.rs
error[E0308]: `match` arms have incompatible types
 --> test.rs:4:14
  |
2 |       let x = match 1 {
  |  _____________-
3 | |         1 => other(),
  | |              ------- this is found to be of type `impl Future`
4 | |         2 => other().await,
  | |              ^^^^^^^^^^^^^ expected opaque type, found enum `Result`
5 | |     };
  | |_____- `match` arms have incompatible types
  |
  = note: expected type `impl Future`
             found enum `Result<(), ()>`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0308`.
```

Fixes #90931
2021-11-16 23:58:24 +01:00
Matthias Krüger
b7b335593f
Rollup merge of #90920 - lnicola:rust-analyzer-2021-11-15, r=lnicola
⬆️ rust-analyzer

r? ``@ghost``
2021-11-16 23:58:23 +01:00
Matthias Krüger
c63cf076b5
Rollup merge of #90787 - JohnTitor:inline-sorted-index-map, r=oli-obk
Add `#[inline]`s to `SortedIndexMultiMap`

They're small enough and good candidates to add `#[inline]` generally.
2021-11-16 23:58:22 +01:00
Matthias Krüger
3b0249b1c9
Rollup merge of #90733 - wesleywiser:musl_debuginfo, r=Mark-Simulacrum
Build musl dist artifacts with debuginfo enabled

Since our musl targets link to a version of musl we build and bundle
with the targets, if users need to debug into musl or generate
backtraces which contain parts of the musl library, they will be unable
to do so unless we enable and ship the debug info.

This patch changes our dist builds so they enabled debug info when
building musl. This patch also includes a fix for CFI detection in
musl's `configure` script which has been [posted upstream](https://www.openwall.com/lists/musl/2021/10/21/2).

The net effect of this is that we now ship debug info for musl in those
targets. This adds ~90kb to those artifacts but running `strip` on
binaries produced removes all of that. For a "hello world" Rust binary
on x86_64, the numbers are:

|                        | debug | release | release + strip |
|           -            |   -   |    -    |        -        |
| without musl debuginfo | 507kb |  495kb  |      410kb      |
| with musl debuginfo    | 595kb | 584kb | 410kb |

Once stripped, the final binaries are the same size (down to the byte).

Fixes #90103

r? `@Mark-Simulacrum`
2021-11-16 23:58:21 +01:00
Nicholas Nethercote
552073701f Remove unnecessary lifetime argument from arena macros.
Because it's always `'tcx`. In fact, some of them use a mixture of
passed-in `$tcx` and hard-coded `'tcx`, so no other lifetime would even
work.

This makes the code easier to read.
2021-11-17 09:38:30 +11:00
Michael Goulet
fc816c37b7 Fix await suggestion better 2021-11-16 13:30:01 -08:00
Nilstrieb
7c7f58d5b7 Fix case where ICE #90878 was still triggered by a leading newline
I cannot provide a test for that thanks to tidy.
2021-11-16 22:16:47 +01:00
Alex Crichton
97cd27ab1d Add emscripten to the "wasm" family of targets 2021-11-16 13:10:35 -08:00
Maybe Waffle
f926c0e0d9 Fill in tracking issue for feature const_align_offset 2021-11-16 23:58:40 +03:00
Esteban Kuber
4ca4e094ab Suggest removal of arguments for unit variant, not replacement 2021-11-16 20:40:35 +00:00
Maybe Waffle
8f5f094432 Mark <*const _>::align_offset and <*mut _>::align_offset as const fn 2021-11-16 23:03:28 +03:00
Mara Bos
b66fb641da Update test output. 2021-11-16 19:57:12 +01:00
Mara Bos
09e4a75f29 Use span_suggestions instead of multipart_suggestions. 2021-11-16 19:53:00 +01:00
Mara Bos
5a25751c1e Add new tests for compatible variant diagnostics. 2021-11-16 19:52:59 +01:00
Mara Bos
48777561ca Update tests. 2021-11-16 19:52:59 +01:00
Mara Bos
b331b66082 Improve compatible enum variant suggestions. 2021-11-16 19:52:58 +01:00
Mara Bos
453e2423e6 Improve suggestion for unit Option/Result at the end of a block. 2021-11-16 19:52:58 +01:00
Mara Bos
483cff7ed3 Add SourceMap::indentation_before. 2021-11-16 19:52:58 +01:00
Yuki Okushi
8f6fa4f548
Add a regression test for #87573 2021-11-17 03:52:38 +09:00
Yuki Okushi
ddc1d58ca8
windows: Return the "Not Found" error when a path is empty 2021-11-17 03:11:14 +09:00
Amanieu d'Antras
530cd5b61f Update llvm submodule 2021-11-16 16:49:16 +00:00
Wesley Wiser
83ce771c0f Update compiler/rustc_passes/src/check_attr.rs
Co-authored-by: Yuki Okushi <jtitor@2k36.org>
2021-11-16 11:43:13 -05:00
Ralf Jung
4c32ab8eb4 update miri 2021-11-16 09:28:30 -05:00
bors
d914f17ca7 Auto merge of #90919 - nnethercote:rm-DropArena, r=Mark-Simulacrum
Remove `DropArena`.

Most arena-allocate types that impl `Drop` get their own `TypedArena`, but a
few infrequently used ones share a `DropArena`. This sharing adds complexity
but doesn't help performance or memory usage. Perhaps it was more effective in
the past prior to some other improvements to arenas.

This commit removes `DropArena` and the sharing of arenas via the `few`
attribute of the `arena_types` macro. This change removes over 100 lines of
code and nine uses of `unsafe` (one of which affects the parallel compiler) and
makes the remaining code easier to read.
2021-11-16 11:48:37 +00:00
bors
934624fe5f Auto merge of #90945 - JohnTitor:rollup-wc35xss, r=JohnTitor
Rollup of 8 pull requests

Successful merges:

 - #86455 (check where-clause for explicit `Sized` before suggesting `?Sized`)
 - #90801 (Normalize both arguments of `equate_normalized_input_or_output`)
 - #90803 (Suggest `&str.chars()` on attempt to `&str.iter()`)
 - #90819 (Fixes incorrect handling of TraitRefs when emitting suggestions.)
 - #90910 (fix getting the discriminant of a zero-variant enum)
 - #90925 (rustc_mir_build: reorder bindings)
 - #90928 (Use a different server for checking clock drift)
 - #90936 (Add a regression test for #80772)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-11-16 08:22:55 +00:00
5225225
eee29b0b95 Increase tidy limit for parser by 1 2021-11-16 08:08:31 +00:00
5225225
09e59c2875 Inline printable function 2021-11-16 08:06:31 +00:00
5225225
17b5e2d167 Remove debug output from test stderr 2021-11-16 08:06:30 +00:00
5225225
52199c93bb Suggest removing the non-printing characters 2021-11-16 08:06:30 +00:00
5225225
de05d3ec31 Print full char literal on error if any are non-printing 2021-11-16 08:06:30 +00:00
Yuki Okushi
c73b35e05d
Rollup merge of #90936 - JohnTitor:issue-80772, r=Mark-Simulacrum
Add a regression test for #80772

Closes #80772
2021-11-16 15:59:44 +09:00
Yuki Okushi
3c1d5779ae
Rollup merge of #90928 - Mark-Simulacrum:fix-date-logging, r=pietroalbini
Use a different server for checking clock drift

The detectportal.firefox.com server seems to return a random-ish date; for
example I see the following across 5 curl's done consecutively locally, where
the real date is approximately 15 Nov 2021 06:36 UTC.

Date: Mon, 15 Nov 2021 13:34:53 GMT
Date: Mon, 15 Nov 2021 12:20:21 GMT
Date: Mon, 15 Nov 2021 00:06:47 GMT
Date: Mon, 15 Nov 2021 17:14:33 GMT
Date: Mon, 15 Nov 2021 13:33:21 GMT
2021-11-16 15:59:43 +09:00
Yuki Okushi
cdc12ba5a3
Rollup merge of #90925 - krasimirgg:rustc_mir_build_fix, r=petrochenkov
rustc_mir_build: reorder bindings

No functional changes intended.

I'm playing around with building compiler components using nightly rust
(2021-11-02) in a non-standard way. I encountered the following error while
trying to build rustc_mir_build:

```
error[E0597]: `wildcard` does not live long enough
    --> rust/src/nightly/compiler/rustc_mir_build/src/build/matches/mod.rs:1767:82
     |
1767 |         let mut otherwise_candidate = Candidate::new(expr_place_builder.clone(), &wildcard, false);
     |                                                                                  ^^^^^^^^^ borrowed value does not live long enough
...
1799 |     }
     |     -
     |     |
     |     `wildcard` dropped here while still borrowed
     |     borrow might be used here, when `guard_candidate` is dropped and runs the destructor for type `Candidate<'_, '_>`
     |
     = note: values in a scope are dropped in the opposite order they are defined
```

I believe this flags an issue that may become an error in the future.
Swapping the order of `wildcard` and `guard_candidate` resolves it.
2021-11-16 15:59:42 +09:00
Yuki Okushi
6d9c3a1b97
Rollup merge of #90910 - RalfJung:const-discriminant-empty-enum, r=petrochenkov
fix getting the discriminant of a zero-variant enum

Fixes https://github.com/rust-lang/rust/issues/89765
2021-11-16 15:59:41 +09:00
Yuki Okushi
d44cec3453
Rollup merge of #90819 - JakobDegen:issue-90804, r=petrochenkov
Fixes incorrect handling of TraitRefs when emitting suggestions.

Closes #90804 , although there were more issues here that were hidden by the thing that caused this ICE.

Underlying problem was that substitutions were being thrown out, which not only leads to an ICE but also incorrect diagnostics. On top of that, in some cases the self types from the root obligations were being mixed in with those from derived obligations.

This makes a couple diagnostics arguable worse ("`B<C>` does not implement `Copy`" instead of "`C` does not implement `Copy`") but the worse diagnostics are at least still correct and that downside is in my opinion clearly outweighed by the benefits of fixing the ICE and unambiguously wrong diagnostics.
2021-11-16 15:59:40 +09:00
Yuki Okushi
b17de50a41
Rollup merge of #90803 - TaKO8Ki:suggest-chars-on-attempt-to-iter, r=estebank
Suggest `&str.chars()` on attempt to `&str.iter()`

closes #90786
2021-11-16 15:59:39 +09:00
Yuki Okushi
21bff4a4c1
Rollup merge of #90801 - b-naber:missing_normalization_equate_inputs_output, r=jackh726
Normalize both arguments of `equate_normalized_input_or_output`

Fixes https://github.com/rust-lang/rust/issues/90638
Fixes https://github.com/rust-lang/rust/issues/90612

Temporary fix for a more complex underlying problem stemming from an inability to normalize closure substs during typecheck.

r? ````@jackh726````
2021-11-16 15:59:39 +09:00
Yuki Okushi
ebef3ce25b
Rollup merge of #86455 - tlyu:check-where-before-suggesting-unsized, r=estebank
check where-clause for explicit `Sized` before suggesting `?Sized`

Fixes #85945.

Based on #86454.

``@rustbot`` label +A-diagnostics +A-traits +A-typesystem +D-papercut +T-compiler
2021-11-16 15:59:38 +09:00
bors
a2a7683e8f Auto merge of #90845 - JakobDegen:adt-drop-perf, r=Mark-Simulacrum
Address performance regression introduced by #90218

As part of the changes in #90218 , the `adt_drop_tys` and friends code stopped recursing through the query system, meaning that intermediate computations did not get cached. This change adds the recursions back in without re-introducing any of the old issues.

On local benchmarks this fixes the 5% regressions in #90504 ; the wg-grammar regressions didn't seem to move too much. I may take some time later to look into those.

Not sure who to request for review here, so will leave it up to whoever gets it.
2021-11-16 05:18:57 +00:00
Taylor Yu
1a50725a4d refactor is_param_bound 2021-11-15 22:31:56 -06:00
Taylor Yu
c9fcbda389 check where clause before suggesting unsized 2021-11-15 22:31:55 -06:00
Jacob Pratt
2a82d1cd0c
Suggest where feature should be placed 2021-11-15 21:33:39 -05:00
Jacob Pratt
77b0613f1a
Alphabetize language features
This should significantly reduce the frequency of merge conflicts.
2021-11-15 21:33:39 -05:00
bors
02063124f9 Auto merge of #90934 - JohnTitor:rollup-5soqo0j, r=JohnTitor
Rollup of 10 pull requests

Successful merges:

 - #85766 (Stabilize File::options())
 - #88601 (Implement `Termination` for `Result<Infallible, E>`)
 - #90058 (Stabilize -Z strip as -C strip)
 - #90790 (Fix standard library test with read_link)
 - #90834 (Android is not GNU)
 - #90835 (Rename WASI's `is_character_device` to `is_char_device`.)
 - #90837 (Move some tests to more reasonable directories - 9)
 - #90848 (Remove bigint_helper_methods for *signed* types)
 - #90892 (fix ICE on Miri/CTFE copy of half a pointer)
 - #90909 (disable portable SIMD tests in Miri)

Failed merges:

 - #90128 (Stabilize -Z symbol-mangling-version=v0 as -C symbol-mangling-version=v0)

r? `@ghost`
`@rustbot` modify labels: rollup
2021-11-16 02:23:42 +00:00