Commit Graph

164000 Commits

Author SHA1 Message Date
Caio
ca2ad69143 Make more use of let_chains 2022-02-26 07:43:47 -03:00
xFrednet
2bf56b9aa7
Document that pre-expansion lint passes are deprecated 2022-02-26 11:36:31 +01: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
Josh Stone
d3d2a279fe Add Atomic*::from_mut_slice 2022-02-25 15:30:29 -08: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
Matthias Krüger
152af5a422
Rollup merge of #94366 - jhpratt:release-notes, r=Mark-Simulacrum
Add missing item to release notes

Looks like `NonZeroUsize::is_power_of_two` was stabilized as well, but this didn't make the release notes.
2022-02-25 20:12:49 +01:00
Matthias Krüger
070d7c2a42
Rollup merge of #94353 - flip1995:fix_debug_assert_unused, r=Dylan-DPC
Fix debug_assert in unused lint pass

This fixes a debug assertion in the unused lint pass. As a side effect, this also improves the span generated for tuples in the `unused_must_use` lint.

found in #94329

A reproducer for this would be

```rust
fn main() { (1, (3,)); }
```

Not sure, if I should add a regression test for a `debug_assert`.
2022-02-25 20:12:48 +01:00
Matthias Krüger
ed202b8208
Rollup merge of #94154 - Urgau:rustdoc-check-cfg, r=GuillaumeGomez
Wire up unstable rustc --check-cfg to rustdoc

This pull-request wire up the new unstable `--check-cfg` option from `rustc` to `rustdoc` as [requested](https://github.com/rust-lang/rust/pull/93915#discussion_r807560445) in the [pull-request](https://github.com/rust-lang/rust/pull/93915) that introduce `--check-cfg`.

The motivation was describe in the original PR by ``@jyn514`` who wrote https://github.com/rust-lang/rust/pull/89346#issuecomment-930129761:
> > add plumbing to pass --check-cfg from rustdoc (do we want this one?)
>
> It would be useful, I think, it catches issues like cfg(doctst) or something (and in general I would like expansion to match rustc as closely as possible).
2022-02-25 20:12:47 +01:00
Matthias Krüger
54fa9cab7c
Rollup merge of #93850 - asquared31415:extern-static-size-ice, r=jackh726
Don't ICE when an extern static is too big for the current architecture

Fixes #93760

Emit an error instead of ICEing when an `extern` static's size overflows the allowed maximum for the target.

Changes the error message in the existing `delay_span_bug` call to the true layout error, first for debugging purposes, but opted to leave in to potentially assist future developers as it was being reached in unexpected ways already.
2022-02-25 20:12:46 +01:00
bors
d981633ed6 Auto merge of #94290 - Mark-Simulacrum:bump-bootstrap, r=pietroalbini
Bump bootstrap to 1.60

This bumps the bootstrap compiler to 1.60 and cleans up cfgs and Span's rustc_pass_by_value (enabled by the bootstrap bump).
2022-02-25 18:34:02 +00:00
Jacob Pratt
eb104bb877
Add missing item to release notes 2022-02-25 13:32:21 -05:00
Alex Macleod
bcbb07f4dc Rename RecursiveFormatImpl to FormatImpl 2022-02-25 18:22:55 +00:00
Oli Scherer
5875d7b03c "Reset" the hashing context before stable hashing the types 2022-02-25 17:51:28 +00:00
Tomasz Miąsko
f6634cc3c2 Test legacy type mangling 2022-02-25 17:48:03 +01:00
Mateusz Mikuła
c35a1d4028 Fix MinGW target detection in raw-dylib
LLVM target doesn't have to be the same as Rust target so relying on it is wrong.
2022-02-25 17:46:23 +01:00
Tomasz Miąsko
5ca93742fe Test legacy mangling of bool, char and integer constants
The existing v0 tests have been slightly adjusted for compatibility with
legacy mangler, which requires an item to have an ancestor in a value
namespace or a type namespace to produce a symbol for it. In v0 mangling
this results in an extra `Nv` component.
2022-02-25 17:38:21 +01:00
bors
6cbc6c35e4 Auto merge of #94279 - tmiasko:write-print, r=Mark-Simulacrum
Print `ParamTy` and `ParamConst` instead of displaying them

Display for `ParamTy` and `ParamConst` is implemented in terms of print.
Using print avoids creating a new `FmtPrinter` just to display the
parameter name.

r? `@Mark-Simulacrum`
2022-02-25 16:09:56 +00:00
bors
4417f78e91 Auto merge of #8474 - Alexendoo:paths, r=Manishearth
Replace some more paths with diagnostic items

cc #5393

Replaces the macro & mem paths, and catches a couple others that were unused

changelog: none
2022-02-25 16:07:59 +00:00
Nixon Enraght-Moony
6b68882e45 Remove needless borrows from core::fmt 2022-02-25 16:06:23 +00:00
bors
95897bfcf2 Auto merge of #8472 - Mastermindaxe:#8152_new-without-default_should_not_trigger_on_doc_hidden_items, r=flip1995
Disable ``[`new-without-default`]`` for new() methods that are marked…

… with '#[doc(hidden)]'

Fixes #8152

changelog: Disable ``[`new-without-default`]`` for new() methods that are marked with `#[doc(hidden)]`
2022-02-25 15:51:37 +00:00
Alex Macleod
2955db493e Replace some more paths with diagnostic items 2022-02-25 15:38:06 +00:00
Florian Nagel
862211d540 Disable `[new-without-default]` for new() methods that are marked with '#[doc(hidden)]'
Fixes issue #8152
2022-02-25 16:34:37 +01:00
bors
9f8f0a6e94 Auto merge of #94357 - matthiaskrgr:rollup-xrjaof3, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #93845 (Remove in band lifetimes)
 - #94155 (Extend toggle GUI test a bit)
 - #94252 (don't special case `DefKind::Ctor` in encoding)
 - #94305 (Remove an unnecessary restriction in `dest_prop`)
 - #94343 (Miri fn ptr check: don't use conservative null check)
 - #94344 (diagnostic: suggest parens when users want logical ops, but get closures)
 - #94352 (Fix SGX docs build)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-02-25 13:28:49 +00:00