Commit graph

157690 commits

Author SHA1 Message Date
Scott McMurray
f541dd13f1 Don't run the codegen test when debug_assert is enabled 2021-11-14 16:24:31 -08:00
Scott McMurray
71f5cfb21f MIRI says reverse is UB, so replace it with an implementation that LLVM can vectorize
For small types with padding, the current implementation is UB because it does integer operations on uninit values.  But LLVM has gotten smarter since I wrote the previous implementation in 2017, so remove all the manual magic and just write it in such a way that LLVM will vectorize.  This code is much simpler (albeit nuanced) and has very little `unsafe`, and is actually faster to boot!
2021-11-11 20:32:18 -08:00
bors
14a2fd640e Auto merge of #90489 - jyn514:load-all-extern-crates, r=petrochenkov
rustdoc: Go back to loading all external crates unconditionally

This *continues* to cause regressions. This code will be unnecessary
once access to the resolver happens fully before creating the tyctxt
(#83761), so load all crates unconditionally for now. To minimize churn, this leaves in the code for loading crates selectively.

"Fixes" https://github.com/rust-lang/rust/issues/84738. Previously: https://github.com/rust-lang/rust/pull/83738, https://github.com/rust-lang/rust/pull/85749, https://github.com/rust-lang/rust/pull/88215

r? `@petrochenkov` cc `@camelid` (this should fix the "index out of bounds" error you had while looking up `crate_name`).
2021-11-11 22:00:53 +00:00
bors
936238a92b Auto merge of #90746 - nnethercote:opt-pattern-matching, r=Nadrieril
Optimize pattern matching

These commits speed up the `match-stress-enum` benchmark, which is very artificial, but the changes are simple enough that it's probably worth doing.

r? `@Nadrieril`
2021-11-11 18:26:49 +00:00
bors
3d29b68077 Auto merge of #90648 - matthewjasper:assoc-item-cleanup, r=cjgillot
Assoc item cleanup

This removes some fields from ObligationCauseCode

Split out of #90639
2021-11-11 15:15:15 +00:00
bors
d71ba74f0d Auto merge of #88798 - sunfishcode:sunfishcode/windows-null-handles, r=joshtriplett
Fix assertion failures in `OwnedHandle` with `windows_subsystem`.

As discussed in #88576, raw handle values in Windows can be null, such
as in `windows_subsystem` mode, or when consoles are detached from a
process. So, don't use `NonNull` to hold them, don't assert that they're
not null, and remove `OwnedHandle`'s `repr(transparent)`. Introduce a
new `HandleOrNull` type, similar to `HandleOrInvalid`, to cover the FFI
use case.

r? `@joshtriplett`
2021-11-11 12:07:53 +00:00
bors
62efba8a05 Auto merge of #90755 - scottmcm:spec-array-clone, r=jackh726
Specialize array cloning for Copy types

Because after PR 86041, the optimizer no longer load-merges at the LLVM IR level, which might be part of the perf loss.  (I'll run perf and see if this makes a difference.)

Also I added a codegen test so this hopefully won't regress in future -- it passes on stable and with my change here, but not on the 2021-11-09 nightly.

Example on current nightly: <https://play.rust-lang.org/?version=nightly&mode=release&edition=2021&gist=1f52d46fb8fc3ca3ac9f097390085ffa>
```rust
type T = u8;
const N: usize = 3;

pub fn demo_clone(x: &[T; N]) -> [T; N] {
    x.clone()
}

pub fn demo_copy(x: &[T; N]) -> [T; N] {
    *x
}
```
```llvm-ir
; playground::demo_clone
; Function Attrs: mustprogress nofree nosync nounwind nonlazybind uwtable willreturn
define i24 `@_ZN10playground10demo_clone17h98a4f11453d1a753E([3` x i8]* noalias nocapture readonly align 1 dereferenceable(3) %x) unnamed_addr #0 personality i32 (i32, i32, i64, %"unwind::libunwind::_Unwind_Exception"*, %"unwind::libunwind::_Unwind_Context"*)* `@rust_eh_personality` {
start:
  %0 = getelementptr [3 x i8], [3 x i8]* %x, i64 0, i64 0
  %1 = getelementptr inbounds [3 x i8], [3 x i8]* %x, i64 0, i64 1
  %.val.i.i.i.i.i.i.i.i.i = load i8, i8* %0, align 1, !alias.scope !2, !noalias !9
  %2 = getelementptr inbounds [3 x i8], [3 x i8]* %x, i64 0, i64 2
  %.val.i.i.i.i.i.1.i.i.i.i = load i8, i8* %1, align 1, !alias.scope !2, !noalias !20
  %.val.i.i.i.i.i.2.i.i.i.i = load i8, i8* %2, align 1, !alias.scope !2, !noalias !23
  %array.sroa.6.0.insert.ext.i.i.i.i = zext i8 %.val.i.i.i.i.i.2.i.i.i.i to i32
  %array.sroa.6.0.insert.shift.i.i.i.i = shl nuw nsw i32 %array.sroa.6.0.insert.ext.i.i.i.i, 16
  %array.sroa.5.0.insert.ext.i.i.i.i = zext i8 %.val.i.i.i.i.i.1.i.i.i.i to i32
  %array.sroa.5.0.insert.shift.i.i.i.i = shl nuw nsw i32 %array.sroa.5.0.insert.ext.i.i.i.i, 8
  %array.sroa.0.0.insert.ext.i.i.i.i = zext i8 %.val.i.i.i.i.i.i.i.i.i to i32
  %array.sroa.5.0.insert.insert.i.i.i.i = or i32 %array.sroa.5.0.insert.shift.i.i.i.i, %array.sroa.0.0.insert.ext.i.i.i.i
  %array.sroa.0.0.insert.insert.i.i.i.i = or i32 %array.sroa.5.0.insert.insert.i.i.i.i, %array.sroa.6.0.insert.shift.i.i.i.i
  %.sroa.4.0.extract.trunc.i.i.i.i = trunc i32 %array.sroa.0.0.insert.insert.i.i.i.i to i24
  ret i24 %.sroa.4.0.extract.trunc.i.i.i.i
}

; playground::demo_copy
; Function Attrs: mustprogress nofree norecurse nosync nounwind nonlazybind readonly uwtable willreturn
define i24 `@_ZN10playground9demo_copy17h7817453f9291d746E([3` x i8]* noalias nocapture readonly align 1 dereferenceable(3) %x) unnamed_addr #1 {
start:
  %.sroa.0.0..sroa_cast = bitcast [3 x i8]* %x to i24*
  %.sroa.0.0.copyload = load i24, i24* %.sroa.0.0..sroa_cast, align 1
  ret i24 %.sroa.0.0.copyload
}
```
2021-11-11 09:13:22 +00:00
bors
1d34cb4efc Auto merge of #89550 - lcnr:coherence-specialization, r=nikomatsakis
do not emit overlap errors for impls failing the orphan check

this should finally allow us to merge #86986, see https://github.com/rust-lang/rust/pull/86986#discussion_r716059345 for more details.

r? `@nikomatsakis` cc `@eddyb`
2021-11-11 05:47:37 +00:00
bors
9dbbbb12c0 Auto merge of #83846 - torhovland:issue-10971, r=davidtwco
Added the --temps-dir option

Fixes #10971.

The new `--temps-dir` option puts intermediate files in a user-specified directory. This provides a fix for the issue where parallel invocations of rustc would overwrite each other's intermediate files.

No files are kept in the intermediate directory unless `-C save-temps=yes`.

If additional files are specifically requested using `--emit asm,llvm-bc,llvm-ir,obj,metadata,link,dep-info,mir`, these will be put in the output directory rather than the intermediate directory.

This is a backward-compatible change, i.e. if `--temps-dir` is not specified, the behavior is the same as before.
2021-11-11 02:52:32 +00:00
bors
8e0293137f Auto merge of #90784 - matthiaskrgr:rollup-car8g12, r=matthiaskrgr
Rollup of 3 pull requests

Successful merges:

 - #89930 (Only use `clone3` when needed for pidfd)
 - #90736 (adjust documented inline-asm register constraints)
 - #90783 (Update Miri)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-11-10 23:13:06 +00:00
Matthias Krüger
17cb2b6f43
Rollup merge of #90783 - camelid:update-miri, r=RalfJung
Update Miri

Fixes #90763.

This is the last step in landing rust-lang/miri#1340!

r? `@RalfJung`
2021-11-10 23:04:27 +01:00
Matthias Krüger
90bb5fc08e
Rollup merge of #90736 - Lokathor:inline-asm-docs-updates, r=Amanieu
adjust documented inline-asm register constraints

This change more clearly specifies how `reg` and `reg_thumb` work with ARM, Thumb2, and Thumb1 code.

Based upon the [llvm documentation](https://llvm.org/docs/LangRef.html#supported-constraint-code-list) for register constraint codes.
To be clear, this just updates the docs to match what already happens with rustc/llvm.
No change in the compiler is required to make it match this new documentation.
2021-11-10 23:04:26 +01:00
Matthias Krüger
a09115f3b4
Rollup merge of #89930 - cuviper:avoid-clone3, r=joshtriplett
Only use `clone3` when needed for pidfd

In #89522 we learned that `clone3` is interacting poorly with Gentoo's
`sandbox` tool. We only need that for the unstable pidfd extensions, so
otherwise avoid that and use a normal `fork`.

This is a re-application of beta #89924, now that we're aware that we need
more than just a temporary release fix. I also reverted 12fbabd27f, as
that was just fallout from using `clone3` instead of `fork`.

r? `@Mark-Simulacrum`
cc `@joshtriplett`
2021-11-10 23:04:25 +01:00
Noah Lev
5443854ad0 Update Miri
This is the last step in landing rust-lang/miri#1340!
2021-11-10 12:42:51 -08:00
bors
82af160c2c Auto merge of #90769 - matthiaskrgr:rollup-266apqm, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #88447 (Use computed visibility in rustdoc)
 - #88868 (Allow simd_bitmask to return byte arrays)
 - #90727 (Remove potential useless data for search index)
 - #90742 (Use AddAssign impl)
 - #90758 (Fix collections entry API documentation.)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-11-10 20:12:14 +00:00
Scott McMurray
5b115fcb68 Moar #[inline] 2021-11-10 11:57:14 -08:00
Matthias Krüger
5f2497541f
Rollup merge of #90758 - joseph-roitman:fix-entry-doc-key-ref, r=dtolnay
Fix collections entry API documentation.

I found some documentation that seems out of date.
2021-11-10 18:52:30 +01:00
Matthias Krüger
0a9c1be100
Rollup merge of #90742 - est31:add_assign, r=davidtwco
Use AddAssign impl
2021-11-10 18:52:29 +01:00
Matthias Krüger
b31f0198b1
Rollup merge of #90727 - GuillaumeGomez:remove-potential-useless-search-index-data, r=notriddle,camelid
Remove potential useless data for search index

I uncovered this case when working on https://github.com/rust-lang/rust/pull/90726 to debug https://github.com/rust-lang/rust/pull/90385.

Explanations: if we have a full generic, we check if it has generics then we do the following:
 * If it has only one generic, we remove one nested level in order to not keep the "parent" generic (since it has empty name, it's useless after all).
 * Otherwise we add it alongside its generics.

However, I didn't handle the case where a generic had no generics. Meaning that we were adding items with empty names in the search index. So basically useless data in the search index.

r? `@camelid`
2021-11-10 18:52:28 +01:00
Matthias Krüger
858fea410d
Rollup merge of #88868 - calebzulawski:feature/simd_bitmask, r=workingjubilee
Allow simd_bitmask to return byte arrays

cc `@rust-lang/project-portable-simd` `@workingjubilee`
2021-11-10 18:52:27 +01:00
Matthias Krüger
a8dff349ca
Rollup merge of #88447 - inquisitivecrystal:rustdoc-vis, r=jyn514
Use computed visibility in rustdoc

This PR changes `librustdoc` to use computed visibility instead of syntactic visibility. It was initially part of #88019, but was separated due to concerns that it might cause a regression somewhere we couldn't predict.

r? `@jyn514`
cc `@cjgillot` `@petrochenkov`
2021-11-10 18:52:26 +01:00
lcnr
f55ff4103f don't inline report_overlap_conflict 2021-11-10 15:10:19 +01:00
lcnr
1296719c06 no overlap errors after failing the orphan check 2021-11-10 15:10:19 +01:00
bors
68ca579406 Auto merge of #90759 - yanok:llvm-dbginfo-fix, r=nikic
Update llvm submodule

This includes debug info generation fix, that fixes #90301.

Also includes WASM backend related fix for https://bugs.llvm.org/show_bug.cgi?id=52352
(I haven't found a corresponding Rust bug).
2021-11-10 12:56:29 +00:00
Ilya Yanok
8128916cad Update llvm submodule
This includes debug info generation fix, that fixes #90301.

Also includes WASM backend related fix for https://bugs.llvm.org/show_bug.cgi?id=52352
(I haven't found a corresponding Rust bug).
2021-11-10 10:58:59 +00:00
Joseph Roitman
7b40448a6f Fix collection entry API documentation. 2021-11-10 12:37:18 +02:00
Guillaume Gomez
8d5ef320fc Remove potential useless data for search index 2021-11-10 11:13:52 +01:00
bors
800a156c1e Auto merge of #88670 - camelid:miri-uninit-num, r=RalfJung
miri: Detect uninitialized integers and floats

Part of rust-lang/miri#1340.

Companion Miri PR: rust-lang/miri#1904

r? `@RalfJung`
2021-11-10 09:36:03 +00:00
Tor Hovland
1793a7acc7 Changing cdylib to staticlib, as the former doesn't work with arm-none-eabi-gcc. 2021-11-10 08:25:35 +01:00
bors
493ea776eb Auto merge of #90754 - matthiaskrgr:rollup-v0483m5, r=matthiaskrgr
Rollup of 3 pull requests

Successful merges:

 - #90690 (kmc-solid: Avoid the use of `asm_const`)
 - #90748 (Add a real tracking issue for `CommandExt::groups`)
 - #90751 (Update books)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-11-10 06:15:50 +00:00
Scott McMurray
cc7d8014d7 Specialize array cloning for Copy types
Because after PR 86041, the optimizer no longer load-merges at the LLVM IR level, which might be part of the perf loss.  (I'll run perf and see if this makes a difference.)

Also I added a codegen test so this hopefully won't regress in future -- it passes on stable and with my change here, but not on the 2021-11-09 nightly.
2021-11-09 21:43:20 -08:00
Matthias Krüger
e7375016eb
Rollup merge of #90751 - ehuss:update-books, r=ehuss
Update books

## nomicon

1 commits in 358e6a61d5f4f0496d0a81e70cdcd25d05307342..c6b4bf831e9a40aec34f53067d20634839a6778b
2021-10-20 11:23:12 -0700 to 2021-11-09 02:30:56 +0900
- Replace some use of variant with covariant (rust-lang/nomicon#322)

## book

11 commits in fd9299792852c9a368cb236748781852f75cdac6..5c5dbc5b196c9564422b3193264f3288d2a051ce
2021-10-22 21:59:46 -0400 to 2021-11-09 19:30:43 -0500
- Fix constants link.
- Fix updated anchor
- Propagate edits to chapter 2 back
- Edits to nostarch's chapter 3 edits
- ch 3 from nostarch
- Fix Cargo.toml snippet about custom derive macros
- Snapshot of chapter 9 for nostarch
- Create tmp/src for converting quotes, not sure why this broke but ok
- Update question mark to better explain where it can be used
- Clarify sentence about Results in functions that don't return Result. Fixes rust-lang/book#2912.
- Merge pull request rust-lang/book#2913 from covariant/patch-1

## rust-by-example

2 commits in 27f1ff5e440ef78828b68ab882b98e1b10d9af32..e9d45342d7a6c1def4731f1782d87ea317ba30c3
2021-10-13 08:04:40 -0300 to 2021-11-02 13:33:03 -0500
- Enums: Linked-List Needs Re-Wording (rust-lang/rust-by-example#1469)
- fix: Use the point as top left corner for `square` (rust-lang/rust-by-example#1471)

## rustc-dev-guide

13 commits in b06008731af0f7d07cd0614e820c8276dfed1c18..196ef69aa68f2cef44f37566ee7db37daf00301b
2021-10-21 15:13:09 -0500 to 2021-11-07 07:48:47 -0600
- Fix typo: [upv.rs_mentioned] -&gt; [upvars_mentioned]
- Add note to emphasize replacing TARGET_TRIPLE (rust-lang/rustc-dev-guide#1250)
- Remove some legacy test suites.
- tiny capitalization fix
- Fix date
- Update some date-check comments
- Ensure date-check cron job is using latest stable Rust
- enhance subtree docs, link to clippy docs
- Edit introduction to bootstrapping
- Some minor adjustments to the diagnostic documentation
- Edit "About this guide" for semantic line feeds
- Fix `rustc_mir` related links (rust-lang/rustc-dev-guide#1228)
- Add documentation for LLVM CFI support

## edition-guide

3 commits in 7c0088ca744d293a5f4b1e2ac378e7c23d30fe55..27f4a84d3852e9416cae5861254fa53a825c56bd
2021-10-05 13:28:05 +0200 to 2021-11-08 10:13:20 -0500
- Add a missing period (rust-lang/edition-guide#271)
- Fix syntax error in code example (rust-lang/edition-guide#270)
- Fixed an example error of prelude.md (rust-lang/edition-guide#269)
2021-11-10 06:02:56 +01:00
Matthias Krüger
ebd15290a2
Rollup merge of #90748 - cuviper:track-setgroups, r=dtolnay
Add a real tracking issue for `CommandExt::groups`

The `unstable` attribute referenced the closed RFE #38527, so I filed tracking issue #90747.
2021-11-10 06:02:55 +01:00
Matthias Krüger
5bc09362dc
Rollup merge of #90690 - solid-rs:fix-kmc-solid-asm-const, r=Mark-Simulacrum
kmc-solid: Avoid the use of `asm_const`

This PR removes the use of [the now-separated-out `asm_const` compiler feature][1] in `std::sys::solid` to fix the [`*-kmc-solid_*`](https://doc.rust-lang.org/nightly/rustc/platform-support/kmc-solid.html) Tier 3 targets.

[1]: https://github.com/rust-lang/rust/pull/90348
2021-11-10 06:02:54 +01:00
bors
f2f55e8da9 Auto merge of #90663 - ken-matsui:support-early-stopping-too-old-tidy-for-macos, r=Mark-Simulacrum
Support early stopping too old pre-installed `tidy` command for macOS in the HTML checker

This PR brings early stopping the HTML checker before errors, which leave some macOS users confused, and suggesting installing a newer `tidy` command.

The pre-installed `tidy` command on macOS is too old, released on 31 October 2006. Additionally, I can see the same date at [StackOverflow](https://stackoverflow.com/questions/22283382/overwrite-osx-tidy
) seven years ago. The `tidy` does not support two indispensable options: `--mute-id` and `--mute`. So, the `./x.py test` command fails with a bunch of errors due not to muting them.

I could confirm the `./x.py test` command before installing a newer `tidy` failed and its command after the installation succeeded.
2021-11-10 03:11:44 +00:00
Eric Huss
9be22db5e1 Update books 2021-11-09 19:11:01 -08:00
inquisitivecrystal
6622376ff6 Use computed visibility in rustdoc 2021-11-09 19:10:34 -08:00
inquisitivecrystal
9a987b0466 Add ty::Visibility::is_public() 2021-11-09 18:35:00 -08:00
Caleb Zulawski
fe8ae57645 Add comment regarding bit order 2021-11-10 01:54:28 +00:00
Josh Stone
c0fbadaba3 Add a real tracking issue for CommandExt::groups 2021-11-09 17:28:56 -08:00
Noah Lev
d8a1454dd8 miri: Detect uninitialized integers and floats
Change the Miri engine to allow configuring whether to check
initialization of integers and floats. This allows the Miri tool to
optionally check for initialization if requested by the user.
2021-11-09 16:21:36 -08:00
Lokathor
a306d35570
Update src/doc/unstable-book/src/library-features/asm.md
Co-authored-by: Josh Triplett <josh@joshtriplett.org>
2021-11-09 15:52:55 -07:00
Lokathor
9c85ea8ff7
Update src/doc/unstable-book/src/library-features/asm.md
Co-authored-by: Josh Triplett <josh@joshtriplett.org>
2021-11-09 15:52:46 -07:00
est31
9afb241af5 Use AddAssign impl 2021-11-09 23:47:36 +01:00
Lokathor
5c396e4b99 adjust documented register constraints to match https://llvm.org/docs/LangRef.html#supported-constraint-code-list 2021-11-09 13:30:30 -07:00
bors
8b09ba6a5d Auto merge of #90734 - matthiaskrgr:rollup-e1euotp, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #89561 (Type inference for inline consts)
 - #90035 (implement rfc-2528 type_changing-struct-update)
 - #90613 (Allow to run a specific rustdoc-js* test)
 - #90683 (Make `compiler-docs` only control the default instead of being a hard off-switch)
 - #90685 (x.py: remove fixme by deleting code)
 - #90701 (Record more artifact sizes during self-profiling.)
 - #90723 (Better document `Box` and `alloc::alloc::box_free` connection)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-11-09 20:09:53 +00:00
Matthias Krüger
9c1aa12ff1
Rollup merge of #90723 - asquared31415:box_docs, r=jyn514
Better document `Box` and `alloc::alloc::box_free` connection

The internal `alloc::alloc::box_free` function requires that its signature matches the `owned_box` struct's declaration, but previously that connection was only documented on the `box_free` function.

This PR makes the documentation two-way to help anyone making theoretical changes to `Box` to see the connection, since changes are more likely to originate from `Box`.
2021-11-09 19:00:46 +01:00
Matthias Krüger
fd5a4f42ad
Rollup merge of #90701 - michaelwoerister:more-artifact-sizes, r=davidtwco
Record more artifact sizes during self-profiling.

This PR adds artifact size recording for

- "linked artifacts" (executables, RLIBs, dylibs, static libs)
- object files
- dwo files
- assembly files
- crate metadata
- LLVM bitcode files
- LLVM IR files
- codegen unit size estimates

Currently the identifiers emitted for these are hard-coded as string literals. Is it worth adding constants to https://github.com/rust-lang/measureme/blob/master/measureme/src/rustc.rs instead? We don't do that for query names and the like -- but artifact kinds might be more stable than query names.
2021-11-09 19:00:45 +01:00
Matthias Krüger
21b0ce1b95
Rollup merge of #90685 - jyn514:remove-dead-code, r=Mark-Simulacrum
x.py: remove fixme by deleting code

As far as I can tell, this parameter was never used, so just delete it
as unnecessary.
2021-11-09 19:00:44 +01:00
Matthias Krüger
2fff2606d5
Rollup merge of #90683 - jyn514:compiler-docs, r=Mark-Simulacrum
Make `compiler-docs` only control the default instead of being a hard off-switch

This also fixes `x doc src/tools/clippy` when compiler-docs is disabled.

See https://github.com/rust-lang/rust/pull/90354#issuecomment-955854508.

r? ``@Mark-Simulacrum``
2021-11-09 19:00:43 +01:00