]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoRollup merge of #90771 - asterycs:fix/trait-object-error-code, r=michaelwoerister
Matthias Krüger [Sat, 13 Nov 2021 21:35:03 +0000 (22:35 +0100)]
Rollup merge of #90771 - asterycs:fix/trait-object-error-code, r=michaelwoerister

Fix trait object error code

closes #90768

I `grep`:d and changed the occurrences that seemed relevant. Please let me know what you think and if anything is missing!

2 years agoFix handling of substitutions and binders when deciding whether to suggest references
Jakob Degen [Thu, 11 Nov 2021 23:28:19 +0000 (18:28 -0500)]
Fix handling of substitutions and binders when deciding whether to suggest references

When suggesting references, substitutions were being forgotten and some types were misused. This led to at
least one ICE and other incorrectly emitted diagnostics. This has been fixed; in some cases this leads to
diagnostics changing, and tests have been adjusted.

2 years agoAuto merge of #90385 - mfrw:mfrw/librustdoc, r=GuillaumeGomez
bors [Sat, 13 Nov 2021 20:11:58 +0000 (20:11 +0000)]
Auto merge of #90385 - mfrw:mfrw/librustdoc, r=GuillaumeGomez

rustdoc: use Type::def_id() instead of Type::def_id_no_primitives()

For: #90187

r? `@jyn514`

2 years agoRecurse through query system when checking ADT drop types, hopefully improving perf
Jakob Degen [Fri, 12 Nov 2021 21:39:44 +0000 (16:39 -0500)]
Recurse through query system when checking ADT drop types, hopefully improving perf

2 years agoAuto merge of #89551 - jhpratt:stabilize-const_raw_ptr_deref, r=oli-obk
bors [Sat, 13 Nov 2021 17:10:15 +0000 (17:10 +0000)]
Auto merge of #89551 - jhpratt:stabilize-const_raw_ptr_deref, r=oli-obk

Stabilize `const_raw_ptr_deref` for `*const T`

This stabilizes dereferencing immutable raw pointers in const contexts.
It does not stabilize `*mut T` dereferencing. This is behind the
same feature gate as mutable references.

closes https://github.com/rust-lang/rust/issues/51911

2 years agoImplement diagnostic for String conversion
threadexception [Sat, 6 Nov 2021 09:31:46 +0000 (10:31 +0100)]
Implement diagnostic for String conversion

Co-authored-by: Esteban Kuber <estebank@users.noreply.github.com>
2 years agoAuto merge of #90542 - the8472:privatize-the-means-of-rawvec-production, r=joshtriplett
bors [Sat, 13 Nov 2021 13:57:00 +0000 (13:57 +0000)]
Auto merge of #90542 - the8472:privatize-the-means-of-rawvec-production, r=joshtriplett

Make RawVec private to alloc

RawVec was previously exposed for compiler-internal use (libarena specifically) in 1acbb0a9350560d951359cc359361b87992a6f2b

Since it is unstable, doc-hidden and has no associated tracking issue it was never meant for public use. And since
it is no longer used outside alloc itself it can be made private again.

Also remove some functions that are dead due to lack of internal users.

2 years agoDelete rustdoc::doctree
hi-rustin [Sat, 13 Nov 2021 13:50:13 +0000 (21:50 +0800)]
Delete rustdoc::doctree

Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2 years agoChange paths for `dist` command to match the components they generate
Joshua Nelson [Mon, 8 Nov 2021 04:37:28 +0000 (04:37 +0000)]
Change paths for `dist` command to match the components they generate

Before, you could have the confusing situation where the command to
generate a component had no relation to the name of that component (e.g.
the `rustc` component was generated with `src/librustc`). This changes
the name to make them match up.

2 years agoAuto merge of #87264 - mystor:expand_literal, r=petrochenkov
bors [Sat, 13 Nov 2021 08:22:52 +0000 (08:22 +0000)]
Auto merge of #87264 - mystor:expand_literal, r=petrochenkov

proc_macro: Add an expand_expr method to TokenStream

This feature is aimed at giving proc macros access to powers similar to those used by builtin macros such as `format_args!` or `concat!`. These macros are able to accept macros in place of string literal parameters, such as the format string, as they perform recursive macro expansion while being expanded.

This can be especially useful in many cases thanks to helper macros like `concat!`, `stringify!` and `include_str!` which are often used to construct string literals at compile-time in user code.

For now, this method only allows expanding macros which produce literals, although more expressions will be supported before the method is stabilized.

In earlier versions of this PR, this method exclusively returned `Literal`, and spans on returned literals were stripped of expansion context before being returned to be as conservative as possible about permission leakage. The method's naming has been generalized to eventually support arbitrary expressions, and the context stripping has been removed (https://github.com/rust-lang/rust/pull/87264#discussion_r674863279), which should allow for more general APIs like "format_args_implicits" (https://github.com/rust-lang/rust/issues/67984) to be supported as well.

## API Surface

```rust
impl TokenStream {
    pub fn expand_expr(&self) -> Result<TokenStream, ExpandError>;
}

#[non_exhaustive]
pub struct ExpandError;

impl Debug for ExpandError { ... }
impl Display for ExpandError { ... }
impl Error for ExpandError {}
impl !Send for ExpandError {}
impl !Sync for ExpandError {}
```

2 years agoUse an empty Vec instead of Option<Vec>
Michael Howell [Sat, 13 Nov 2021 05:25:31 +0000 (22:25 -0700)]
Use an empty Vec instead of Option<Vec>

2 years agoAuto merge of #90041 - jfrimmel:rt_copy_checks, r=Mark-Simulacrum
bors [Sat, 13 Nov 2021 05:19:39 +0000 (05:19 +0000)]
Auto merge of #90041 - jfrimmel:rt_copy_checks, r=Mark-Simulacrum

Re-enable `copy[_nonoverlapping]()` debug-checks

This commit re-enables the debug checks for valid usages of the two functions `copy()` and `copy_nonoverlapping()`. Those checks were commented out in #79684 in order to make the functions const. All that's been left was a FIXME, that could not be resolved until there is was way to only do the checks at runtime.
Since #89247 there is such a way: `const_eval_select()`. This commit uses that new intrinsic in order to either do nothing (at compile time) or to do the old checks (at runtime).

The change itself is rather small: in order to make the checks usable with `const_eval_select`, they are moved into a local function (one for `copy` and one for `copy_nonoverlapping` to keep symmetry).

The change does not break referential transparency, as there is nothing you can do at compile time, which you cannot do on runtime without getting undefined behavior. The CTFE-engine won't allow missuses. The other way round is also fine.

I've refactored the code to use `#[cfg(debug_assertions)]` on the new items. If that is not desired, the second commit can be dropped.
I haven't added any checks, as I currently don't know, how to test this properly.

Closes #90012.

cc `@rust-lang/lang,` `@rust-lang/libs` and `@rust-lang/wg-const-eval` (as those teams are linked in the issue above).

2 years agoAuto merge of #89167 - workingjubilee:use-simd, r=MarkSimulacrum
bors [Sat, 13 Nov 2021 02:17:20 +0000 (02:17 +0000)]
Auto merge of #89167 - workingjubilee:use-simd, r=MarkSimulacrum

pub use core::simd;

A portable abstraction over SIMD has been a major pursuit in recent years for several programming languages. In Rust, `std::arch` offers explicit SIMD acceleration via compiler intrinsics, but it does so at the cost of having to individually maintain each and every single such API, and is almost completely `unsafe` to use.  `core::simd` offers safe abstractions that are resolved to the appropriate SIMD instructions by LLVM during compilation, including scalar instructions if that is all that is available.

`core::simd` is enabled by the `#![portable_simd]` nightly feature tracked in https://github.com/rust-lang/rust/issues/86656 and is introduced here by pulling in the https://github.com/rust-lang/portable-simd repository as a subtree. We built the repository out-of-tree to allow faster compilation and a stochastic test suite backed by the proptest crate to verify that different targets, features, and optimizations produce the same result, so that using this library does not introduce any surprises. As these tests are technically non-deterministic, and thus can introduce overly interesting Heisenbugs if included in the rustc CI, they are visible in the commit history of the subtree but do nothing here. Some tests **are** introduced via the documentation, but these use deterministic asserts.

There are multiple unsolved problems with the library at the current moment, including a want for better documentation, technical issues with LLVM scalarizing and lowering to libm, room for improvement for the APIs, and so far I have not added the necessary plumbing for allowing the more experimental or libm-dependent APIs to be used. However, I thought it would be prudent to open this for review in its current condition, as it is both usable and it is likely I am going to learn something else needs to be fixed when bors tries this out.

The major types are
- `core::simd::Simd<T, N>`
- `core::simd::Mask<T, N>`

There is also the `LaneCount` struct, which, together with the SimdElement and SupportedLaneCount traits, limit the implementation's maximum support to vectors we know will actually compile and provide supporting logic for bitmasks. I'm hoping to simplify at least some of these out of the way as the compiler and library evolve.

2 years agoBuild musl dist artifacts with debuginfo enabled
Wesley Wiser [Tue, 9 Nov 2021 17:28:55 +0000 (12:28 -0500)]
Build musl dist artifacts with debuginfo enabled

Since our musl targets link to a version of musl we build and bundle
with the targets, if users need to debug into musl or generate
backtraces which contain parts of the musl library, they will be unable
to do so unless we enable and ship the debug info.

This patch changes our dist builds so they enabled debug info when
building musl. This patch also includes a fix for CFI detection in
musl's `configure` script which has been posted upstream[1].

The net effect of this is that we now ship debug info for musl in those
targets. This adds ~90kb to those artifacts but running `strip` on
binaries produced removes all of that. For a "hello world" Rust binary
on x86_64, the numbers are:

|                        | debug | release | release + strip |
|           -            |   -   |    -    |        -        |
| without musl debuginfo | 507kb |  495kb  |      410kb      |
| with musl debuginfo    | 595kb |  584kb  |      410kb      |

Once stripped, the final binaries are the same size (down to the byte).

[1]: https://www.openwall.com/lists/musl/2021/10/21/2

2 years agoRemove bigint_helper_methods for *signed* types
Scott McMurray [Sat, 13 Nov 2021 01:00:47 +0000 (17:00 -0800)]
Remove bigint_helper_methods for *signed* types

These are working well for *unsigned* types, for the the signed ones there are a bunch of questions about what the semantics and API should be.  And for the main "helpers for big integer implementations" use, there's no need for the signed versions anyway.

And there are plenty of other methods which exist for unsigned types but not signed ones, like `next_power_of_two`, so this isn't unusual.

Fixes 90541

2 years agoTest core::simd works
Jubilee Young [Fri, 22 Oct 2021 07:47:12 +0000 (00:47 -0700)]
Test core::simd works

These tests just verify some basic APIs of core::simd function, and
guarantees that attempting to access the wrong things doesn't work.
The majority of tests are stochastic, and so remain upstream, but
a few deterministic tests arrive in the subtree as doc tests.

2 years agoExpose portable-simd as core::simd
Jubilee Young [Fri, 22 Oct 2021 07:12:00 +0000 (00:12 -0700)]
Expose portable-simd as core::simd

This enables programmers to use a safe alternative to the current
`extern "platform-intrinsics"` API for writing portable SIMD code.
This is `#![feature(portable_simd)]` as tracked in #86656

2 years agoAdd 'library/portable-simd/' from commit '1ce1c645cf27c4acdefe6ec8a11d1f0491954a99'
Jubilee Young [Sat, 13 Nov 2021 00:58:25 +0000 (16:58 -0800)]
Add 'library/portable-simd/' from commit '1ce1c645cf27c4acdefe6ec8a11d1f0491954a99'

git-subtree-dir: library/portable-simd
git-subtree-mainline: efd0483949496b067cd5f7569d1b28cd3d5d3c72
git-subtree-split: 1ce1c645cf27c4acdefe6ec8a11d1f0491954a99

2 years agoRewrite Arm transmutes, reading std::arch closer
Jubilee Young [Sat, 13 Nov 2021 00:42:48 +0000 (16:42 -0800)]
Rewrite Arm transmutes, reading std::arch closer

2 years agoadd tests
b-naber [Tue, 9 Nov 2021 19:41:13 +0000 (20:41 +0100)]
add tests

2 years agooops...
Ellen [Fri, 12 Nov 2021 20:50:25 +0000 (20:50 +0000)]
oops...

2 years agoproc_macro: Add an expand_expr method to TokenStream
Nika Layzell [Sun, 18 Jul 2021 19:53:06 +0000 (15:53 -0400)]
proc_macro: Add an expand_expr method to TokenStream

This feature is aimed at giving proc macros access to powers similar to
those used by builtin macros such as `format_args!` or `concat!`. These
macros are able to accept macros in place of string literal parameters,
such as the format string, as they perform recursive macro expansion
while being expanded.

This can be especially useful in many cases thanks to helper macros like
`concat!`, `stringify!` and `include_str!` which are often used to
construct string literals at compile-time in user code.

For now, this method only allows expanding macros which produce
literals, although more expresisons will be supported before the method
is stabilized.

2 years agoAuto merge of #90836 - matthiaskrgr:rollup-ou6yrlw, r=matthiaskrgr
bors [Fri, 12 Nov 2021 19:28:04 +0000 (19:28 +0000)]
Auto merge of #90836 - matthiaskrgr:rollup-ou6yrlw, r=matthiaskrgr

Rollup of 7 pull requests

Successful merges:

 - #90589 (rustc_llvm: update PassWrapper for recent LLVM)
 - #90644 (Extend the const swap feature)
 - #90704 (Unix ExitStatus comments and a tiny docs fix)
 - #90761 (Shorten Span of unused macro lints)
 - #90795 (Add more comments to explain the code to generate the search index)
 - #90798 (Document `unreachable!` custom panic message)
 - #90826 (rustc_feature: Convert `BuiltinAttribute` from tuple to a struct)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

2 years agoRollup merge of #90826 - petrochenkov:binattr, r=cjgillot
Matthias Krüger [Fri, 12 Nov 2021 18:17:34 +0000 (19:17 +0100)]
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.

2 years agoRollup merge of #90798 - edmorley:doc-unreachable-custom-message, r=dtolnay
Matthias Krüger [Fri, 12 Nov 2021 18:17:33 +0000 (19:17 +0100)]
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

2 years agoRollup merge of #90795 - GuillaumeGomez:more-search-index-comments, r=notriddle
Matthias Krüger [Fri, 12 Nov 2021 18:17:32 +0000 (19:17 +0100)]
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`

2 years agoRollup merge of #90761 - hellow554:macro_span, r=estebank
Matthias Krüger [Fri, 12 Nov 2021 18:17:31 +0000 (19:17 +0100)]
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``

2 years agoRollup merge of #90704 - ijackson:exitstatus-comments, r=joshtriplett
Matthias Krüger [Fri, 12 Nov 2021 18:17:31 +0000 (19:17 +0100)]
Rollup merge of #90704 - ijackson:exitstatus-comments, r=joshtriplett

Unix ExitStatus comments and a tiny docs fix

Some nits left over from #88300

2 years agoRollup merge of #90644 - est31:const_swap, r=Mark-Simulacrum
Matthias Krüger [Fri, 12 Nov 2021 18:17:30 +0000 (19:17 +0100)]
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);
}

2 years agoRollup merge of #90589 - durin42:llvm-14-ASO-now-struct, r=nikic
Matthias Krüger [Fri, 12 Nov 2021 18:17:28 +0000 (19:17 +0100)]
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`

2 years agoRename WASI's `is_character_device` to `is_char_device`.
Dan Gohman [Fri, 12 Nov 2021 17:25:32 +0000 (09:25 -0800)]
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.

2 years agoAndroid is not GNU
Josh Stone [Fri, 12 Nov 2021 17:09:08 +0000 (09:09 -0800)]
Android is not GNU

2 years agoAuto merge of #89316 - asquared31415:multiple-clobber-abi, r=Amanieu
bors [Fri, 12 Nov 2021 16:29:25 +0000 (16:29 +0000)]
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

2 years agofix aarch test error annotations
asquared31415 [Fri, 12 Nov 2021 15:30:20 +0000 (10:30 -0500)]
fix aarch test error annotations

2 years agoAdd more comments to explain the code to generate the search index
Guillaume Gomez [Thu, 11 Nov 2021 11:43:54 +0000 (12:43 +0100)]
Add more comments to explain the code to generate the search index

2 years agoRemove unneeded FIXME: after testing the suggested changes, we reached the conclusion...
Guillaume Gomez [Fri, 12 Nov 2021 14:25:13 +0000 (15:25 +0100)]
Remove unneeded FIXME: after testing the suggested changes, we reached the conclusion that the code readibility wasn't worth the almost unnoticeable perf improvement

2 years agoAdd Vec::retain_mut
Guillaume Gomez [Wed, 10 Nov 2021 18:25:54 +0000 (19:25 +0100)]
Add Vec::retain_mut

2 years agorustc_feature: Convert `BuiltinAttribute` from tuple to a struct
Vadim Petrochenkov [Fri, 12 Nov 2021 12:15:14 +0000 (20:15 +0800)]
rustc_feature: Convert `BuiltinAttribute` from tuple to a struct

2 years agoAuto merge of #90813 - notriddle:notriddle/vec-extend, r=GuillaumeGomez
bors [Fri, 12 Nov 2021 12:13:32 +0000 (12:13 +0000)]
Auto merge of #90813 - notriddle:notriddle/vec-extend, r=GuillaumeGomez

Use Vec extend and collect instead of repeatedly calling push

2 years agoprovide a `SpecExtend` trait for `Vec<T>`
Neutron3529 [Tue, 24 Aug 2021 06:41:28 +0000 (14:41 +0800)]
provide a `SpecExtend` trait for `Vec<T>`
The discussion is [here](https://internals.rust-lang.org/t/append-vec-to-binaryheap/15209/3)

2 years agoMIRI says `reverse` is UB, so replace it with an implementation that LLVM can vectorize
Scott McMurray [Fri, 12 Nov 2021 04:32:18 +0000 (20:32 -0800)]
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!

2 years agoAuto merge of #90731 - pierwill:fix-90658, r=michaelwoerister
bors [Fri, 12 Nov 2021 04:26:28 +0000 (04:26 +0000)]
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`

2 years agoUse `associated_item_def_ids` more
Matthew Jasper [Fri, 5 Nov 2021 18:47:52 +0000 (18:47 +0000)]
Use `associated_item_def_ids` more

2 years agoRemove unused field of `RegionVariableOrigin`
Matthew Jasper [Thu, 11 Nov 2021 23:15:47 +0000 (23:15 +0000)]
Remove unused field of `RegionVariableOrigin`

2 years agoUse `Iterator::collect` instead of calling `Vec::push` in a loop
Michael Howell [Thu, 11 Nov 2021 20:57:00 +0000 (13:57 -0700)]
Use `Iterator::collect` instead of calling `Vec::push` in a loop

2 years agonormalize argument b in equate_normalized_inputs_output
b-naber [Tue, 9 Nov 2021 19:21:51 +0000 (20:21 +0100)]
normalize argument b in equate_normalized_inputs_output

2 years agoAuto merge of #90489 - jyn514:load-all-extern-crates, r=petrochenkov
bors [Thu, 11 Nov 2021 22:00:53 +0000 (22:00 +0000)]
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`).

2 years agoUse `Vec::extend`, instead of calling `Vec::push` in a loop
Michael Howell [Thu, 11 Nov 2021 20:56:32 +0000 (13:56 -0700)]
Use `Vec::extend`, instead of calling `Vec::push` in a loop

2 years ago`Prefix` can be case-insensitive, delegate to its Hash impl instead of trying to...
The8472 [Thu, 11 Nov 2021 20:42:59 +0000 (21:42 +0100)]
`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.

2 years agoRestrict Arm types to Arm v7+
Jubilee Young [Thu, 11 Nov 2021 18:54:27 +0000 (10:54 -0800)]
Restrict Arm types to Arm v7+

This mostly mirrors the restrictions in std::arch.
It can be loosened slightly with later refactoring.

2 years agoAuto merge of #90746 - nnethercote:opt-pattern-matching, r=Nadrieril
bors [Thu, 11 Nov 2021 18:26:49 +0000 (18:26 +0000)]
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`

2 years agoprocess::ExitStatus: Discuss `exit` vs `_exit` in a comment.
Ian Jackson [Mon, 8 Nov 2021 17:38:53 +0000 (17:38 +0000)]
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>
2 years agounix::ExitStatus: Add comment saying that it's a wait status
Ian Jackson [Mon, 8 Nov 2021 17:38:01 +0000 (17:38 +0000)]
unix::ExitStatus: Add comment saying that it's a wait status

With cross-reference.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
2 years agounix::ExitStatusExt: Correct reference to _exit system call
Ian Jackson [Mon, 8 Nov 2021 17:28:02 +0000 (17:28 +0000)]
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>
2 years agoAuto merge of #90648 - matthewjasper:assoc-item-cleanup, r=cjgillot
bors [Thu, 11 Nov 2021 15:15:15 +0000 (15:15 +0000)]
Auto merge of #90648 - matthewjasper:assoc-item-cleanup, r=cjgillot

Assoc item cleanup

This removes some fields from ObligationCauseCode

Split out of #90639

2 years agoPassWrapper: additional sanitizer update to match clang
Krasimir Georgiev [Thu, 11 Nov 2021 14:03:23 +0000 (09:03 -0500)]
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.

2 years agoDocument `unreachable!()` custom panic message
Ed Morley [Thu, 11 Nov 2021 13:41:21 +0000 (13:41 +0000)]
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

2 years agolibrustdoc: revert use of def_id for one of the edge case
Muhammad Falak R Wani [Thu, 11 Nov 2021 06:30:02 +0000 (12:00 +0530)]
librustdoc: revert use of def_id for one of the edge case

Signed-off-by: Muhammad Falak R Wani <falakreyaz@gmail.com>
2 years agoAuto merge of #88798 - sunfishcode:sunfishcode/windows-null-handles, r=joshtriplett
bors [Thu, 11 Nov 2021 12:07:53 +0000 (12:07 +0000)]
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`

2 years agoAuto merge of #90755 - scottmcm:spec-array-clone, r=jackh726
bors [Thu, 11 Nov 2021 09:13:22 +0000 (09:13 +0000)]
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
}
```

2 years agoShorten Span of unused macro lints
Marcel Hellwig [Wed, 10 Nov 2021 11:00:46 +0000 (12:00 +0100)]
Shorten Span of unused macro lints

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

2 years agoAuto merge of #89550 - lcnr:coherence-specialization, r=nikomatsakis
bors [Thu, 11 Nov 2021 05:47:37 +0000 (05:47 +0000)]
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`

2 years agoAuto merge of #83846 - torhovland:issue-10971, r=davidtwco
bors [Thu, 11 Nov 2021 02:52:32 +0000 (02:52 +0000)]
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.

2 years agocompare between Path instead of str
tamaron [Thu, 11 Nov 2021 02:40:34 +0000 (11:40 +0900)]
compare between Path instead of str

2 years agoAdd `#[inline]`s to `SortedIndexMultiMap`
Yuki Okushi [Wed, 10 Nov 2021 23:35:59 +0000 (08:35 +0900)]
Add `#[inline]`s to `SortedIndexMultiMap`

2 years agoAuto merge of #90784 - matthiaskrgr:rollup-car8g12, r=matthiaskrgr
bors [Wed, 10 Nov 2021 23:13:06 +0000 (23:13 +0000)]
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

2 years agoDynamically detect AVX512 in CI
Jubilee Young [Wed, 10 Nov 2021 07:49:16 +0000 (23:49 -0800)]
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.

2 years agoDeny warnings in CI and fix
Jubilee Young [Wed, 10 Nov 2021 05:06:38 +0000 (21:06 -0800)]
Deny warnings in CI and fix

2 years agoUse the right name for AVX512F
Jubilee Young [Wed, 10 Nov 2021 05:04:18 +0000 (21:04 -0800)]
Use the right name for AVX512F

2 years agoRollup merge of #90783 - camelid:update-miri, r=RalfJung
Matthias Krüger [Wed, 10 Nov 2021 22:04:27 +0000 (23:04 +0100)]
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`

2 years agoRollup merge of #90736 - Lokathor:inline-asm-docs-updates, r=Amanieu
Matthias Krüger [Wed, 10 Nov 2021 22:04:26 +0000 (23:04 +0100)]
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.

2 years agoRollup merge of #89930 - cuviper:avoid-clone3, r=joshtriplett
Matthias Krüger [Wed, 10 Nov 2021 22:04:25 +0000 (23:04 +0100)]
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 12fbabd27f700, as
that was just fallout from using `clone3` instead of `fork`.

r? `@Mark-Simulacrum`
cc `@joshtriplett`

2 years agoUpdate Miri
Noah Lev [Wed, 10 Nov 2021 20:42:51 +0000 (12:42 -0800)]
Update Miri

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

2 years agoAuto merge of #90769 - matthiaskrgr:rollup-266apqm, r=matthiaskrgr
bors [Wed, 10 Nov 2021 20:12:14 +0000 (20:12 +0000)]
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

2 years agoMoar #[inline]
Scott McMurray [Wed, 10 Nov 2021 19:57:14 +0000 (11:57 -0800)]
Moar #[inline]

2 years agoDisable `.debug_aranges` for all wasm targets
Alex Crichton [Wed, 10 Nov 2021 18:47:00 +0000 (10:47 -0800)]
Disable `.debug_aranges` for all wasm targets

This follows from discussion on
https://bugs.llvm.org/show_bug.cgi?id=52442 where it looks like this
section doesn't make sense for wasm targets.

2 years agoRollup merge of #90758 - joseph-roitman:fix-entry-doc-key-ref, r=dtolnay
Matthias Krüger [Wed, 10 Nov 2021 17:52:30 +0000 (18:52 +0100)]
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.

2 years agoRollup merge of #90742 - est31:add_assign, r=davidtwco
Matthias Krüger [Wed, 10 Nov 2021 17:52:29 +0000 (18:52 +0100)]
Rollup merge of #90742 - est31:add_assign, r=davidtwco

Use AddAssign impl

2 years agoRollup merge of #90727 - GuillaumeGomez:remove-potential-useless-search-index-data...
Matthias Krüger [Wed, 10 Nov 2021 17:52:28 +0000 (18:52 +0100)]
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`

2 years agoRollup merge of #88868 - calebzulawski:feature/simd_bitmask, r=workingjubilee
Matthias Krüger [Wed, 10 Nov 2021 17:52:27 +0000 (18:52 +0100)]
Rollup merge of #88868 - calebzulawski:feature/simd_bitmask, r=workingjubilee

Allow simd_bitmask to return byte arrays

cc `@rust-lang/project-portable-simd` `@workingjubilee`

2 years agoRollup merge of #88447 - inquisitivecrystal:rustdoc-vis, r=jyn514
Matthias Krüger [Wed, 10 Nov 2021 17:52:26 +0000 (18:52 +0100)]
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`

2 years agoFix trait object error code
Jimmy Envall [Wed, 10 Nov 2021 17:49:30 +0000 (18:49 +0100)]
Fix trait object error code

2 years agoAdd a missing doc link
Alex Crichton [Tue, 9 Nov 2021 19:17:49 +0000 (11:17 -0800)]
Add a missing doc link

2 years agoUpdate src/doc/rustc/src/platform-support.md
Alex Crichton [Tue, 9 Nov 2021 16:51:30 +0000 (10:51 -0600)]
Update src/doc/rustc/src/platform-support.md

Co-authored-by: Josh Triplett <josh@joshtriplett.org>
2 years agoAdd target documentation for wasm64-unknown-unknown
Alex Crichton [Tue, 9 Nov 2021 15:44:42 +0000 (07:44 -0800)]
Add target documentation for wasm64-unknown-unknown

2 years agoUpdate stdarch/dlmalloc
Alex Crichton [Mon, 8 Nov 2021 15:53:35 +0000 (07:53 -0800)]
Update stdarch/dlmalloc

Ensure that they compile with the now-a-feature-is-required logic.

2 years agoUpdate dlmalloc for libstd
Alex Crichton [Tue, 2 Nov 2021 18:28:54 +0000 (11:28 -0700)]
Update dlmalloc for libstd

This pulls in a fix for wasm64 to work correctly with this dlmalloc

2 years agoUpdate stdarch/compiler_builtins
Alex Crichton [Tue, 2 Nov 2021 14:23:41 +0000 (07:23 -0700)]
Update stdarch/compiler_builtins

Brings in some fixes and better support for the wasm64 target.

2 years agoUse more robust checks in rustc for wasm
Alex Crichton [Mon, 1 Nov 2021 21:32:55 +0000 (14:32 -0700)]
Use more robust checks in rustc for wasm

2 years agoUpdate more rustc/libtest things for wasm64
Alex Crichton [Mon, 1 Nov 2021 20:44:28 +0000 (13:44 -0700)]
Update more rustc/libtest things for wasm64

* Add wasm64 variants for inline assembly along the same lines as wasm32
* Update a few directives in libtest to check for `target_family`
  instead of `target_arch`
* Update some rustc codegen and typechecks specialized for wasm32 to
  also work for wasm64.

2 years agoFix a crash with wasm64 in LLVM
Alex Crichton [Mon, 1 Nov 2021 21:16:25 +0000 (14:16 -0700)]
Fix a crash with wasm64 in LLVM

This commit works around a crash in LLVM when the
`-generate-arange-section` argument is passed to LLVM. An LLVM bug is
opened for this and the code in question is also set to continue passing
this flag with LLVM 14, assuming that this is fixed by the time LLVM 14
comes out. Otherwise this should work around debuginfo crashes on LLVM
13.

2 years agoReview comments
Alex Crichton [Mon, 1 Nov 2021 14:11:05 +0000 (07:11 -0700)]
Review comments

2 years agoUpdate platform support docs
Alex Crichton [Thu, 28 Oct 2021 23:29:23 +0000 (16:29 -0700)]
Update platform support docs

2 years agoUse `target_family = "wasm"`
Alex Crichton [Thu, 28 Oct 2021 23:28:21 +0000 (16:28 -0700)]
Use `target_family = "wasm"`

2 years agoEnable WebAssembly features by default on wasm64
Alex Crichton [Thu, 28 Oct 2021 18:20:46 +0000 (11:20 -0700)]
Enable WebAssembly features by default on wasm64

These are all stable as-of-now in the WebAssembly specification so any
engine which implements wasm64 will surely implement these features as
well.

2 years agostd: Get the standard library compiling for wasm64
Alex Crichton [Thu, 28 Oct 2021 17:58:16 +0000 (10:58 -0700)]
std: Get the standard library compiling for wasm64

This commit goes through and updates various `#[cfg]` as appropriate to
get the wasm64-unknown-unknown target behaving similarly to the
wasm32-unknown-unknown target. Most of this is just updating various
conditions for `target_arch = "wasm32"` to also account for `target_arch
= "wasm64"` where appropriate. This commit also lists `wasm64` as an
allow-listed architecture to not have the `restricted_std` feature
enabled, enabling experimentation with `-Z build-std` externally.

The main goal of this commit is to enable playing around with
`wasm64-unknown-unknown` externally via `-Z build-std` in a way that's
similar to the `wasm32-unknown-unknown` target. These targets are
effectively the same and only differ in their pointer size, but wasm64
is much newer and has much less ecosystem/library support so it'll still
take time to get wasm64 fully-fledged.

2 years agodon't inline `report_overlap_conflict`
lcnr [Sat, 23 Oct 2021 19:05:03 +0000 (21:05 +0200)]
don't inline `report_overlap_conflict`

2 years agono overlap errors after failing the orphan check
lcnr [Thu, 21 Oct 2021 13:36:35 +0000 (15:36 +0200)]
no overlap errors after failing the orphan check

2 years agoAuto merge of #90759 - yanok:llvm-dbginfo-fix, r=nikic
bors [Wed, 10 Nov 2021 12:56:29 +0000 (12:56 +0000)]
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).

2 years agoUpdate llvm submodule
Ilya Yanok [Wed, 10 Nov 2021 10:52:59 +0000 (10:52 +0000)]
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).