Commit Graph

163662 Commits

Author SHA1 Message Date
Erik Desjardins
0c78433749 update vec-shrink-panik test to allow panic_no_unwind in landingpads 2022-02-27 23:15:49 -05:00
Erik Desjardins
851fcc7a54 Revert "Auto merge of #92419 - erikdesjardins:coldland, r=nagisa"
This reverts commit 4f49627c6f, reversing
changes made to 028c6f1454.
2022-02-27 23:11:03 -05:00
bors
3b1fe7e7c9 Auto merge of #94084 - Mark-Simulacrum:drop-sharded, r=cjgillot
Avoid query cache sharding code in single-threaded mode

In non-parallel compilers, this is just adding needless overhead at compilation time (since there is only one shard statically anyway). This amounts to roughly ~10 seconds reduction in bootstrap time, with overall neutral (some wins, some losses) performance results.

Parallel compiler performance should be largely unaffected by this PR; sharding is kept there.
2022-02-27 14:04:07 +00:00
bors
bab4c13f64 Auto merge of #94400 - c410-f3r:more-let-chains, r=Dylan-DPC
2 - Make more use of `let_chains`

Continuation of #94376.

cc #53667
2022-02-27 11:45:55 +00:00
bors
2bd9656c80 Auto merge of #94221 - erikdesjardins:addattr, r=nikic
Add LLVM attributes in batches instead of individually

This should improve performance.

~r? `@ghost` (blocked on #94127)~
2022-02-27 09:23:24 +00:00
bors
9323028156 Auto merge of #94144 - est31:let_else_trait_selection, r=cjgillot
rustc_trait_selection: adopt let else in more places

Continuation of #89933, #91018, #91481, #93046, #93590, #94011.

I have extended my clippy lint to also recognize tuple passing and match statements. The diff caused by fixing it is way above 1 thousand lines. Thus, I split it up into multiple pull requests to make reviewing easier. This PR handles rustc_trait_selection.
2022-02-27 07:02:46 +00:00
bors
6abd8cd643 Auto merge of #94361 - nikic:s390x-update, r=Mark-Simulacrum
Update dist-s390x-dist image

Update to Ubuntu 20.04 and crosstool-ng 1.24.0. I've upgraded the
ct-ng config and then manually reset the kernel and glibc versions
to the oldest supported.

Specifically, we're updating from kernel 2.6.32.68 to 2.6.32.71
and glibc 2.11.1 to 2.12.1 here. The compiler toolchain is also
updated, but I don't think that's relevant for compatibility.

I've also enabled LLD, so this fixes #94324.

r? `@Mark-Simulacrum` cc `@uweigand`
2022-02-27 04:08:50 +00:00
bors
035a717ee8 Auto merge of #94373 - erikdesjardins:getitinl, r=Mark-Simulacrum
Make TLS __getit #[inline(always)] on non-Windows

This may improve perf, and/or stop `externs` perf benchmarks from being flaky.

r? `@ghost`
2022-02-27 01:23:48 +00:00
Nikita Popov
dac285905b Update dist-s390x-dist image
Update to Ubuntu 20.04 and crosstool-ng 1.24.0. I've updated the
ct-ng config and then manually reset the kernel and glibc versions
to the oldest supported.

Specifically, we're updating from kernel 2.6.32.68 to 2.6.32.71
and glibc 2.11.1 to 2.12.1 here. The compiler toolchain is also
updated, but I don't think that's relevant for compatibility.
2022-02-26 23:40:47 +01:00
Erik Desjardins
0d0cc4f6a0 AttrBuilder doesn't take a context in old LLVM 2022-02-26 17:16:01 -05:00
Erik Desjardins
ac9f4f7d0d use attrbuilder to remove attrs in old LLVM 2022-02-26 16:58:45 -05:00
Erik Desjardins
91e7e8ddcb just put smallvec lengths in the signature 2022-02-26 16:58:17 -05:00
bors
761e888485 Auto merge of #93516 - nagisa:branch-protection, r=cjgillot
No branch protection metadata unless enabled

Even if we emit metadata disabling branch protection, this metadata may
conflict with other modules (e.g. during LTO) that have different branch
protection metadata set.

This is an unstable flag and feature, so ideally the flag not being
specified should act as if the feature wasn't implemented in the first
place.

Additionally this PR also ensures we emit an error if
`-Zbranch-protection` is set on targets other than the supported
aarch64. For now the error is being output from codegen, but ideally it
should be moved to earlier in the pipeline before stabilization.
2022-02-26 21:53:03 +00:00
bors
10cc7a6d03 Auto merge of #93449 - JakobDegen:restrict-hasdrop-optimization, r=cjgillot
Restrict query recursion in `needs_significant_drop`

Overly aggressive use of the query system to improve caching lead to query cycles and consequently ICEs. This patch fixes this by restricting the use of the query system as a cache to those cases where it is definitely correct.

Closes #92725 .

This is essentially a revert of #90845 for the significant drop case only. The general `needs_drop` still does the same thing. The hope is that this is enough to preserve the performance improvements of that PR while fixing the ICE. Should get a perf run to verify that this is the case.

cc `@cjgillot`
2022-02-26 19:25:04 +00:00
Erik Desjardins
30d3ce0674 Add LLVM attributes in batches instead of individually
This should improve performance.
2022-02-26 13:14:55 -05:00
Caio
ef5601b321 2 - Make more use of let_chains
Continuation of #94376.

cc #53667
2022-02-26 13:45:43 -03:00
bors
8604ef0878 Auto merge of #94329 - flip1995:clippyup, r=Manishearth
Update Clippy

r? `@Manishearth`
2022-02-26 16:44:17 +00:00
bors
6f681a8eb3 Auto merge of #94376 - c410-f3r:more-let-chains, r=petrochenkov
Initiate the inner usage of `let_chains`

The intention here is create a strong and robust foundation for a possible future stabilization so please, do not let the lack of any external tool support prevent the merge of this PR. Besides, `let_chains` is useful by itself.

cc #53667
2022-02-26 14:23:27 +00:00
flip1995
0d4e58304d
Update Cargo.lock (Clippy version bump) 2022-02-26 14:43:58 +01:00
flip1995
d128f9392d
Merge commit 'e329249b6a3a98830d860c74c8234a8dd9407436' into clippyup 2022-02-26 14:26:21 +01:00
bors
8c9640e34c Auto merge of #94078 - TaKO8Ki:suggest-float-literal-for-float-divided-by-integer, r=estebank
Suggest a float literal when dividing a floating-point type by `{integer}`

closes #93829
2022-02-26 11:58:12 +00:00
bors
8128e910c0 Auto merge of #94127 - erikdesjardins:debugattr, r=nikic
At opt-level=0, apply only ABI-affecting attributes to functions

This should provide a small perf improvement for debug builds,
and should more than cancel out the perf regression from adding noundef (https://github.com/rust-lang/rust/pull/93670#issuecomment-1038347581, #94106).

r? `@nikic`
2022-02-26 09:41:19 +00:00
bors
d5a9bc9476 Auto merge of #94392 - matthiaskrgr:rollup-npscf95, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #93400 (Do not suggest using a const parameter when there are bounds on an unused type parameter)
 - #93982 (Provide extra note if synthetic type args are specified)
 - #94087 (Remove unused `unsound_ignore_borrow_on_drop`)
 - #94235 (chalk: Fix wrong debrujin index in opaque type handling.)
 - #94306 (Avoid exhausting stack space in dominator compression)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-02-26 07:00:33 +00:00
Matthias Krüger
648a8e314a
Rollup merge of #94306 - Mark-Simulacrum:dom-fixups, r=jackh726
Avoid exhausting stack space in dominator compression

Doesn't add a test case -- I ended up running into this while playing with the generated example from #43578, which we could do with a run-make test (to avoid checking a large code snippet into tree), but I suspect we don't want to wait for it to compile (locally it takes ~14s -- not terrible, but doesn't seem worth it to me). In practice stack space exhaustion is difficult to test for, too, since if we set the bound too low a different call structure above us (e.g., a nearer ensure_sufficient_stack call) would let the test pass even with the old impl, most likely.

Locally it seems like this manages to perform approximately equivalently to the recursion, but will run perf to confirm.
2022-02-26 07:52:44 +01:00
Matthias Krüger
d6ca388584
Rollup merge of #94235 - Dirbaio:fix-chalk-opaque-debrujin, r=jackh726
chalk: Fix wrong debrujin index in opaque type handling.

A folder in opaque type lowering was substituting all opaque type references with a variable with debrujin index 0 ignoring how many binders deep we are.

This caused an ICE with `Not enough bound vars: ^0 not found in []` ([full logs](https://gist.github.com/Dirbaio/2b9374ff4fce37afb9d665dc9f0000df)) with the following code.

```rust
fn main() -> () {}
async fn foo(x: u32) -> u32 {
    x
}
```

With the fix, it no longer ICEs. It still doesn't typecheck due to generator issues. I've added a "known-bug" test so that at least it doesn't regress back to ICEing.

r? ``@jackh726``
2022-02-26 07:52:43 +01:00
Matthias Krüger
734b924d05
Rollup merge of #94087 - tmiasko:rm-ignore-borrow-on-drop, r=jackh726
Remove unused `unsound_ignore_borrow_on_drop`
2022-02-26 07:52:42 +01:00
Matthias Krüger
5dcee689d1
Rollup merge of #93982 - nbdd0121:explicit-generic-args, r=jackh726
Provide extra note if synthetic type args are specified

Implement the unresolved question in #83701 as suggested in https://github.com/rust-lang/rust/pull/86176#discussion_r680613890.

r? ``@jackh726``
2022-02-26 07:52:41 +01:00
Matthias Krüger
be9b99b0d0
Rollup merge of #93400 - ChayimFriedman2:dont-suggest-using-const-with-bounds-unused-generic-param, r=jackh726
Do not suggest using a const parameter when there are bounds on an unused type parameter

The user wrote the bound, so it's obvious they want a type.
2022-02-26 07:52:41 +01:00
Takayuki Maeda
c60bae78ac suggest a float literal when dividing a floating-point type by {integer}
fix a message

implement a rustfix-applicable suggestion

implement `suggest_floating_point_literal`

add `ObligationCauseCode::BinOp`

remove duplicate code

fix function names in uitests

use `Diagnostic` instead of `DiagnosticBuilder`
2022-02-26 14:28:51 +09:00
bors
7c3331ccf9 Auto merge of #92884 - compiler-errors:const-generic-expr-recovery, r=jackh726
Suggest adding `{ .. }` around more bad const generic exprs

Fixes #92776
2022-02-26 04:39:11 +00:00
Gary Guo
674745836c Provide extra note if synthetic type args are specified 2022-02-26 03:21:39 +00:00
bors
e329249b6a Auto merge of #8464 - Jarcho:ptr_arg_8463, r=camsteffen
Fix `ptr_arg`

fixes: #8463

changelog: Fix `ptr_arg` when multiple arguments are being checked in one function
2022-02-26 03:00:53 +00:00
bors
2c8d5a2500 Auto merge of #8453 - tamaroning:fix_large_enum_variant, r=camsteffen
fix false positives of large_enum_variant

fixes: #8321
The size of enums containing generic type was calculated to be 0.
I changed [large_enum_variant] so that such enums are not linted.

changelog: none
2022-02-26 02:42:43 +00:00
bors
12b71ed4c5 Auto merge of #94385 - matthiaskrgr:rollup-4pwegqk, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #93603 (Populate liveness facts when calling `get_body_with_borrowck_facts` without `-Z polonius`)
 - #93870 (Fix switch on discriminant detection in a presence of coverage counters)
 - #94355 (Add one more case to avoid ICE)
 - #94363 (Remove needless borrows from core::fmt)
 - #94377 (`check_used` should only look at actual `used` attributes)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-02-26 02:09:29 +00:00
Michael Goulet
6b52ac240a Suggest {} around more bad const generic exprs 2022-02-25 17:16:58 -08:00
Erik Desjardins
945276c920 avoid test failure on targets where all functions are dso_local (e.g. wasm) 2022-02-25 19:24:59 -05:00
Matthias Krüger
04f77803ee
Rollup merge of #94377 - cynecx:fix-used-with-args, r=nikic
`check_used` should only look at actual `used` attributes

cc? https://github.com/rust-lang/rust/issues/94348
r? ``@nikic``
2022-02-26 00:49:23 +01:00
Matthias Krüger
0c9d5e3c77
Rollup merge of #94363 - aDotInTheVoid:fmt-needless-borrows, r=scottmcm
Remove needless borrows from core::fmt
2022-02-26 00:49:23 +01:00
Matthias Krüger
5af6624def
Rollup merge of #94355 - ouz-a:master, r=oli-bok
Add one more case to avoid ICE

Fix for the  #94291, added one more case to related function to avoid ICE.

Not sure if my test is in the correct place 😅
2022-02-26 00:49:22 +01:00
Matthias Krüger
0da6dd3e97
Rollup merge of #93870 - tmiasko:const-precise-live-drops-with-coverage, r=ecstatic-morse
Fix switch on discriminant detection in a presence of coverage counters

Fixes #93848.

r? ``@ecstatic-morse``
2022-02-26 00:49:21 +01:00
Matthias Krüger
3b276cbe04
Rollup merge of #93603 - connorff:compute-polonius-liveness-facts-flag, r=ecstatic-morse
Populate liveness facts when calling `get_body_with_borrowck_facts` without `-Z polonius`

For a new feature of [Flowistry](https://github.com/willcrichton/flowistry), a static-analysis tool, we need to obtain a `mir::Body`'s liveness facts using `get_body_with_borrowck_facts` (added in #86977). We'd like to do this without passing `-Z polonius` as a compiler arg to avoid borrow checking the entire crate.

Support for doing this was added in #88983, but the Polonius input facts used for liveness analysis are empty. This happens because the liveness input facts are populated in `liveness::generate` depending only on the value of `AllFacts::enabled` (which is toggled via compiler args).

This PR propagates the [`use_polonius`](8b09ba6a5d/compiler/rustc_borrowck/src/nll.rs (L168)) flag to `liveness::generate` to support populating liveness facts without requiring the `-Z polonius` flag.

This fix is somewhat patchy - if it'd be better to add more widely-accessible state (like `AllFacts::enabled`) I'd be open to ideas!
2022-02-26 00:49:20 +01:00
bors
d973b358c6 Auto merge of #94342 - ibraheemdev:swap-regression, r=Dylan-DPC
Revert implementation of `slice::swap`

Due to the perf regressions noticed here, possible due to inlining? https://github.com/rust-lang/rust/pull/88540#issuecomment-944344343

r? `@kennytm`
2022-02-25 23:47:00 +00:00
ouz-a
8c96487052 Add one more case to avoid ICE 2022-02-25 18:16:13 -05:00
cynecx
45a441b61c check_used should only look at actual used attributes 2022-02-25 22:53:34 +01:00
bors
8bba6b7af0 Auto merge of #8253 - Alexendoo:print-in-fmt, r=camsteffen
Add `print_in_format_impl` lint

changelog: new lint: [`print_in_format_impl`]

Lints the use of `print`-like macros in manual `Display`/`Debug` impls. I feel like I make this mistake every time I write one 😄

r? `@camsteffen`
2022-02-25 21:12:14 +00:00
Alex Macleod
52f3d61a2a Add print_in_format_impl lint 2022-02-25 21:10:06 +00:00
Caio
f2e5e45499 Initiate the inner usage of let_chains 2022-02-25 18:03:27 -03:00
bors
d3ad51b48f Auto merge of #94369 - matthiaskrgr:rollup-qtripm2, r=matthiaskrgr
Rollup of 4 pull requests

Successful merges:

 - #93850 (Don't ICE when an extern static is too big for the current architecture)
 - #94154 (Wire up unstable rustc --check-cfg to rustdoc)
 - #94353 (Fix debug_assert in unused lint pass)
 - #94366 (Add missing item to release notes)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-02-25 20:53:48 +00:00
Erik Desjardins
2d6d30f4a8 Make TLS __getit #[inline(always)] on non-Windows
This may improve perf.
2022-02-25 15:21:27 -05:00
Erik Desjardins
b0921f8a0d make tests work on noopt builder 2022-02-25 14:17:45 -05:00