]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoRollup merge of #84083 - ltratt:threadid_doc_tweak, r=dtolnay
Matthias Krüger [Sat, 1 Jan 2022 21:49:47 +0000 (22:49 +0100)]
Rollup merge of #84083 - ltratt:threadid_doc_tweak, r=dtolnay

Clarify the guarantees that ThreadId does and doesn't make.

The existing documentation does not spell out whether `ThreadId`s are unique during the lifetime of a thread or of a process. I had to examine the source code to realise (pleasingly!) that they're unique for the lifetime of a process. That seems worth documenting clearly, as it's a strong guarantee.

Examining the way `ThreadId`s are created also made me realise that the `as_u64` method on `ThreadId` could be a trap for the unwary on those platforms where the platform's notion of a thread identifier is also a 64 bit integer (particularly if they happen to use a similar identifier scheme to `ThreadId`). I therefore think it's worth being even clearer that there's no relationship between the two.

2 years agoAuto merge of #92455 - petrochenkov:alltraits2, r=cjgillot
bors [Sat, 1 Jan 2022 17:34:12 +0000 (17:34 +0000)]
Auto merge of #92455 - petrochenkov:alltraits2, r=cjgillot

rustc_metadata: Use a query for collecting all traits in encoder

Implement refactoring suggested in https://github.com/rust-lang/rust/pull/92244#discussion_r775976336
r? `@cjgillot`

2 years agoAuto merge of #92419 - erikdesjardins:coldland, r=nagisa
bors [Sat, 1 Jan 2022 13:28:13 +0000 (13:28 +0000)]
Auto merge of #92419 - erikdesjardins:coldland, r=nagisa

Mark drop calls in landing pads `cold` instead of `noinline`

Now that deferred inlining has been disabled in LLVM (#92110), this shouldn't cause catastrophic size blowup.

I confirmed that the test cases from https://github.com/rust-lang/rust/issues/41696#issuecomment-298696944 still compile quickly (<1s) after this change. ~Although note that I wasn't able to reproduce the original issue using a recent rustc/llvm with deferred inlining enabled, so those tests may no longer be representative. I was also unable to create a modified test case that reproduced the original issue.~ (edit: I reproduced it on CI by accident--the first commit timed out on the LLVM 12 builder, because I forgot to make it conditional on LLVM version)

r? `@nagisa`
cc `@arielb1` (this effectively reverts #42771 "mark calls in the unwind path as !noinline")
cc `@RalfJung` (fixes #46515)

edit: also fixes #87055

2 years agoAuto merge of #92471 - matthiaskrgr:rollup-lmduxwh, r=matthiaskrgr
bors [Sat, 1 Jan 2022 09:57:35 +0000 (09:57 +0000)]
Auto merge of #92471 - matthiaskrgr:rollup-lmduxwh, r=matthiaskrgr

Rollup of 7 pull requests

Successful merges:

 - #88310 (Lock bootstrap (x.py) build directory)
 - #92097 (Implement split_at_spare_mut without Deref to a slice so that the spare slice is valid)
 - #92412 (Fix double space in pretty printed TryBlock)
 - #92420 (Fix whitespace in pretty printed PatKind::Range)
 - #92457 (Sync rustc_codegen_gcc)
 - #92460 ([rustc_builtin_macros] add indices to format_foreign::printf::Substitution::Escape)
 - #92469 (Make tidy check for magic numbers that spell things)

Failed merges:

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

2 years agoRollup merge of #92469 - joshtriplett:test-number-fix, r=Mark-Simulacrum
Matthias Krüger [Sat, 1 Jan 2022 09:48:58 +0000 (10:48 +0100)]
Rollup merge of #92469 - joshtriplett:test-number-fix, r=Mark-Simulacrum

Make tidy check for magic numbers that spell things

Remove existing problematic cases.

r? `@Mark-Simulacrum`

2 years agoRollup merge of #92460 - dwrensha:fix-92267, r=petrochenkov
Matthias Krüger [Sat, 1 Jan 2022 09:48:57 +0000 (10:48 +0100)]
Rollup merge of #92460 - dwrensha:fix-92267, r=petrochenkov

[rustc_builtin_macros] add indices to format_foreign::printf::Substitution::Escape

Fixes #92267.

The problem was that the escape string "%%" does not need to appear at the very beginning of the format string, but
the iterator implementation assumed that it did.

The solution follows the pattern used by `format_foregin::shell::Subtitution::Escape`: https://github.com/rust-lang/rust/blob/8ed935e92dfb09ae388344b12284bf5110cf9265/compiler/rustc_builtin_macros/src/format_foreign.rs#L629

2 years agoRollup merge of #92457 - bjorn3:sync_cg_gcc-2021-12-31, r=antoyo
Matthias Krüger [Sat, 1 Jan 2022 09:48:57 +0000 (10:48 +0100)]
Rollup merge of #92457 - bjorn3:sync_cg_gcc-2021-12-31, r=antoyo

Sync rustc_codegen_gcc

r? `@ghost`

cc `@antoyo`

`@rustbot` label +A-codegen +A-gcc +T-compiler

2 years agoRollup merge of #92420 - dtolnay:patrange, r=Mark-Simulacrum
Matthias Krüger [Sat, 1 Jan 2022 09:48:56 +0000 (10:48 +0100)]
Rollup merge of #92420 - dtolnay:patrange, r=Mark-Simulacrum

Fix whitespace in pretty printed PatKind::Range

Follow-up to #92238 fixing one of the FIXMEs.

```rust
macro_rules! repro {
    ($pat:pat) => {
        stringify!($pat)
    };
}

fn main() {
    println!("{}", repro!(0..=1));
}
```

Before:&ensp;`0 ..=1`
After:&ensp;`0..=1`

The canonical spacing applied by rustfmt has no space after the lower expr. Rustc's parser diagnostics also do not put a space there:

https://github.com/rust-lang/rust/blob/df96fb166f59431e3de443835e50d5b8a7a4adb0/compiler/rustc_parse/src/parser/pat.rs#L754

2 years agoRollup merge of #92412 - dtolnay:tryspace, r=Mark-Simulacrum
Matthias Krüger [Sat, 1 Jan 2022 09:48:55 +0000 (10:48 +0100)]
Rollup merge of #92412 - dtolnay:tryspace, r=Mark-Simulacrum

Fix double space in pretty printed TryBlock

Follow-up to #92238 fixing one of the FIXMEs.

```rust
macro_rules! repro {
    ($expr:expr) => {
        stringify!($expr)
    };
}

fn main() {
    println!("{}", repro!(try {}));
}
```

Before:&ensp;<code>try&nbsp;&nbsp;{}</code>
After:&ensp;<code>try&nbsp;{}</code>

The `head` helper already appends a space:

https://github.com/rust-lang/rust/blob/2b67c30bfece00357d5fc09d99b49f21066f04ba/compiler/rustc_ast_pretty/src/pprust/state.rs#L654-L664

so doing `head` followed by `space` resulted in a double space:

https://github.com/rust-lang/rust/blob/2b67c30bfece00357d5fc09d99b49f21066f04ba/compiler/rustc_ast_pretty/src/pprust/state.rs#L2241-L2242

2 years agoRollup merge of #92097 - saethlin:split-without-deref, r=the8472
Matthias Krüger [Sat, 1 Jan 2022 09:48:54 +0000 (10:48 +0100)]
Rollup merge of #92097 - saethlin:split-without-deref, r=the8472

Implement split_at_spare_mut without Deref to a slice so that the spare slice is valid

~I'm not sure I understand what's going on here correctly. And I'm pretty sure this safety comment needs to be changed. I'm just referring to the same thing that `as_mut_ptr_range` does.~ (Thanks `@RalfJung` for the guidance and clearing things up)

I tried to run https://github.com/rust-lang/miri-test-libstd on alloc with -Zmiri-track-raw-pointers, and got a failure on the test `vec::test_extend_from_within`.

I minimized the test failure into this program:
```rust
#![feature(vec_split_at_spare)]
fn main() {
    Vec::<i32>::with_capacity(1).split_at_spare_mut();
}
```

The problem is that the existing implementation is actually getting a pointer range where both pointers are derived from the initialized region of the Vec's allocation, but we need the second one to be valid for the region between len and capacity. (thanks Ralf for clearing this up)

2 years agoRollup merge of #88310 - worldeva:bootstrap-locking, r=Mark-Simulacrum
Matthias Krüger [Sat, 1 Jan 2022 09:48:53 +0000 (10:48 +0100)]
Rollup merge of #88310 - worldeva:bootstrap-locking, r=Mark-Simulacrum

Lock bootstrap (x.py) build directory

Closes #76661,  closes #80849,
`x.py` creates a lock file at `project_root/lock.db`

r? `@jyn514` , because he was one that told me about this~

2 years agoAuto merge of #92374 - ehuss:update-libssh2-sys, r=Mark-Simulacrum
bors [Sat, 1 Jan 2022 05:21:22 +0000 (05:21 +0000)]
Auto merge of #92374 - ehuss:update-libssh2-sys, r=Mark-Simulacrum

Update libssh2-sys

Updates libssh2-sys from 0.2.19 to 0.2.23.  This brings in libssh2 1.10 ([RELEASE-NOTES](https://github.com/libssh2/libssh2/blob/libssh2-1.10.0/RELEASE-NOTES)).  One of the major changes is to add support for OpenSSH agent on Windows.

Closes https://github.com/rust-lang/cargo/issues/10237

2 years agoMake tidy check for magic numbers that spell things
Josh Triplett [Sat, 1 Jan 2022 05:13:07 +0000 (21:13 -0800)]
Make tidy check for magic numbers that spell things

Remove existing problematic cases.

2 years agorustc_metadata: Use a query for collecting all traits in encoder
Vadim Petrochenkov [Fri, 31 Dec 2021 10:15:52 +0000 (18:15 +0800)]
rustc_metadata: Use a query for collecting all traits in encoder

2 years agoAuto merge of #92294 - Kobzol:rustdoc-meta-kind, r=GuillaumeGomez
bors [Sat, 1 Jan 2022 02:03:23 +0000 (02:03 +0000)]
Auto merge of #92294 - Kobzol:rustdoc-meta-kind, r=GuillaumeGomez

Add Attribute::meta_kind

The `AttrItem::meta` function is being called on a lot of places, however almost always the caller is only interested in the `kind` of the result `MetaItem`. Before, the `path`  had to be cloned in order to get the kind, now it does not have to be.

There is a larger related "problem". In a lot of places, something wants to know contents of attributes. This is accessed through `Attribute::meta_item_list`, which calls `AttrItem::meta` (now `AttrItem::meta_kind`), among other methods. When this function is called, the meta item list has to be recreated from scratch. Everytime something asks a simple question (like is this item/list of attributes `#[doc(hidden)]`?), the tokens of the attribute(s) are cloned, parsed and the results are allocated on the heap. That seems really unnecessary. What would be the best way to cache this? Turn `meta_item_list` into a query perhaps? Related PR: https://github.com/rust-lang/rust/pull/92227

r? rust-lang/rustdoc

2 years agoClarify safety comment
Ben Kimock [Fri, 31 Dec 2021 23:03:07 +0000 (18:03 -0500)]
Clarify safety comment

2 years agoAuto merge of #92465 - matthiaskrgr:rollup-yuary84, r=matthiaskrgr
bors [Fri, 31 Dec 2021 22:57:51 +0000 (22:57 +0000)]
Auto merge of #92465 - matthiaskrgr:rollup-yuary84, r=matthiaskrgr

Rollup of 7 pull requests

Successful merges:

 - #90383 (Extend check for UnsafeCell in consts to cover unions)
 - #91375 (config.rs: Add support for a per-target default_linker option.)
 - #91480 (rustdoc: use smaller number of colors to distinguish items)
 - #92338 (Add try_reserve and  try_reserve_exact for OsString)
 - #92405 (Add a couple needs-asm-support headers to tests)
 - #92435 (Sync rustc_codegen_cranelift)
 - #92440 (Fix mobile toggles position)

Failed merges:

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

2 years agoRollup merge of #92440 - GuillaumeGomez:fix-mobile-toggles, r=jsha
Matthias Krüger [Fri, 31 Dec 2021 22:14:49 +0000 (23:14 +0100)]
Rollup merge of #92440 - GuillaumeGomez:fix-mobile-toggles, r=jsha

Fix mobile toggles position

Before:

![Screenshot from 2021-12-29 18-53-33](https://user-images.githubusercontent.com/3050060/147764842-082f6fa2-b631-4c47-ba34-ced76fe8494f.png)

After:

![Screenshot from 2021-12-29 18-52-48](https://user-images.githubusercontent.com/3050060/147764853-13046330-2442-4fad-b26a-84c167711b54.png)

r? `@jsha`

2 years agoRollup merge of #92435 - bjorn3:sync_cg_clif-2021-12-30, r=bjorn3
Matthias Krüger [Fri, 31 Dec 2021 22:14:48 +0000 (23:14 +0100)]
Rollup merge of #92435 - bjorn3:sync_cg_clif-2021-12-30, r=bjorn3

Sync rustc_codegen_cranelift

The main highlight this sync is enforcing rustfmt and lack of warnings on cg_clif's CI. I will open a separate PR to remove the cg_clif exceptions for them from this repo.

r? `@ghost`

`@rustbot` label +A-codegen +A-cranelift +T-compiler

2 years agoRollup merge of #92405 - bjorn3:more_needs_inline_asm, r=lqd
Matthias Krüger [Fri, 31 Dec 2021 22:14:47 +0000 (23:14 +0100)]
Rollup merge of #92405 - bjorn3:more_needs_inline_asm, r=lqd

Add a couple needs-asm-support headers to tests

This will allow them to be ignored by codegen backends that don't support inline asm.

2 years agoRollup merge of #92338 - Xuanwo:try_reserve, r=dtolnay
Matthias Krüger [Fri, 31 Dec 2021 22:14:46 +0000 (23:14 +0100)]
Rollup merge of #92338 - Xuanwo:try_reserve, r=dtolnay

Add try_reserve and  try_reserve_exact for OsString

Add `try_reserve` and `try_reserve_exact` for OsString.

Part of https://github.com/rust-lang/rust/issues/91789

I will squash the commits after PR is ready to merge.

Signed-off-by: Xuanwo <github@xuanwo.io>
2 years agoRollup merge of #91480 - jsha:fewer-colors, r=GuillaumeGomez
Matthias Krüger [Fri, 31 Dec 2021 22:14:45 +0000 (23:14 +0100)]
Rollup merge of #91480 - jsha:fewer-colors, r=GuillaumeGomez

rustdoc: use smaller number of colors to distinguish items

This reduces visual distractions when reading method signatures.

As discussed in https://github.com/rust-lang/rust/issues/59845#issuecomment-974757191, this categorizes items into one of six colors (down from thirteen):

 - method, function (ochre `#AD7C37`)
 - trait, trait alias (dark slate blue `#6E4FC9`)
 - enum, struct, type alias, union, primitive (maroon `#AD378A`)
 - static, module, keyword, associated type, foreign type (steel blue `#3873AD`)
 - macro (green `#068000`)
 - generic params, self, Self (unmarked black `#000000`)

I slightly tweaked the actual color values so they'd have the same lightness (previously the trait color stood out much more than the others). And I made the color for links in general consistently use steel blue (previously there was a slightly different color for "search-failed").

The ayu and dark themes have been updated according to the same logic. I haven't changed any of the color values in those themes, just their assignment to types.

Demo:

https://rustdoc.crud.net/jsha/fewer-colors/std/string/struct.String.html
https://rustdoc.crud.net/jsha/fewer-colors/std/vec/struct.Vec.html
https://rustdoc.crud.net/jsha/fewer-colors/std/io/trait.Read.html
https://rustdoc.crud.net/jsha/fewer-colors/std/iter/trait.Iterator.html

2 years agoRollup merge of #91375 - Apteryks:per-target-default-linker, r=Mark-Simulacrum
Matthias Krüger [Fri, 31 Dec 2021 22:14:44 +0000 (23:14 +0100)]
Rollup merge of #91375 - Apteryks:per-target-default-linker, r=Mark-Simulacrum

config.rs: Add support for a per-target default_linker option.

* src/bootstrap/config.rs (Target) <default_linker>: New field.
(TomlTarget): Likewise.
* src/bootstrap/compile.rs (rustc_cargo_env): Prefer a
target-specified default_linker over a global one if available.
* config.toml.example: Adjust doc.

2 years agoRollup merge of #90383 - tmiasko:union-validity, r=RalfJung
Matthias Krüger [Fri, 31 Dec 2021 22:14:44 +0000 (23:14 +0100)]
Rollup merge of #90383 - tmiasko:union-validity, r=RalfJung

Extend check for UnsafeCell in consts to cover unions

A validity companion to changes from #90373.

`@rust-lang/wg-const-eval`

2 years agoAuto merge of #90637 - Mark-Simulacrum:liveness-btree, r=lqd
bors [Fri, 31 Dec 2021 19:54:10 +0000 (19:54 +0000)]
Auto merge of #90637 - Mark-Simulacrum:liveness-btree, r=lqd

Store liveness in interval sets for region inference

On the 100,000 line test case from https://github.com/rust-lang/rust/issues/90445, this reduces memory usage from 35 GB to 444 MB at peak (based on DHAT results, though with regular malloc), and yields a 9.4x speedup, with wall time going from 14.5 seconds to 1.5s. Performance results show that for the majority of real-world code this has little to no impact, but it's expected to generally scale better for auto-generated functions and other cases which stress this area of the compiler, as results on #90445 illustrate.

There may also be further room for improvement in future PRs making use of this data structures benefits over raw bitsets (which, at some level, are a less perfect fit for representing liveness, which is almost always composed of contiguous ranges, not point locations).

Fixes #90445.

2 years agorustbuild: Add support for a per-target default-linker option.
Maxim Cournoyer [Mon, 29 Nov 2021 21:56:45 +0000 (16:56 -0500)]
rustbuild: Add support for a per-target default-linker option.

2 years agoupdate tests
David Renshaw [Fri, 31 Dec 2021 17:51:27 +0000 (12:51 -0500)]
update tests

2 years ago[rustc_builtin_macros] add indices to format_foreign::printf::Substitution::Escape
David Renshaw [Fri, 31 Dec 2021 17:26:10 +0000 (12:26 -0500)]
[rustc_builtin_macros] add indices to format_foreign::printf::Substitution::Escape

2 years agoAuto merge of #92175 - Aaron1011:fix-missing-source-file, r=cjgillot
bors [Fri, 31 Dec 2021 16:38:23 +0000 (16:38 +0000)]
Auto merge of #92175 - Aaron1011:fix-missing-source-file, r=cjgillot

Import `SourceFile`s from crate before decoding foreign `Span`

Fixes #92163
Fixes #92014

When writing to the incremental cache, we encode all `Span`s
we encounter, regardless of whether or not their `SourceFile`
comes from the local crate, or from a foreign crate.

When we decode a `Span`, we use the `StableSourceFileId` we encoded
to locate the matching `SourceFile` in the current session. If this
id corresponds to a `SourceFile` from another crate, then we need to
have already imported that `SourceFile` into our current session.

This usually happens automatically during resolution / macro expansion,
when we try to resolve definitions from other crates. In certain cases,
however, we may try to load a `Span` from a transitive dependency
without having ever imported the `SourceFile`s from that crate, leading
to an ICE.

This PR fixes the issue by enconding the `SourceFile`'s `CrateNum`
when we encode a `Span`. During decoding, we call `imported_source_files()`
when we encounter a foreign `CrateNum`, which ensure that all
`SourceFile`s from that crate are imported into the current session.

2 years agoRemove unused extern crate rustc_symbol_mangling
bjorn3 [Fri, 31 Dec 2021 15:57:33 +0000 (16:57 +0100)]
Remove unused extern crate rustc_symbol_mangling

2 years agoLock x.py build state
worldeva [Tue, 24 Aug 2021 20:45:46 +0000 (15:45 -0500)]
Lock x.py build state

Prevent spurious build failures and other bugs caused by parallel runs of
x.py. We back the lock with sqlite, so that we have a cross-platform locking
strategy, and which can be done nearly first in the build process (from Python),
which helps move the lock as early as possible.

2 years agoMerge commit '1411a98352ba6bee8ba3b0131c9243e5db1e6a2e' into sync_cg_clif-2021-12-31
bjorn3 [Fri, 31 Dec 2021 15:26:32 +0000 (16:26 +0100)]
Merge commit '1411a98352ba6bee8ba3b0131c9243e5db1e6a2e' into sync_cg_clif-2021-12-31

2 years agoAuto merge of #92252 - GuillaumeGomez:update-pulldown, r=camelid,xFrednet
bors [Fri, 31 Dec 2021 12:46:38 +0000 (12:46 +0000)]
Auto merge of #92252 - GuillaumeGomez:update-pulldown, r=camelid,xFrednet

Update pulldown-cmark version to 0.9

Fixes https://github.com/rust-lang/rust/issues/92206.

r? `@camelid`

2 years agoExtend check for UnsafeCell in consts to cover unions
Tomasz Miąsko [Thu, 28 Oct 2021 00:00:00 +0000 (00:00 +0000)]
Extend check for UnsafeCell in consts to cover unions

A validity companion to changes from #90373.

2 years agoAuto merge of #91929 - anuvratsingh:remove_in_band_lifetimes_compiler_rustc_traits...
bors [Fri, 31 Dec 2021 05:08:24 +0000 (05:08 +0000)]
Auto merge of #91929 - anuvratsingh:remove_in_band_lifetimes_compiler_rustc_traits, r=jackh726

Removed `in_band_lifetimes` from `rustc_traits`

Issue: [#91867](https://github.com/rust-lang/rust/issues/91867)

2 years agoUse SparseIntervalMatrix instead of SparseBitMatrix
Mark Rousskov [Fri, 5 Nov 2021 21:27:53 +0000 (17:27 -0400)]
Use SparseIntervalMatrix instead of SparseBitMatrix

Region inference contains several bitsets which are filled with large intervals
representing liveness. These can cause excessive memory usage, and are
relatively slow when growing to large sizes compared to the IntervalSet.

2 years agoIntroduce IntervalSet
Mark Rousskov [Fri, 5 Nov 2021 18:50:29 +0000 (14:50 -0400)]
Introduce IntervalSet

This is a compact, fast storage for variable-sized sets, typically consisting of
larger ranges. It is less efficient than a bitset if ranges are both small and
the domain size is small, but will still perform acceptably. With enormous
domain sizes and large ranges, the interval set performs much better, as it can
be much more densely packed in memory than the uncompressed bit set alternative.

2 years agoAuto merge of #92437 - flip1995:clippyup, r=Manishearth
bors [Fri, 31 Dec 2021 00:07:29 +0000 (00:07 +0000)]
Auto merge of #92437 - flip1995:clippyup, r=Manishearth

Update Clippy

r? `@Manishearth`

2 years agoAuto merge of #92426 - calebcartwright:sync-rustfmt-subtree, r=calebcartwright
bors [Thu, 30 Dec 2021 20:53:39 +0000 (20:53 +0000)]
Auto merge of #92426 - calebcartwright:sync-rustfmt-subtree, r=calebcartwright

Sync rustfmt subtree

r? `@ghost`

Mostly refactoring and a few minor lint fixes, along with a couple small bug fixes

2 years agoRemove needless allocation from example code of OsString
David Tolnay [Thu, 30 Dec 2021 20:45:02 +0000 (12:45 -0800)]
Remove needless allocation from example code of OsString

2 years agoFix some copy/paste hysteresis in OsString try_reserve docs
David Tolnay [Thu, 30 Dec 2021 20:40:51 +0000 (12:40 -0800)]
Fix some copy/paste hysteresis in OsString try_reserve docs

It appears `find_max_slow` comes from the BinaryHeap docs, where the
try_reserve example is a slow implementation of find_max. It has no
relevance to this code in OsString though.

2 years agoRemoved `in_band_lifetimes` from `rustc_traits`
Anuvrat [Tue, 14 Dec 2021 18:00:34 +0000 (23:30 +0530)]
Removed `in_band_lifetimes` from `rustc_traits`

2 years agoRemove unnecessary report_symbol_names call (#113)
bjorn3 [Thu, 30 Dec 2021 18:27:11 +0000 (19:27 +0100)]
Remove unnecessary report_symbol_names call (#113)

rustc_interface already calls it for you

2 years agoIgnore new failing test_is_sorted test
bjorn3 [Thu, 30 Dec 2021 17:16:04 +0000 (18:16 +0100)]
Ignore new failing test_is_sorted test

2 years agoDisable long running libcore tests
bjorn3 [Thu, 30 Dec 2021 16:50:52 +0000 (17:50 +0100)]
Disable long running libcore tests

These only finish in reasonable time with optimizations enabled.

This patch file is copied from cg_clif.

2 years agoDisable portable-simd test
bjorn3 [Thu, 30 Dec 2021 15:57:11 +0000 (16:57 +0100)]
Disable portable-simd test

Support for portable-simd isn't implemented yet

2 years agoAdd missing feature gate
bjorn3 [Thu, 30 Dec 2021 15:28:53 +0000 (16:28 +0100)]
Add missing feature gate

2 years agoFix display of toggles on mobile
Guillaume Gomez [Wed, 29 Dec 2021 17:54:33 +0000 (18:54 +0100)]
Fix display of toggles on mobile

2 years agoUpdate browser-ui-test version to have assert-position command
Guillaume Gomez [Thu, 30 Dec 2021 15:21:25 +0000 (16:21 +0100)]
Update browser-ui-test version to have assert-position command

2 years agoAuto merge of #92434 - matthiaskrgr:rollup-m8wuq0v, r=matthiaskrgr
bors [Thu, 30 Dec 2021 14:52:50 +0000 (14:52 +0000)]
Auto merge of #92434 - matthiaskrgr:rollup-m8wuq0v, r=matthiaskrgr

Rollup of 4 pull requests

Successful merges:

 - #91519 (ast: Avoid aborts on fatal errors thrown from mutable AST visitor)
 - #92414 (Fix spacing of pretty printed const item without body)
 - #92423 (Add UI test for #92292)
 - #92427 (Use `UnsafeCell::get_mut()` in `core::lazy::OnceCell::get_mut()`)

Failed merges:

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

2 years agoImport std::arch::asm
bjorn3 [Thu, 30 Dec 2021 14:36:30 +0000 (15:36 +0100)]
Import std::arch::asm

2 years agoRustup to rustc 1.59.0-nightly (78fd0f633 2021-12-29)
bjorn3 [Thu, 30 Dec 2021 14:26:08 +0000 (15:26 +0100)]
Rustup to rustc 1.59.0-nightly (78fd0f633 2021-12-29)

2 years agoSync from rust 65d8785f0a85d233e00fc84445f1aab451ec9f4f
bjorn3 [Thu, 30 Dec 2021 14:23:33 +0000 (15:23 +0100)]
Sync from rust 65d8785f0a85d233e00fc84445f1aab451ec9f4f

2 years agoMerge commit '0eff589afc83e21a03a168497bbab6b4dfbb4ef6' into clippyup
flip1995 [Thu, 30 Dec 2021 14:10:43 +0000 (15:10 +0100)]
Merge commit '0eff589afc83e21a03a168497bbab6b4dfbb4ef6' into clippyup

2 years agoMerge commit '40b00f4200fbdeefd11815398cb46394b8cb0a5e' into sync_cg_clif-2021-12-30
bjorn3 [Thu, 30 Dec 2021 13:53:41 +0000 (14:53 +0100)]
Merge commit '40b00f4200fbdeefd11815398cb46394b8cb0a5e' into sync_cg_clif-2021-12-30

2 years agoAuto merge of #8196 - flip1995:rustup, r=flip1995
bors [Thu, 30 Dec 2021 13:22:47 +0000 (13:22 +0000)]
Auto merge of #8196 - flip1995:rustup, r=flip1995

Rustup

r? `@ghost`

changelog: none

2 years agoBump nightly version -> 2021-12-30
flip1995 [Thu, 30 Dec 2021 13:18:01 +0000 (14:18 +0100)]
Bump nightly version -> 2021-12-30

2 years agoMerge remote-tracking branch 'upstream/master' into rustup
flip1995 [Thu, 30 Dec 2021 13:04:13 +0000 (14:04 +0100)]
Merge remote-tracking branch 'upstream/master' into rustup

2 years agoDisable incremental compilation on CI
bjorn3 [Thu, 30 Dec 2021 13:07:44 +0000 (14:07 +0100)]
Disable incremental compilation on CI

Fixes #1198

2 years agoRollup merge of #92427 - ChayimFriedman2:patch-1, r=kennytm
Matthias Krüger [Thu, 30 Dec 2021 12:12:36 +0000 (13:12 +0100)]
Rollup merge of #92427 - ChayimFriedman2:patch-1, r=kennytm

Use `UnsafeCell::get_mut()` in `core::lazy::OnceCell::get_mut()`

This removes one unnecessary `unsafe` block.

2 years agoRollup merge of #92423 - weirane:ui-92292, r=fee1-dead
Matthias Krüger [Thu, 30 Dec 2021 12:12:35 +0000 (13:12 +0100)]
Rollup merge of #92423 - weirane:ui-92292, r=fee1-dead

Add UI test for #92292

Closes #92292

2 years agoRollup merge of #92414 - dtolnay:constnoexpr, r=oli-obk
Matthias Krüger [Thu, 30 Dec 2021 12:12:34 +0000 (13:12 +0100)]
Rollup merge of #92414 - dtolnay:constnoexpr, r=oli-obk

Fix spacing of pretty printed const item without body

Follow-up to #92238 fixing one of the FIXMEs.

```rust
macro_rules! repro {
    ($item:item) => {
        stringify!($item)
    };
}

fn main() {
    println!("{}", repro!(extern "C" { static S: i32; }));
}
```

Before:&ensp;`extern "C" { static S: i32 ; }`
After:&ensp;`extern "C" { static S: i32; }`

2 years agoRollup merge of #91519 - petrochenkov:cratexp2, r=Aaron1011
Matthias Krüger [Thu, 30 Dec 2021 12:12:33 +0000 (13:12 +0100)]
Rollup merge of #91519 - petrochenkov:cratexp2, r=Aaron1011

ast: Avoid aborts on fatal errors thrown from mutable AST visitor

Set the node to some dummy value and rethrow the error instead.

When using the old aborting `visit_clobber` in `InvocationCollector::visit_crate` the next tests abort due to fatal errors:
```
ui\modules\path-invalid-form.rs
ui\modules\path-macro.rs
ui\modules\path-no-file-name.rs
ui\parser\issues\issue-5806.rs
ui\parser\mod_file_with_path_attr.rs
```

Follow up to https://github.com/rust-lang/rust/pull/91313.

2 years agoMove incr comp enable to the build system
bjorn3 [Thu, 30 Dec 2021 12:03:32 +0000 (13:03 +0100)]
Move incr comp enable to the build system

2 years agoDon't enable optimizations in the dev profile
bjorn3 [Thu, 30 Dec 2021 12:01:38 +0000 (13:01 +0100)]
Don't enable optimizations in the dev profile

I rarely use the dev profile anyway.

2 years agoFix dead code warning on windows
bjorn3 [Thu, 30 Dec 2021 11:56:45 +0000 (12:56 +0100)]
Fix dead code warning on windows

2 years agoOnly deny warnings for cg_clif build itself
bjorn3 [Thu, 30 Dec 2021 11:40:23 +0000 (12:40 +0100)]
Only deny warnings for cg_clif build itself

cc #1213

2 years agoAuto merge of #89336 - Aaron1011:variance-struct-diag, r=cjgillot
bors [Thu, 30 Dec 2021 11:34:24 +0000 (11:34 +0000)]
Auto merge of #89336 - Aaron1011:variance-struct-diag, r=cjgillot

Refactor variance diagnostics to work with more types

Instead of special-casing mutable pointers/references, we
now support general generic types (currently, we handle
`ty::Ref`, `ty::RawPtr`, and `ty::Adt`)

When a `ty::Adt` is involved, we show an additional note
explaining which of the type's generic parameters is
invariant (e.g. the `T` in `Cell<T>`). Currently, we don't
explain *why* a particular generic parameter ends up becoming
invariant. In the general case, this could require printing
a long 'backtrace' of types, so doing this would be
more suitable for a follow-up PR.

We still only handle the case where our variance switches
to `ty::Invariant`.

2 years agoRustup to rustc 1.59.0-nightly (78fd0f633 2021-12-29)
bjorn3 [Thu, 30 Dec 2021 11:23:45 +0000 (12:23 +0100)]
Rustup to rustc 1.59.0-nightly (78fd0f633 2021-12-29)

2 years agoAllow false positive unreachable code warning
bjorn3 [Thu, 30 Dec 2021 11:23:32 +0000 (12:23 +0100)]
Allow false positive unreachable code warning

2 years agoEnforce rustfmt on CI
bjorn3 [Thu, 30 Dec 2021 11:09:44 +0000 (12:09 +0100)]
Enforce rustfmt on CI

Fixes #1214

2 years agoRustfmt
bjorn3 [Thu, 30 Dec 2021 11:10:59 +0000 (12:10 +0100)]
Rustfmt

2 years agoDeny warnings on CI
bjorn3 [Thu, 30 Dec 2021 11:05:54 +0000 (12:05 +0100)]
Deny warnings on CI

Fixes #1213

2 years agoRename cargo executable to cargo-clif
bjorn3 [Thu, 30 Dec 2021 10:35:58 +0000 (11:35 +0100)]
Rename cargo executable to cargo-clif

This allows executing it like cargo clif build if you add it to your
PATH. It also fixes infinite recursion on Windows when invoking it as
Windows includes the current directory in PATH by default.

Fixes #971

2 years agoAuto merge of #92377 - compiler-errors:rustdoc-lifetimes, r=camelid,jyn514
bors [Thu, 30 Dec 2021 08:26:07 +0000 (08:26 +0000)]
Auto merge of #92377 - compiler-errors:rustdoc-lifetimes, r=camelid,jyn514

remove in_band_lifetimes from librustdoc

r? `@camelid`

closes #92368

2 years agoadd test for noop drop in landing pad
Erik Desjardins [Thu, 30 Dec 2021 06:03:17 +0000 (01:03 -0500)]
add test for noop drop in landing pad

2 years agokeep noinline for system llvm < 14
Erik Desjardins [Thu, 30 Dec 2021 04:19:55 +0000 (23:19 -0500)]
keep noinline for system llvm < 14

2 years agoUse `UnsafeCell::get_mut()` in `core::lazy::OnceCell::get_mut()`
Chayim Refael Friedman [Thu, 30 Dec 2021 03:04:44 +0000 (05:04 +0200)]
Use `UnsafeCell::get_mut()` in `core::lazy::OnceCell::get_mut()`

This removes one unnecessary `unsafe` block.

2 years agoAuto merge of #91125 - eskarn:llvm-passes-plugin-support, r=nagisa
bors [Thu, 30 Dec 2021 02:53:09 +0000 (02:53 +0000)]
Auto merge of #91125 - eskarn:llvm-passes-plugin-support, r=nagisa

Allow loading LLVM plugins with both legacy and new pass manager

Opening a draft PR to get feedback and start discussion on this feature. There is already a codegen option `passes` which allow giving a list of LLVM pass names, however we currently can't use a LLVM pass plugin (as described here : https://llvm.org/docs/WritingAnLLVMPass.html), the only available passes are the LLVM built-in ones.

The proposed modification would be to add another codegen option `pass-plugins`, which can be set with a list of paths to shared library files. These libraries are loaded using the LLVM function `PassPlugin::Load`, which calls the expected symbol `lvmGetPassPluginInfo`, and register the pipeline parsing and optimization callbacks.

An example usage with a single plugin and 3 passes would look like this in the `.cargo/config`:

```toml
rustflags = [
    "-C", "pass-plugins=/tmp/libLLVMPassPlugin",
    "-C", "passes=pass1 pass2 pass3",
]
```
This would give the same functionality as the opt LLVM tool directly integrated in rust build system.

Additionally, we can also not specify the `passes` option, and use a plugin which inserts passes in the optimization pipeline, as one could do using clang.

2 years agoMerge commit '4a053f206fd6799a25823c307f7d7f9d897be118' into sync-rustfmt-subtree
Caleb Cartwright [Thu, 30 Dec 2021 02:49:39 +0000 (20:49 -0600)]
Merge commit '4a053f206fd6799a25823c307f7d7f9d897be118' into sync-rustfmt-subtree

2 years agoAdd UI test for #92292
Wang Ruochen [Thu, 30 Dec 2021 00:04:44 +0000 (16:04 -0800)]
Add UI test for #92292

Closes #92292

2 years agoRefactor variance diagnostics to work with more types
Aaron Hill [Tue, 28 Sep 2021 01:22:44 +0000 (20:22 -0500)]
Refactor variance diagnostics to work with more types

Instead of special-casing mutable pointers/references, we
now support general generic types (currently, we handle
`ty::Ref`, `ty::RawPtr`, and `ty::Adt`)

When a `ty::Adt` is involved, we show an additional note
explaining which of the type's generic parameters is
invariant (e.g. the `T` in `Cell<T>`). Currently, we don't
explain *why* a particular generic parameter ends up becoming
invariant. In the general case, this could require printing
a long 'backtrace' of types, so doing this would be
more suitable for a follow-up PR.

We still only handle the case where our variance switches
to `ty::Invariant`.

2 years agoDo not flatten match arm block with leading attributes
David Lattimore [Wed, 29 Dec 2021 23:13:45 +0000 (10:13 +1100)]
Do not flatten match arm block with leading attributes

This is a backport of #4124.

Fixes #4109

2 years agoAuto merge of #88354 - Jmc18134:hint-space-pauth-opt, r=nagisa
bors [Wed, 29 Dec 2021 22:35:11 +0000 (22:35 +0000)]
Auto merge of #88354 - Jmc18134:hint-space-pauth-opt, r=nagisa

Add codegen option for branch protection and pointer authentication on AArch64

The branch-protection codegen option enables the use of hint-space pointer
authentication code for AArch64 targets.

2 years agoFix whitespace in pretty printed PatKind::Range
David Tolnay [Wed, 29 Dec 2021 20:51:10 +0000 (12:51 -0800)]
Fix whitespace in pretty printed PatKind::Range

2 years agoMark drop calls in landing pads cold instead of noinline
Erik Desjardins [Wed, 29 Dec 2021 20:28:31 +0000 (15:28 -0500)]
Mark drop calls in landing pads cold instead of noinline

Now that deferred inlining has been disabled in LLVM,
this shouldn't cause catastrophic size blowup.

2 years agoMove equal sign back into head ibox
David Tolnay [Wed, 29 Dec 2021 19:53:03 +0000 (11:53 -0800)]
Move equal sign back into head ibox

2 years agoFix spacing of pretty printed const item without body
David Tolnay [Wed, 29 Dec 2021 19:35:50 +0000 (11:35 -0800)]
Fix spacing of pretty printed const item without body

2 years agoAuto merge of #92244 - petrochenkov:alltraits, r=cjgillot
bors [Wed, 29 Dec 2021 19:22:33 +0000 (19:22 +0000)]
Auto merge of #92244 - petrochenkov:alltraits, r=cjgillot

rustc_metadata: Encode list of all crate's traits into metadata

While working on https://github.com/rust-lang/rust/pull/88679 I noticed that rustdoc is casually doing something quite expensive, something that is used only for error reporting in rustc - collecting all traits from all crates in the dependency tree.

This PR trades some minor extra time spent by metadata encoder in rustc for major gains for rustdoc (and for rustc runs with errors, which execute the `all_traits` query for better diagnostics).

2 years agoFix double space in pretty printed TryBlock
David Tolnay [Wed, 29 Dec 2021 19:13:33 +0000 (11:13 -0800)]
Fix double space in pretty printed TryBlock

2 years agoAuto merge of #92309 - ehuss:remove-check_lines, r=Mark-Simulacrum
bors [Wed, 29 Dec 2021 16:07:22 +0000 (16:07 +0000)]
Auto merge of #92309 - ehuss:remove-check_lines, r=Mark-Simulacrum

compiletest: Remove some vestigial code

The `check_lines` header is no longer parsed as a header, but instead inside the debuginfo tests. I believe this was changed in #13726.

2 years agoAdd a couple needs-asm-support headers to tests
bjorn3 [Wed, 29 Dec 2021 14:14:50 +0000 (15:14 +0100)]
Add a couple needs-asm-support headers to tests

This will allow them to be ignored by codegen backends that don't
support inline asm.

2 years agoAuto merge of #92397 - matthiaskrgr:rollup-xnfou17, r=matthiaskrgr
bors [Wed, 29 Dec 2021 12:07:33 +0000 (12:07 +0000)]
Auto merge of #92397 - matthiaskrgr:rollup-xnfou17, r=matthiaskrgr

Rollup of 7 pull requests

Successful merges:

 - #92075 (rustdoc: Only special case struct fields for intra-doc links, not enum variants)
 - #92118 (Parse and suggest moving where clauses after equals for type aliases)
 - #92237 (Visit expressions in-order when resolving pattern bindings)
 - #92340 (rustdoc: Start cleaning up search index generation)
 - #92351 (Add long error explanation for E0227)
 - #92371 (Remove pretty printer space inside block with only outer attrs)
 - #92372 (Print space after formal generic params in fn type)

Failed merges:

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

2 years agoRollup merge of #92372 - dtolnay:fntype, r=jackh726
Matthias Krüger [Wed, 29 Dec 2021 09:17:13 +0000 (10:17 +0100)]
Rollup merge of #92372 - dtolnay:fntype, r=jackh726

Print space after formal generic params in fn type

Follow-up to #92238 fixing one of the FIXMEs.

```rust
macro_rules! repro {
    ($ty:ty) => {
        stringify!($ty)
    };
}

fn main() {
    println!("{}", repro!(for<'a> fn(&'a u8)));
}
```

Before:&ensp;`for<'a>fn(&'a u8)`
After:&ensp;`for<'a> fn(&'a u8)`

The pretty printer's `print_formal_generic_params` already prints formal generic params correctly with a space, we just need to call it when printing BareFn types instead of reimplementing the printing incorrectly without a space.

https://github.com/rust-lang/rust/blob/83b15bfe1c15f325bc186ebfe3691b729ed59f2b/compiler/rustc_ast_pretty/src/pprust/state.rs#L1394-L1400

2 years agoRollup merge of #92371 - dtolnay:attrblock, r=oli-obk
Matthias Krüger [Wed, 29 Dec 2021 09:17:12 +0000 (10:17 +0100)]
Rollup merge of #92371 - dtolnay:attrblock, r=oli-obk

Remove pretty printer space inside block with only outer attrs

Follow-up to #92238 fixing one of the FIXMEs.

```rust
macro_rules! repro {
    ($expr:expr) => {
        stringify!($expr)
    };
}

fn main() {
    println!("{}", repro!(#[attr] {}));
}
```

Before:&ensp;`#[attr] { }`
After:&ensp;`#[attr] {}`

2 years agoRollup merge of #92351 - TmLev:master, r=GuillaumeGomez
Matthias Krüger [Wed, 29 Dec 2021 09:17:11 +0000 (10:17 +0100)]
Rollup merge of #92351 - TmLev:master, r=GuillaumeGomez

Add long error explanation for E0227

Part of the #61137.

2 years agoRollup merge of #92340 - camelid:search-index-cleanup, r=GuillaumeGomez
Matthias Krüger [Wed, 29 Dec 2021 09:17:11 +0000 (10:17 +0100)]
Rollup merge of #92340 - camelid:search-index-cleanup, r=GuillaumeGomez

rustdoc: Start cleaning up search index generation

I'm trying to simplify and clean up the code, partly to make #90779 easier.

r? `@GuillaumeGomez`

2 years agoRollup merge of #92237 - compiler-errors:issue-92100, r=cjgillot
Matthias Krüger [Wed, 29 Dec 2021 09:17:10 +0000 (10:17 +0100)]
Rollup merge of #92237 - compiler-errors:issue-92100, r=cjgillot

Visit expressions in-order when resolving pattern bindings

[edited:] Visit the pattern's sub-expressions before defining any bindings.

Otherwise, we might get into a case where a Lit/Range expression in a pattern has a qpath pointing to a Ident pattern that is defined after it, causing an ICE when lowering to HIR. I have a more detailed explanation in the issue linked.

Fixes #92100

2 years agoRollup merge of #92118 - jackh726:type-alias-position-error, r=petrochenkov
Matthias Krüger [Wed, 29 Dec 2021 09:17:08 +0000 (10:17 +0100)]
Rollup merge of #92118 - jackh726:type-alias-position-error, r=petrochenkov

Parse and suggest moving where clauses after equals for type aliases

~Mostly the same as #90076, but doesn't make any syntax changes.~ Whether or not we want to land the syntax changes, we should  parse the invalid where clause position and suggest moving.

r? `@nikomatsakis`
cc `@petrochenkov` you might have thoughts on implementation

2 years agoRollup merge of #92075 - jyn514:resolve-cleanup, r=camelid
Matthias Krüger [Wed, 29 Dec 2021 09:17:08 +0000 (10:17 +0100)]
Rollup merge of #92075 - jyn514:resolve-cleanup, r=camelid

rustdoc: Only special case struct fields for intra-doc links, not enum variants

Variants are already handled by `resolve_str_path_error`, rustdoc doesn't need to consider them separately. Thanks `@camelid` for catching this!

Eventually I'd like to fix the "combine this with `variant_field`" comment but that needs `resolve_field` to take a `ty_res` parameter to avoid it being super hacky (cc https://github.com/rust-lang/rust/issues/83761#issuecomment-813026026).

r? `@camelid`