Commit graph

158144 commits

Author SHA1 Message Date
Matthias Krüger
5e7c031397
Rollup merge of #90826 - petrochenkov:binattr, r=cjgillot
rustc_feature: Convert `BuiltinAttribute` from tuple to a struct

The tuple starts having too many fields.
Noticed while reviewing https://github.com/rust-lang/rust/pull/88681.
2021-11-12 19:17:34 +01:00
Matthias Krüger
5b3cb68d97
Rollup merge of #90798 - edmorley:doc-unreachable-custom-message, r=dtolnay
Document `unreachable!` custom panic message

The `unreachable!` docs previously did not mention that there was a second form, `unreachable!("message")` that could be used to specify a custom panic message,

The docs now mention this feature in the same wording as currently used for `unimplemented!`:
https://doc.rust-lang.org/core/macro.unimplemented.html#panics
2021-11-12 19:17:33 +01:00
Matthias Krüger
f522f26867
Rollup merge of #90795 - GuillaumeGomez:more-search-index-comments, r=notriddle
Add more comments to explain the code to generate the search index

Fixes #90766.

I tried to put comments when the code wasn't easy to understand at first sight and added more documentation on the recursive function. Please tell me if I misused the terminology or if comments can be improved or added into other places.

r? `@notriddle`
2021-11-12 19:17:32 +01:00
Matthias Krüger
640f365bff
Rollup merge of #90761 - hellow554:macro_span, r=estebank
Shorten Span of unused macro lints

The span has been reduced to the actual ident of the macro, instead of linting the
*whole* macro.

Closes #90745

r? ``@estebank``
2021-11-12 19:17:31 +01:00
Matthias Krüger
160602b485
Rollup merge of #90704 - ijackson:exitstatus-comments, r=joshtriplett
Unix ExitStatus comments and a tiny docs fix

Some nits left over from #88300
2021-11-12 19:17:31 +01:00
Matthias Krüger
70532c4503
Rollup merge of #90644 - est31:const_swap, r=Mark-Simulacrum
Extend the const swap feature

Adds the `const_swap` feature gate to three more swap functions. cc tracking issue #83163

```Rust
impl<T> [T] {
    pub const fn swap(&mut self, a: usize, b: usize);
    pub const unsafe fn swap_unchecked(&mut self, a: usize, b: usize);
}
impl<T: ?Sized> *mut T {
    pub const unsafe fn swap(self, with: *mut T);
}
2021-11-12 19:17:30 +01:00
Matthias Krüger
1fe15be34c
Rollup merge of #90589 - durin42:llvm-14-ASO-now-struct, r=nikic
rustc_llvm: update PassWrapper for recent LLVM

Now AddressSanitizerOptions is a struct, but at least the change was
tiny.

r? `@nikic`
2021-11-12 19:17:28 +01:00
Dan Gohman
2d46d1bec9 Rename WASI's is_character_device to is_char_device.
Rename WASI's `FileTypeExt::is_character_device` to
`FileTypeExt::is_char_device`, for consistency with the Unix
`FileTypeExt::is_char_device`.

Also, add a `FileTypeExt::is_socket` function, for consistency with the
Unix `FileTypeExt::is_socket` function.
2021-11-12 09:25:32 -08:00
Josh Stone
a24e2eddb1 Android is not GNU 2021-11-12 09:09:08 -08:00
bors
220ed09b26 Auto merge of #89316 - asquared31415:multiple-clobber-abi, r=Amanieu
Add support for specifying multiple clobber_abi in `asm!`

r? `@Amanieu`
cc #72016
`@rustbot` label: +A-inline-assembly +F-asm
2021-11-12 16:29:25 +00:00
asquared31415
e80f3008e0 fix aarch test error annotations 2021-11-12 10:30:20 -05:00
Guillaume Gomez
9c05335a0f Add more comments to explain the code to generate the search index 2021-11-12 15:33:10 +01:00
Guillaume Gomez
6b3695d480 Remove unneeded FIXME: after testing the suggested changes, we reached the conclusion that the code readibility wasn't worth the almost unnoticeable perf improvement 2021-11-12 15:25:13 +01:00
Vadim Petrochenkov
6655727041 rustc_feature: Convert BuiltinAttribute from tuple to a struct 2021-11-12 20:15:14 +08:00
bors
f31622a50b Auto merge of #90813 - notriddle:notriddle/vec-extend, r=GuillaumeGomez
Use Vec extend and collect instead of repeatedly calling push
2021-11-12 12:13:32 +00:00
Neutron3529
2feee3659e provide a SpecExtend trait for Vec<T>
The discussion is [here](https://internals.rust-lang.org/t/append-vec-to-binaryheap/15209/3)
2021-11-12 15:45:25 +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
e4c23daeb4 Auto merge of #90731 - pierwill:fix-90658, r=michaelwoerister
Remove `rustc_incremental::persist::fs::dep_graph_path_from`

Closes https://github.com/rust-lang/rust/issues/90658.

r? `@michaelwoerister`
2021-11-12 04:26:28 +00:00
Matthew Jasper
ba518ffdd3 Use associated_item_def_ids more 2021-11-11 23:15:57 +00:00
Matthew Jasper
3ea84e879a Remove unused field of RegionVariableOrigin 2021-11-11 23:15:47 +00:00
Michael Howell
a82692d613 Use Iterator::collect instead of calling Vec::push in a loop 2021-11-11 16:11:38 -07:00
b-naber
26ca71fdb2 normalize argument b in equate_normalized_inputs_output 2021-11-11 23:54:15 +01: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
Michael Howell
b0fd642de6 Use Vec::extend, instead of calling Vec::push in a loop 2021-11-11 13:56:32 -07:00
The8472
c1ea7bdc87 Prefix can be case-insensitive, delegate to its Hash impl instead of trying to hash the raw bytes
This should have 0 performance overhead on unix since Prefix is always None.
2021-11-11 21:44:12 +01:00
Jubilee Young
6ddf7ad8e1 Restrict Arm types to Arm v7+
This mostly mirrors the restrictions in std::arch.
It can be loosened slightly with later refactoring.
2021-11-11 11:40:18 -08: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
Ian Jackson
fe39fb3149 process::ExitStatus: Discuss exit vs _exit in a comment.
As discussed here
 https://github.com/rust-lang/rust/pull/88300#issuecomment-936097710

I felt this was the best place to put this (rather than next to
ExitStatusExt).  After all, it's a property of the ExitStatus type on
Unix.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
2021-11-11 17:48:51 +00:00
Ian Jackson
d1df4715ec unix::ExitStatus: Add comment saying that it's a wait status
With cross-reference.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
2021-11-11 17:48:51 +00:00
Ian Jackson
79e52b3f1e unix::ExitStatusExt: Correct reference to _exit system call
As discussed here
 https://github.com/rust-lang/rust/pull/88300#issuecomment-936085371

exit is (conventionally) a library function, with _exit being the
actual system call.

I have checked the other references and they say "if the process
terminated by calling `exti`".  I think despite the slight
imprecision (strictly, it should read iff ... `_exit`), this is
clearer.  Anyone who knows about the distinction between `exit` and
`_exit` will not be confused.

`_exit` is the correct traditional name for the system call, despite
Linux calling it `exit_group` or `exit`:
  https://www.freebsd.org/cgi/man.cgi?query=_exit&sektion=2&n=1

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
2021-11-11 17:48:03 +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
Krasimir Georgiev
d9f2d5f0e9 PassWrapper: additional sanitizer update to match clang
This happened later in the stream than the other changes, but the fix is
overlapping. Fix taken from a55c4ec1cee7683d9095327d9d33e7137ec25292 in
LLVM.
2021-11-11 09:05:21 -05:00
Ed Morley
b41b2e5a5c
Document unreachable!() custom panic message
The `unreachable!` docs previously did not mention that there was a second
form, `unreachable!("message")` that could be used to specify a custom panic
message,

The docs now mention this in the same style as currently used for `unimplemented!`:
https://doc.rust-lang.org/core/macro.unimplemented.html#panics
2021-11-11 13:41:21 +00:00
Muhammad Falak R Wani
5cfc7ce337
librustdoc: revert use of def_id for one of the edge case
Signed-off-by: Muhammad Falak R Wani <falakreyaz@gmail.com>
2021-11-11 18:32:31 +05:30
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
Marcel Hellwig
9f6ca7482c Shorten Span of unused macro lints
The span has been recuded to the actual ident, instead of linting the
*whole* macro.
2021-11-11 08:04:02 +01: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
tamaron
181716a16c compare between Path instead of str 2021-11-11 11:40:34 +09:00
Yuki Okushi
8d4fbc9a73
Add #[inline]s to SortedIndexMultiMap 2021-11-11 08:35:59 +09: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
Jubilee Young
7d91357875 Dynamically detect AVX512 in CI
We would like to check for errors with AVX512,
but we don't pick our CPU. So, detect available features.
This variance in checks stochastically reveals issues.
Nondeterminism is acceptable as our goal is protecting downstream.
2021-11-10 14:40:32 -08:00
Jubilee Young
949f71c0dc Deny warnings in CI and fix 2021-11-10 14:40:32 -08:00
Jubilee Young
c52083e256 Use the right name for AVX512F 2021-11-10 14:40:32 -08: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