Commit Graph

163807 Commits

Author SHA1 Message Date
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
Matthias Krüger
60606456d3
Rollup merge of #94352 - jethrogb:fix-sgx-docs-build, r=Mark-Simulacrum
Fix SGX docs build

Without this, I get
```
error[E0432]: unresolved import `crate::sys::cvt`
  --> library/std/src/os/fd/owned.rs:12:5
   |
12 | use crate::sys::cvt;
   |     ^^^^^^^^^^^^^^^ no `cvt` in `sys`
```
when running rustdoc on `std` for the x86_64-fortanix-unknown-sgx target.
2022-02-25 14:14:41 +01:00
Matthias Krüger
731cd3fbeb
Rollup merge of #94344 - notriddle:notriddle/suggest-parens-more, r=oli-obk
diagnostic: suggest parens when users want logical ops, but get closures

Fixes #93536
2022-02-25 14:14:40 +01:00
Matthias Krüger
cf3bb09888
Rollup merge of #94343 - RalfJung:fn-ptr, r=oli-obk
Miri fn ptr check: don't use conservative null check

In https://github.com/rust-lang/rust/pull/94270 I used the wrong NULL check for function pointers: `memory.ptr_may_be_null` is conservative even on machines that support ptr-to-int casts, leading to false errors in Miri.

This fixes that problem, and also replaces that foot-fun of a method with `scalar_may_be_null` which is never unnecessarily conservative.

r? `@oli-obk`
2022-02-25 14:14:39 +01:00
Matthias Krüger
f9f97b661a
Rollup merge of #94305 - JakobDegen:dp-1, r=oli-obk
Remove an unnecessary restriction in `dest_prop`

I had asked about this [on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Do.20unions.20have.20active.20fields.3F) but didn't receive a response, so putting up this PR that makes the change I think we can. If it turns out that this is wrong, hopefully I'll find out here. Reposting my Zulip comment:
> Not sure what channel to put this into, so using this as a fallback. The dest prop MIR opt has this comment:
>
> ```rust
> //!   Subtle case: If `dest` is a, or projects through a union, then we have to make sure that there
> //!   remains an assignment to it, since that sets the "active field" of the union. But if `src` is
> //!   a ZST, it might not be initialized, so there might not be any use of it before the assignment,
> //!   and performing the optimization would simply delete the assignment, leaving `dest`
> //!   uninitialized.
> ```
>
> In particular, the claim seems to be that we can't take
> ```
> x = ();
> y.field = x;
> ```
> where `y` is a union having `field: ()` as one of its variants, and optimize the entire thing away (assuming `x` is unused otherwise). As far as I know though, Rust unions don't have active fields. Is this comment correct and am I missing something? Is there a worry about this interacting poorly with FFI code/C unions/LTO or something?

This PR just removes that comment and the associated code. Also it fixes one unrelated comment that did not match the code it was commenting on.

r? rust-lang/mir-opt
2022-02-25 14:14:38 +01:00
Matthias Krüger
133de6e1e1
Rollup merge of #94252 - lcnr:def_kind-encoding, r=cjgillot
don't special case `DefKind::Ctor` in encoding

considering that we still use `DefKind::Ctor` for these in `Res`, this seems weird and definitely felt like a bug when encountering it while working on #89862.

r? `@cjgillot`
2022-02-25 14:14:37 +01:00
Matthias Krüger
7dcbe6924e
Rollup merge of #94155 - GuillaumeGomez:extend-toggle-gui-test, r=jsha
Extend toggle GUI test a bit

Fixes #84422.

r? `@jsha`
2022-02-25 14:14:36 +01:00
Matthias Krüger
ec4fc726b0
Rollup merge of #93845 - compiler-errors:in-band-lifetimes, r=cjgillot
Remove in band lifetimes

As discussed in t-lang backlog bonanza, the `in_band_lifetimes` FCP closed in favor for the feature not being stabilized. This PR removes `#![feature(in_band_lifetimes)]` in its entirety.

Let me know if this PR is too hasty, and if we should instead do something intermediate for deprecate the feature first.

r? `@scottmcm` (or feel free to reassign, just saw your last comment on #44524)
Closes #44524
2022-02-25 14:14:35 +01:00
Mark Rousskov
3c62f2f635 Re-add track_caller to panic_no_unwind in bootstrap
This function was updated in a recent PR (92911) to be called without the caller
information passed in, but the function signature itself was not altered with
cfg_attr at the time.
2022-02-25 08:00:53 -05:00
Mark Rousskov
76b13c9eea Enable rustc_pass_by_value for Span 2022-02-25 08:00:53 -05:00
Mark Rousskov
22c3a71de1 Switch bootstrap cfgs 2022-02-25 08:00:52 -05:00
Mark Rousskov
ea65f50c52 Bump bootstrap to 1.60 2022-02-25 08:00:24 -05:00
flip1995
bbe3447313
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.
2022-02-25 11:30:16 +00:00
Jethro Beekman
355d503ace Fix SGX docs build 2022-02-25 12:12:37 +01:00
bors
9b2a46591a Auto merge of #93644 - michaelwoerister:simpler-debuginfo-typemap, r=wesleywiser
debuginfo: Simplify TypeMap used during LLVM debuginfo generation.

This PR simplifies the TypeMap that is used in `rustc_codegen_llvm::debuginfo::metadata`. It was unnecessarily complicated because it was originally implemented when types were not yet normalized before codegen. So it did it's own normalization and kept track of multiple unnormalized types being mapped to a single unique id.

This PR is based on https://github.com/rust-lang/rust/pull/93503, which is not merged yet.

The PR also removes the arena used for allocating string ids and instead uses `InlinableString` from the [inlinable_string](https://crates.io/crates/inlinable_string) crate. That might not be the best choice, since that crate does not seem to be very actively maintained. The [flexible-string](https://crates.io/crates/flexible-string) crate would be an alternative.

r? `@ghost`
2022-02-25 11:00:32 +00:00
Guillaume Gomez
ec50cdbe10 Extend toggle GUI test a bit 2022-02-25 11:11:52 +01:00
Michael Woerister
bb2059f959 debuginfo: Simplify TypeMap used during LLVM debuginfo generation -- address review comments. 2022-02-25 10:30:45 +01:00
bors
03c8ffaacb Auto merge of #94350 - matthiaskrgr:rollup-eesfiyr, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #92714 (Provide ignore message in the result of test)
 - #93273 (Always check cg_llvm with ./x.py check)
 - #94068 (Consider mutations as borrows in generator drop tracking)
 - #94184 (BTree: simplify test code)
 - #94297 (update const_generics_defaults release notes)
 - #94341 (Remove a duplicate space)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-02-25 08:40:34 +00:00
Matthias Krüger
cff3472ef1
Rollup merge of #94341 - ChayimFriedman2:patch-1, r=Dylan-DPC
Remove a duplicate space

rustfmt doesn't format `let ... else`.
2022-02-25 07:30:51 +01:00
Matthias Krüger
10a43d2ab1
Rollup merge of #94297 - lcnr:rel-notes, r=Mark-Simulacrum
update const_generics_defaults release notes

supersedes #94294

r? `@Mark-Simulacrum`
2022-02-25 07:30:50 +01:00
Matthias Krüger
e5bd222c6b
Rollup merge of #94184 - ssomers:btree_tests, r=Dylan-DPC
BTree: simplify test code

Mostly, use `from` & `from_iter`.
2022-02-25 07:30:49 +01:00
Matthias Krüger
10070118ad
Rollup merge of #94068 - eholk:drop-track-field-assign, r=tmandry
Consider mutations as borrows in generator drop tracking

This is needed to match MIR more conservative approximation of any borrowed value being live across a suspend point (See #94067). This change considers an expression such as `x.y = z` to be a borrow of `x` and therefore keeps `x` live across suspend points.

r? `@nikomatsakis`
2022-02-25 07:30:49 +01:00
Matthias Krüger
ae6770e4d5
Rollup merge of #93273 - bjorn3:rustbuild_improvements, r=Mark-Simulacrum
Always check cg_llvm with ./x.py check

Previously it would be skipped if codegen-backends doesn't contain llvm.
2022-02-25 07:30:48 +01:00