]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agochange thir to lazily create constants
b-naber [Fri, 11 Mar 2022 11:07:53 +0000 (12:07 +0100)]
change thir to lazily create constants

2 years agoAuto merge of #95173 - m-ou-se:sys-locks-module, r=dtolnay
bors [Wed, 23 Mar 2022 06:01:48 +0000 (06:01 +0000)]
Auto merge of #95173 - m-ou-se:sys-locks-module, r=dtolnay

Move std::sys::{mutex, condvar, rwlock} to std::sys::locks.

This cleans up the the std::sys modules a bit by putting the locks in a single module called `locks` rather than spread over the three modules `mutex`, `condvar`, and `rwlock`. This makes it easier to organise lock implementations, which helps with https://github.com/rust-lang/rust/issues/93740.

2 years agoAuto merge of #95223 - Dylan-DPC:rollup-idpb7ka, r=Dylan-DPC
bors [Wed, 23 Mar 2022 03:31:20 +0000 (03:31 +0000)]
Auto merge of #95223 - Dylan-DPC:rollup-idpb7ka, r=Dylan-DPC

Rollup of 6 pull requests

Successful merges:

 - #91608 (Fold aarch64 feature +fp into +neon)
 - #92955 (add perf side effect docs to `Iterator::cloned()`)
 - #94713 (Add u16::is_utf16_surrogate)
 - #95212 (Replace `this.clone()` with `this.create_snapshot_for_diagnostic()`)
 - #95219 (Modernize `alloc-no-oom-handling` test)
 - #95222 (interpret/validity: improve clarity)

Failed merges:

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

2 years agoRollup merge of #95222 - RalfJung:validity, r=Dylan-DPC
Dylan DPC [Wed, 23 Mar 2022 02:05:34 +0000 (03:05 +0100)]
Rollup merge of #95222 - RalfJung:validity, r=Dylan-DPC

interpret/validity: improve clarity

I was confused by my own (ancient) comment in `validity.rs` so I figured I'd clarify. (And I don't think ZST-ness is relevant at all inside that branch, no idea where that comment comes from.)

Also `extend` seems more clear than `clone_from`.

2 years agoRollup merge of #95219 - ojeda:update-alloc-no-oom-handling-test, r=Dylan-DPC
Dylan DPC [Wed, 23 Mar 2022 02:05:33 +0000 (03:05 +0100)]
Rollup merge of #95219 - ojeda:update-alloc-no-oom-handling-test, r=Dylan-DPC

Modernize `alloc-no-oom-handling` test

  - The edition should be 2021 to avoid warnings.

  - The `external_crate` feature was removed in commit 45bf1ed1a112 ("rustc: Allow changing the default allocator").

    Note that commit d620ae10709c ("Auto merge of #84266") removed the old test, but the new one introduced passed the `--cfg` like in the old one.

Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
---

This is intended to align this test to the new `no_rc` and `no_sync` ones being added in https://github.com/rust-lang/rust/pull/89891, but it makes sense on its own too.

2 years agoRollup merge of #95212 - TaKO8Ki:replace-this-clone-with-this-create-snapshot-for...
Dylan DPC [Wed, 23 Mar 2022 02:05:32 +0000 (03:05 +0100)]
Rollup merge of #95212 - TaKO8Ki:replace-this-clone-with-this-create-snapshot-for-diagnostic, r=Dylan-DPC

Replace `this.clone()` with `this.create_snapshot_for_diagnostic()`

Use [`create_snapshot_for_diagnostic`](https://github.com/rust-lang/rust/blob/cd119057160cedea245aa2679add56723f3dc784/compiler/rustc_parse/src/parser/diagnostics.rs#L214-L223) I implemented in https://github.com/rust-lang/rust/pull/94731 instead of `this.clone()` to avoid duplicate errors about unclosed delims being emitted when the `Parser` is dropped.

2 years agoRollup merge of #94713 - clarfonthey:is_char_surrogate, r=scottmcm
Dylan DPC [Wed, 23 Mar 2022 02:05:31 +0000 (03:05 +0100)]
Rollup merge of #94713 - clarfonthey:is_char_surrogate, r=scottmcm

Add u16::is_utf16_surrogate

Right now, there are methods in the standard library for encoding and decoding UTF-16, but at least for the moment, there aren't any methods specifically for `u16` to help work with UTF-16 data. Since the full logic already exists, this wouldn't really add any code, just expose what's already there.

This method in particular is useful for working with the data returned by Windows `OsStrExt::encode_wide`. Initially, I was planning to also offer a `TryFrom<u16> for char`, but decided against it for now. There is plenty of code in rustc that could be rewritten to use this method, but I only checked within the standard library to replace them.

I think that offering more UTF-16-related methods to u16 would be useful, but I think this one is a good start. For example, one useful method might be `u16::is_pattern_whitespace`, which would check if something is the Unicode `Pattern_Whitespace` category. We can get away with this because all of the `Pattern_Whitespace` characters are in the basic multilingual plane, and hence we don't need to check for surrogates.

2 years agoRollup merge of #92955 - llogiq:cloned-side-effect-doc, r=yaahc
Dylan DPC [Wed, 23 Mar 2022 02:05:28 +0000 (03:05 +0100)]
Rollup merge of #92955 - llogiq:cloned-side-effect-doc, r=yaahc

add perf side effect docs to `Iterator::cloned()`

Now that #90209 has been closed, as the current state of affairs is neither here nor there, this at least adds a paragraph + example on what to expect performance-wise and how to deal with it to the .cloned() docs.

cc `@the8472`

2 years agoRollup merge of #91608 - workingjubilee:fold-neon-fp, r=nagisa,Amanieu
Dylan DPC [Wed, 23 Mar 2022 02:05:28 +0000 (03:05 +0100)]
Rollup merge of #91608 - workingjubilee:fold-neon-fp, r=nagisa,Amanieu

Fold aarch64 feature +fp into +neon

Arm's FEAT_FP and Feat_AdvSIMD describe the same thing on AArch64:
The Neon unit, which handles both floating point and SIMD instructions.
Moreover, a configuration for AArch64 must include both or neither.
Arm says "entirely proprietary" toolchains may omit floating point:
https://developer.arm.com/documentation/102374/0101/Data-processing---floating-point
In the Programmer's Guide for Armv8-A, Arm says AArch64 can have
both FP and Neon or neither in custom implementations:
https://developer.arm.com/documentation/den0024/a/AArch64-Floating-point-and-NEON

In "Bare metal boot code for Armv8-A", enabling Neon and FP
is just disabling the same trap flag:
https://developer.arm.com/documentation/dai0527/a

In an unlikely future where "Neon and FP" become unrelated,
we can add "[+-]fp" as its own feature flag.
Until then, we can simplify programming with Rust on AArch64 by
folding both into "[+-]neon", which is valid as it supersets both.

"[+-]neon" is retained for niche uses such as firmware, kernels,
"I just hate floats", and so on.

I am... pretty sure no one is relying on this.

An argument could be made that, as we are not an "entirely proprietary" toolchain, we should not support AArch64 without floats at all. I think that's a bit excessive. However, I want to recognize the intent: programming for AArch64 should be simplified where possible. For x86-64, programmers regularly set up illegal feature configurations because it's hard to understand them, see https://github.com/rust-lang/rust/issues/89586. And per the above notes, plus the discussion in https://github.com/rust-lang/rust/issues/86941, there should be no real use cases for leaving these features split: the two should in fact always go together.

- Fixes rust-lang/rust#95002.
- Fixes rust-lang/rust#95064.
- Fixes rust-lang/rust#95122.

2 years agoFixup aarch64 smoke test
Jubilee Young [Wed, 23 Mar 2022 01:11:21 +0000 (18:11 -0700)]
Fixup aarch64 smoke test

2 years agoAuto merge of #95088 - bjorn3:fix_test_variadic_fnptr, r=dtolnay
bors [Wed, 23 Mar 2022 00:50:33 +0000 (00:50 +0000)]
Auto merge of #95088 - bjorn3:fix_test_variadic_fnptr, r=dtolnay

Don't declare test_variadic_fnptr with two conflicting signatures

It is UB for LLVM and results in a compile error for Cranelift.

cc https://github.com/bjorn3/rustc_codegen_cranelift/issues/806
Fixes https://github.com/rust-lang/rust/issues/66690

2 years agointerpret/validity: improve clarity
Ralf Jung [Tue, 22 Mar 2022 22:58:23 +0000 (18:58 -0400)]
interpret/validity: improve clarity

2 years agoTest SVE2 includes NEON and not vice versa
Jubilee Young [Tue, 22 Mar 2022 22:03:59 +0000 (15:03 -0700)]
Test SVE2 includes NEON and not vice versa

Required by https://github.com/rust-lang/rust/issues/95122

2 years agoTest NEON compiles
Jubilee Young [Tue, 22 Mar 2022 21:24:59 +0000 (14:24 -0700)]
Test NEON compiles

Required by https://github.com/rust-lang/rust/issues/95002

2 years agoFilter for all features instead of any
Jubilee Young [Sun, 20 Mar 2022 02:36:42 +0000 (19:36 -0700)]
Filter for all features instead of any

Adds regression tests for feature logic
Co-authored-by: bjorn3 <bjorn3@users.noreply.github.com>
Co-authored-by: Simonas Kazlauskas <git@kazlauskas.me>
2 years agoFold aarch64 feature +fp into +neon
Jubilee Young [Sat, 4 Dec 2021 01:56:59 +0000 (17:56 -0800)]
Fold aarch64 feature +fp into +neon

Arm's FEAT_FP and Feat_AdvSIMD describe the same thing on AArch64:
The Neon unit, which handles both floating point and SIMD instructions.
Moreover, a configuration for AArch64 must include both or neither.
Arm says "entirely proprietary" toolchains may omit floating point:
https://developer.arm.com/documentation/102374/0101/Data-processing---floating-point
In the Programmer's Guide for Armv8-A, Arm says AArch64 can have
both FP and Neon or neither in custom implementations:
https://developer.arm.com/documentation/den0024/a/AArch64-Floating-point-and-NEON

In "Bare metal boot code for Armv8-A", enabling Neon and FP
is just disabling the same trap flag:
https://developer.arm.com/documentation/dai0527/a

In an unlikely future where "Neon and FP" become unrelated,
we can add "[+-]fp" as its own feature flag.
Until then, we can simplify programming with Rust on AArch64 by
folding both into "[+-]neon", which is valid as it supersets both.

"[+-]neon" is retained for niche uses such as firmware, kernels,
"I just hate floats", and so on.

2 years agoAuto merge of #95159 - nnethercote:TtParser, r=petrochenkov
bors [Tue, 22 Mar 2022 21:46:57 +0000 (21:46 +0000)]
Auto merge of #95159 - nnethercote:TtParser, r=petrochenkov

Introduce `TtParser`

These commits make a number of changes to declarative macro expansion, resulting in code that is shorter, simpler, and faster.

Best reviewed one commit at a time.

r? `@petrochenkov`

2 years agoLimit test_variadic_fnptr to unix
bjorn3 [Tue, 22 Mar 2022 21:27:13 +0000 (22:27 +0100)]
Limit test_variadic_fnptr to unix

2 years agoModernize `alloc-no-oom-handling` test
Miguel Ojeda [Tue, 22 Mar 2022 20:44:58 +0000 (21:44 +0100)]
Modernize `alloc-no-oom-handling` test

  - The edition should be 2021 to avoid warnings.

  - The `external_crate` feature was removed in commit 45bf1ed1a112
    ("rustc: Allow changing the default allocator").

    Note that commit d620ae10709c ("Auto merge of #84266") removed
    the old test, but the new one introduced passed the `--cfg` like
    in the old one.

Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2 years agoEliminate `TokenTreeOrTokenTreeSlice`.
Nicholas Nethercote [Sat, 19 Mar 2022 05:20:07 +0000 (16:20 +1100)]
Eliminate `TokenTreeOrTokenTreeSlice`.

As its name suggests, `TokenTreeOrTokenTreeSlice` is either a single
`TokenTree` or a slice of them. It has methods `len` and `get_tt` that
let it be treated much like an ordinary slice. The reason it isn't an
ordinary slice is that for `TokenTree::Delimited` the open and close
delimiters are represented implicitly, and when they are needed they are
constructed on the fly with `Delimited::{open,close}_tt`, rather than
being present in memory.

This commit changes `Delimited` so the open and close delimiters are
represented explicitly. As a result, `TokenTreeOrTokenTreeSlice` is no
longer needed and `MatcherPos` and `MatcherTtFrame` can just use an
ordinary slice. `TokenTree::{len,get_tt}` are also removed, because they
were only needed to support `TokenTreeOrTokenTreeSlice`.

The change makes the code shorter and a little bit faster on benchmarks
that use macro expansion heavily, partly because `MatcherPos` is a lot
smaller (less data to `memcpy`) and partly because ordinary slice
operations are faster than `TokenTreeOrTokenTreeSlice::{len,get_tt}`.

2 years agoAuto merge of #95215 - Dylan-DPC:rollup-l9f9t7l, r=Dylan-DPC
bors [Tue, 22 Mar 2022 19:06:04 +0000 (19:06 +0000)]
Auto merge of #95215 - Dylan-DPC:rollup-l9f9t7l, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #95188 ([`macro-metavar-expr`] Fix generated tokens hygiene)
 - #95196 (rename LocalState::Uninitialized to Unallocated)
 - #95197 (Suggest constraining param for unary ops when missing trait impl)
 - #95200 (Cancel a not emitted error after parsing const generic args)
 - #95207 (update Termination trait docs)

Failed merges:

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

2 years agoRollup merge of #95207 - ZHANGWENTAI:update_termination_doc, r=yaahc
Dylan DPC [Tue, 22 Mar 2022 18:07:37 +0000 (19:07 +0100)]
Rollup merge of #95207 - ZHANGWENTAI:update_termination_doc, r=yaahc

update Termination trait docs

this pr add some statement about intending to provide `Termination` trait only on standard library's runtime.

from #93448

r? `@Lokathor`

2 years agoRollup merge of #95200 - TaKO8Ki:cancel-not-emitted-error-when-parsing-generic-arg...
Dylan DPC [Tue, 22 Mar 2022 18:07:36 +0000 (19:07 +0100)]
Rollup merge of #95200 - TaKO8Ki:cancel-not-emitted-error-when-parsing-generic-arg, r=oli-obk

Cancel a not emitted error after parsing const generic args

closes #95163

2 years agoRollup merge of #95197 - frank-king:feat/unary_op_type_constrain, r=petrochenkov
Dylan DPC [Tue, 22 Mar 2022 18:07:35 +0000 (19:07 +0100)]
Rollup merge of #95197 - frank-king:feat/unary_op_type_constrain, r=petrochenkov

Suggest constraining param for unary ops when missing trait impl

This PR adds a suggestion of constraining param for unary ops `-` and `!` when the corresponding trait implementation
is missing.

Fixs #94543.

BTW, this is my first time to touch rustc, please correct me if I did anything wrong.

2 years agoRollup merge of #95196 - RalfJung:unalloc-not-uninit, r=oli-obk
Dylan DPC [Tue, 22 Mar 2022 18:07:34 +0000 (19:07 +0100)]
Rollup merge of #95196 - RalfJung:unalloc-not-uninit, r=oli-obk

rename LocalState::Uninitialized to Unallocated

This is to avoid confusion with `Uninit` as in `ScalarMaybeUninit`, which is very different.

r? `@oli-obk`

2 years agoRollup merge of #95188 - c410-f3r:aqui-vamos-nos, r=petrochenkov
Dylan DPC [Tue, 22 Mar 2022 18:07:33 +0000 (19:07 +0100)]
Rollup merge of #95188 - c410-f3r:aqui-vamos-nos, r=petrochenkov

[`macro-metavar-expr`] Fix generated tokens hygiene

Only uses `Marker` on generated tokens -> https://github.com/rust-lang/rust/issues/83527#issuecomment-1074439425)

I really don't know how to test this PR

r? `@petrochenkov`

2 years agoadd perf side effect docs to `Iterator::cloned()`
Andre Bogus [Sun, 16 Jan 2022 00:33:19 +0000 (01:33 +0100)]
add perf side effect docs to `Iterator::cloned()`

2 years agoMove std::sys::{mutex, condvar, rwlock} to std::sys::locks.
Mara Bos [Mon, 21 Mar 2022 14:45:51 +0000 (15:45 +0100)]
Move std::sys::{mutex, condvar, rwlock} to std::sys::locks.

2 years agoreplace `this.clone()` with `this.create_snapshot_for_diagnostic()`
Takayuki Maeda [Tue, 22 Mar 2022 16:26:34 +0000 (01:26 +0900)]
replace `this.clone()` with `this.create_snapshot_for_diagnostic()`

2 years agoAuto merge of #94693 - nnethercote:parser-inlining, r=petrochenkov
bors [Tue, 22 Mar 2022 16:24:50 +0000 (16:24 +0000)]
Auto merge of #94693 - nnethercote:parser-inlining, r=petrochenkov

Inline some parser functions

Some crates that do a lot of complex declarative macro expansion spend a lot of time parsing (and reparsing) tokens. These commits inline some functions for some minor speed wins.

r? `@ghost`

2 years agoadd some fix
ZHANGWENTAI [Tue, 22 Mar 2022 15:33:08 +0000 (23:33 +0800)]
add some fix

Signed-off-by: ZHANGWENTAI <2092913428@qq.com>
2 years agofix the lint problem
ZHANGWENTAI [Tue, 22 Mar 2022 15:10:00 +0000 (23:10 +0800)]
fix the lint problem

Signed-off-by: ZHANGWENTAI <2092913428@qq.com>
2 years agoupdate Termination trait docs
ZHANGWENTAI [Tue, 22 Mar 2022 14:37:17 +0000 (22:37 +0800)]
update Termination trait docs

2 years agoAuto merge of #95107 - r00ster91:fmt, r=joshtriplett
bors [Tue, 22 Mar 2022 08:47:16 +0000 (08:47 +0000)]
Auto merge of #95107 - r00ster91:fmt, r=joshtriplett

Improve formatting in macro

CC `@dtolnay`

2 years agocancel a not emitted error after parsing const generic args
Takayuki Maeda [Tue, 22 Mar 2022 07:06:56 +0000 (16:06 +0900)]
cancel a not emitted error after parsing const generic args

2 years agoAuto merge of #95158 - sunfishcode:sunfishcode/windows-8, r=joshtriplett
bors [Tue, 22 Mar 2022 05:48:49 +0000 (05:48 +0000)]
Auto merge of #95158 - sunfishcode:sunfishcode/windows-8, r=joshtriplett

Preserve the Windows `GetLastError` error in `HandleOrInvalid`.

In the `TryFrom<HandleOrInvalid> for OwnedHandle` and
`TryFrom<HandleOrNull> for OwnedHandle` implemenations, `forget` the
owned handle on the error path, to avoid calling `CloseHandle` on an
invalid handle. It's harmless, except that it may overwrite the
thread's `GetLastError` error.

r? `@joshtriplett`

2 years agosuggest constraining param for unary ops when missing trait impl
Frank King [Tue, 22 Mar 2022 04:17:30 +0000 (12:17 +0800)]
suggest constraining param for unary ops when missing trait impl

2 years agoAuto merge of #95127 - notriddle:notriddle/option-content-move-from-tuple-match,...
bors [Tue, 22 Mar 2022 03:08:01 +0000 (03:08 +0000)]
Auto merge of #95127 - notriddle:notriddle/option-content-move-from-tuple-match, r=estebank

diagnostics: do not give Option::as_ref suggestion for complex match

Fixes #82528

2 years agoAdd u16::is_utf16_surrogate
ltdk [Mon, 7 Mar 2022 21:36:13 +0000 (16:36 -0500)]
Add u16::is_utf16_surrogate

2 years agorename LocalState::Uninitialized to Unallocated
Ralf Jung [Tue, 22 Mar 2022 02:33:23 +0000 (22:33 -0400)]
rename LocalState::Uninitialized to Unallocated

2 years agoAuto merge of #95161 - JakobDegen:fix-early-otherwise-branch, r=wesleywiser
bors [Tue, 22 Mar 2022 00:26:06 +0000 (00:26 +0000)]
Auto merge of #95161 - JakobDegen:fix-early-otherwise-branch, r=wesleywiser

Disable almost certainly unsound early otherwise branch MIR opt

Originally thought this was just an MIR semantics issue, but it's not.

r? rust-lang/mir-opt

2 years agoSplit `TokenCursor::{next,next_desugared}` into inlined and non-inlined halves.
Nicholas Nethercote [Mon, 7 Mar 2022 04:55:39 +0000 (15:55 +1100)]
Split `TokenCursor::{next,next_desugared}` into inlined and non-inlined halves.

2 years agoSplit `Parser::bump_with` into inlined and non-inlined halves.
Nicholas Nethercote [Mon, 7 Mar 2022 04:17:38 +0000 (15:17 +1100)]
Split `Parser::bump_with` into inlined and non-inlined halves.

The call site within `Parser::bump` is hot.

Also add an inline annotation to `Parser::next_tok`. It was already
being inlined by the compiler; this just makes sure that continues.

2 years agoFix generated tokens hygiene
Caio [Mon, 21 Mar 2022 22:45:55 +0000 (19:45 -0300)]
Fix generated tokens hygiene

2 years agoAuto merge of #95180 - matthiaskrgr:rollup-ai1ch2s, r=matthiaskrgr
bors [Mon, 21 Mar 2022 19:23:00 +0000 (19:23 +0000)]
Auto merge of #95180 - matthiaskrgr:rollup-ai1ch2s, r=matthiaskrgr

Rollup of 6 pull requests

Successful merges:

 - #95074 (Refactor: use `format-args-capture` and remove unnecessary nested if blocks in some parts of `rust_passes`)
 - #95085 (Return err instead of ICE)
 - #95116 (Add needs-* directives to many tests)
 - #95129 (Remove animation on source sidebar)
 - #95166 (Update the unstable book with the new `values()` form of check-cfg)
 - #95175 (move `adt_const_params`  to its own tracking issue)

Failed merges:

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

2 years agoRollup merge of #95175 - lcnr:adt_const_params-tracking-issue, r=Dylan-DPC
Matthias Krüger [Mon, 21 Mar 2022 18:48:35 +0000 (19:48 +0100)]
Rollup merge of #95175 - lcnr:adt_const_params-tracking-issue, r=Dylan-DPC

move `adt_const_params`  to its own tracking issue

the new tracking issue is  #95174

r? ``@rust-lang/project-const-generics``

2 years agoRollup merge of #95166 - Urgau:check-cfg-values-unstable-book, r=petrochenkov
Matthias Krüger [Mon, 21 Mar 2022 18:48:34 +0000 (19:48 +0100)]
Rollup merge of #95166 - Urgau:check-cfg-values-unstable-book, r=petrochenkov

Update the unstable book with the new `values()` form of check-cfg

Forgot to update the unstable book in https://github.com/rust-lang/rust/pull/94362

r? ``@petrochenkov``

2 years agoRollup merge of #95129 - GuillaumeGomez:rm-source-sidebar-animation, r=jsha
Matthias Krüger [Mon, 21 Mar 2022 18:48:33 +0000 (19:48 +0100)]
Rollup merge of #95129 - GuillaumeGomez:rm-source-sidebar-animation, r=jsha

Remove animation on source sidebar

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

Didn't upload a demo considering how simple it is to test in a browser. :)

r? ``@jsha``

2 years agoRollup merge of #95116 - bjorn3:cg_clif_test_fixes, r=Dylan-DPC
Matthias Krüger [Mon, 21 Mar 2022 18:48:32 +0000 (19:48 +0100)]
Rollup merge of #95116 - bjorn3:cg_clif_test_fixes, r=Dylan-DPC

Add needs-* directives to many tests

These are necessary to ignore tests that need features unsupported by cg_clif.

2 years agoRollup merge of #95085 - ouz-a:master5, r=jackh726
Matthias Krüger [Mon, 21 Mar 2022 18:48:31 +0000 (19:48 +0100)]
Rollup merge of #95085 - ouz-a:master5, r=jackh726

Return err instead of ICE

Having `escaping_bound_vars` results in ICE when trying to create `ty::Binder::dummy`, to avoid it we return err like the line above. I think this requires a more sophisticated fix, I would love to investigate if mentorship is available 🤓

Fixes #95023 and #85350

2 years agoRollup merge of #95074 - TaKO8Ki:use-format-args-capture-and-remove-unnecessary-nesti...
Matthias Krüger [Mon, 21 Mar 2022 18:48:30 +0000 (19:48 +0100)]
Rollup merge of #95074 - TaKO8Ki:use-format-args-capture-and-remove-unnecessary-nesting-in-rustc-passes, r=lcnr

Refactor: use `format-args-capture` and remove unnecessary nested if blocks in some parts of `rust_passes`

2 years agoAdd needs-asm-support directive to tests where necessary
bjorn3 [Sat, 19 Mar 2022 15:50:24 +0000 (16:50 +0100)]
Add needs-asm-support directive to tests where necessary

2 years agoReturn err instead of ICE
ouz-a [Fri, 18 Mar 2022 19:04:01 +0000 (22:04 +0300)]
Return err instead of ICE

2 years agomove `adt_const_params` to its own tracking issue
lcnr [Mon, 21 Mar 2022 15:33:15 +0000 (16:33 +0100)]
move `adt_const_params`  to its own tracking issue

2 years agoAuto merge of #95169 - Smittyvb:union-test-ub, r=bjorn3
bors [Mon, 21 Mar 2022 15:17:08 +0000 (15:17 +0000)]
Auto merge of #95169 - Smittyvb:union-test-ub, r=bjorn3

Don't run UB in test suite

This splits `ui/unsafe/union.rs` to make it so only the non-UB parts are run. It also means we can do more testing of the location of error messages (which are a bit different with the THIR unsafety checker). `union-modification.rs` has no UB (according to Miri), and `union.rs` has errors (but would have UB if not for those errors).

Closes #95075.
r? `@bjorn3`

2 years agouse `format-args-capture` and remove unnecessary nested if blocks in some parts of...
Takayuki Maeda [Fri, 18 Mar 2022 13:48:21 +0000 (22:48 +0900)]
use `format-args-capture` and remove unnecessary nested if blocks in some parts of rustc_passes

break before the `&&`

Update compiler/rustc_passes/src/check_const.rs

Co-authored-by: bjorn3 <bjorn3@users.noreply.github.com>
2 years agoMove pthread locks to own module.
Mara Bos [Thu, 17 Mar 2022 11:28:31 +0000 (12:28 +0100)]
Move pthread locks to own module.

2 years agoDon't run UB in test suite
Smitty [Mon, 21 Mar 2022 13:32:26 +0000 (09:32 -0400)]
Don't run UB in test suite

This splits ui/unsafe/union.rs to make it so only the non-UB parts are
run. It also means we can do more testing of the location of error
messages.

2 years agoUpdate unstable book with the new `values()` form for check-cfg
Loïc BRANSTETT [Mon, 21 Mar 2022 11:59:46 +0000 (12:59 +0100)]
Update unstable book with the new `values()` form for check-cfg

2 years agoDisable early otherwise branch MIR opt
Jakob Degen [Mon, 21 Mar 2022 02:43:31 +0000 (22:43 -0400)]
Disable early otherwise branch MIR opt

2 years agoAuto merge of #95104 - compiler-errors:remove-ascription, r=davidtwco
bors [Mon, 21 Mar 2022 02:29:55 +0000 (02:29 +0000)]
Auto merge of #95104 - compiler-errors:remove-ascription, r=davidtwco

suggest removing type ascription in bad parsing position

Not sure how to test this with the non-nightly suggestion. Didn't add a new UI test because it already manifests in an existing UI test.

Fixes #95014

2 years agoAuto merge of #95156 - audunhalland:fix-rustc_const_eval_transform-comments, r=Dylan-DPC
bors [Mon, 21 Mar 2022 00:14:29 +0000 (00:14 +0000)]
Auto merge of #95156 - audunhalland:fix-rustc_const_eval_transform-comments, r=Dylan-DPC

fix two comments referring to moved code (now rustc_mir_transform::generator)

This caused me some confusion when trying to find the related code.

2 years agoMove items into `TtParser` as `Vec`s.
Nicholas Nethercote [Fri, 18 Mar 2022 22:53:41 +0000 (09:53 +1100)]
Move items into `TtParser` as `Vec`s.

By putting them in `TtParser`, we can reuse them for every rule in a
macro. With that done, they can be `SmallVec` instead of `Vec`, and this
is a performance win because these vectors are hot and `SmallVec`
operations are a bit slower due to always needing an "inline or heap?"
check.

2 years agoRemove `MatcherPosHandle`.
Nicholas Nethercote [Fri, 18 Mar 2022 21:56:24 +0000 (08:56 +1100)]
Remove `MatcherPosHandle`.

This type was a small performance win for `html5ever`, which uses a
macro with hundreds of very simple rules that don't contain any
metavariables. But this type is complicated (extra lifetimes) and
perf-neutral for macros that do have metavariables.

This commit removes `MatcherPosHandle`, simplifying things a lot. This
increases the allocation rate for `html5ever` and similar cases a bit,
but makes things easier for follow-up changes that will improve
performance more than what we lost here.

2 years agoAdd a testcase.
Dan Gohman [Sun, 20 Mar 2022 22:54:03 +0000 (15:54 -0700)]
Add a testcase.

2 years agoPreserve the Windows `GetLastError` error in `HandleOrInvalid`.
Dan Gohman [Sun, 20 Mar 2022 22:37:31 +0000 (15:37 -0700)]
Preserve the Windows `GetLastError` error in `HandleOrInvalid`.

In the `TryFrom<HandleOrInvalid> for OwnedHandle` and
`TryFrom<HandleOrNull> for OwnedHandle` implemenations, `forget` the
owned handle on the error path, to avoid calling `CloseHandle` on an
invalid handle. It's harmless, except that it may overwrite the
thread's `GetLastError` error.

2 years agofix two comments referring to moved code (rustc_mir_transform::generator)
Audun Halland [Sun, 20 Mar 2022 22:31:04 +0000 (23:31 +0100)]
fix two comments referring to moved code (rustc_mir_transform::generator)

2 years agoAuto merge of #95148 - matthiaskrgr:rollup-jsb1ld9, r=matthiaskrgr
bors [Sun, 20 Mar 2022 21:36:57 +0000 (21:36 +0000)]
Auto merge of #95148 - matthiaskrgr:rollup-jsb1ld9, r=matthiaskrgr

Rollup of 4 pull requests

Successful merges:

 - #95114 (Skip a test if symlink creation is not possible)
 - #95131 (Fix docs for default rmeta filename.)
 - #95135 (Fix a not emitted unmatched angle bracket error)
 - #95145 (Fix typo interator->iterator)

Failed merges:

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

2 years agoDon't declare test_variadic_fnptr with two conflicting signatures
bjorn3 [Fri, 18 Mar 2022 19:34:27 +0000 (20:34 +0100)]
Don't declare test_variadic_fnptr with two conflicting signatures

It is UB for LLVM and results in a compile error for Cranelift

2 years agoRollup merge of #95145 - ChayimFriedman2:patch-1, r=Dylan-DPC
Matthias Krüger [Sun, 20 Mar 2022 19:42:46 +0000 (20:42 +0100)]
Rollup merge of #95145 - ChayimFriedman2:patch-1, r=Dylan-DPC

Fix typo interator->iterator

2 years agoRollup merge of #95135 - TaKO8Ki:fix-not-emitted-unmatched-angle-bracket-error, r...
Matthias Krüger [Sun, 20 Mar 2022 19:42:45 +0000 (20:42 +0100)]
Rollup merge of #95135 - TaKO8Ki:fix-not-emitted-unmatched-angle-bracket-error, r=Dylan-DPC

Fix a not emitted unmatched angle bracket error

closes #95128

2 years agoRollup merge of #95131 - ehuss:fix-metadata-filename, r=bjorn3
Matthias Krüger [Sun, 20 Mar 2022 19:42:44 +0000 (20:42 +0100)]
Rollup merge of #95131 - ehuss:fix-metadata-filename, r=bjorn3

Fix docs for default rmeta filename.

The docs for the default filename for `--emit=metadata` was wrong, it was missing the `lib` prefix.  The current implementation for that default is [here](https://github.com/rust-lang/rust/blob/f2661cfe341f88bea919daf52a07015dceaf7a6a/compiler/rustc_session/src/output.rs#L140).  Perhaps somewhat confusing, but `lib` is used for all crate types.

cc https://github.com/rust-lang/rust/issues/68839#issuecomment-1073118716

2 years agoRollup merge of #95114 - ChrisDenton:symlink-test, r=the8472
Matthias Krüger [Sun, 20 Mar 2022 19:42:43 +0000 (20:42 +0100)]
Rollup merge of #95114 - ChrisDenton:symlink-test, r=the8472

Skip a test if symlink creation is not possible

If someone running tests on Windows does not have Developer Mode enabled then creating symlinks will fail which in turn would cause this test to fail. This can be a stumbling block for contributors.

2 years agoAuto merge of #95144 - RalfJung:miri, r=RalfJung
bors [Sun, 20 Mar 2022 19:10:06 +0000 (19:10 +0000)]
Auto merge of #95144 - RalfJung:miri, r=RalfJung

update Miri

2 years agoFix typo interator->iterator
Chayim Refael Friedman [Sun, 20 Mar 2022 18:52:22 +0000 (20:52 +0200)]
Fix typo interator->iterator

2 years agoupdate Miri
Ralf Jung [Sun, 20 Mar 2022 18:30:40 +0000 (14:30 -0400)]
update Miri

2 years agoAuto merge of #95142 - bjorn3:sync_cg_clif-2022-03-20, r=bjorn3
bors [Sun, 20 Mar 2022 16:29:16 +0000 (16:29 +0000)]
Auto merge of #95142 - bjorn3:sync_cg_clif-2022-03-20, r=bjorn3

Sync rustc_codegen_cranelift

r? `@ghost`

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

2 years agoAdd once_cell as allowed cg_clif dependency
bjorn3 [Sun, 20 Mar 2022 16:01:32 +0000 (17:01 +0100)]
Add once_cell as allowed cg_clif dependency

2 years agoMerge commit '370c397ec9169809e5ad270079712e0043514240' into sync_cg_clif-2022-03-20
bjorn3 [Sun, 20 Mar 2022 15:55:21 +0000 (16:55 +0100)]
Merge commit '370c397ec9169809e5ad270079712e0043514240' into sync_cg_clif-2022-03-20

2 years agoAuto merge of #95071 - RalfJung:arbitrary-self-dyn, r=oli-obk
bors [Sun, 20 Mar 2022 13:48:23 +0000 (13:48 +0000)]
Auto merge of #95071 - RalfJung:arbitrary-self-dyn, r=oli-obk

Miri: implement arbitrary-self dyn receivers

Roughly follows the [codegen logic](https://github.com/rust-lang/rust/blob/851fcc7a54262748b1aa9e16de91453998d896f3/compiler/rustc_codegen_ssa/src/mir/block.rs#L809).

Fixes https://github.com/rust-lang/miri/issues/1038
r? `@oli-obk` Cc `@eddyb`

2 years agofix a not emitted unmatched angle bracket error
Takayuki Maeda [Sun, 20 Mar 2022 13:39:15 +0000 (22:39 +0900)]
fix a not emitted unmatched angle bracket error

2 years agoAuto merge of #92962 - frank-king:btree_entry_no_insert, r=Amanieu
bors [Sun, 20 Mar 2022 11:20:26 +0000 (11:20 +0000)]
Auto merge of #92962 - frank-king:btree_entry_no_insert, r=Amanieu

BTreeMap::entry: Avoid allocating if no insertion

This PR allows the `VacantEntry` to borrow from an empty tree with no root, and to lazily allocate a new root node when the user calls `.insert(value)`.

2 years agoRun part of the simd test suite
bjorn3 [Sat, 19 Mar 2022 15:32:07 +0000 (16:32 +0100)]
Run part of the simd test suite

2 years agoIgnore rustc tests with needs-unwind directive
bjorn3 [Sat, 19 Mar 2022 15:11:53 +0000 (16:11 +0100)]
Ignore rustc tests with needs-unwind directive

2 years agoMove test and clarify problem of some other tests
bjorn3 [Sat, 19 Mar 2022 14:48:19 +0000 (15:48 +0100)]
Move test and clarify problem of some other tests

2 years agoWrap write_mir_fn call in with_no_trimmed_paths!()
bjorn3 [Sat, 19 Mar 2022 15:54:51 +0000 (16:54 +0100)]
Wrap write_mir_fn call in with_no_trimmed_paths!()

2 years agoAuto merge of #95133 - matthiaskrgr:rollup-4q0u804, r=matthiaskrgr
bors [Sun, 20 Mar 2022 08:35:40 +0000 (08:35 +0000)]
Auto merge of #95133 - matthiaskrgr:rollup-4q0u804, r=matthiaskrgr

Rollup of 5 pull requests

Successful merges:

 - #94749 (remove_dir_all: use fallback implementation on Miri)
 - #94948 (Fix diagnostics for `#![feature(deprecated_suggestion)]`)
 - #94989 (Add Stream alias for AsyncIterator)
 - #95108 (Give more details in `Display` for `hir::Target`)
 - #95110 (Provide more useful documentation of conversion methods)

Failed merges:

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

2 years agoRollup merge of #95110 - wmstack:patch-1, r=Dylan-DPC
Matthias Krüger [Sun, 20 Mar 2022 08:15:01 +0000 (09:15 +0100)]
Rollup merge of #95110 - wmstack:patch-1, r=Dylan-DPC

Provide more useful documentation of conversion methods

I thought that the documentation for these methods needed to be a bit more explanatory for new users. For advanced users, the comments are relatively unnecessary. I think it would be useful to explain precisely what the method does. As a new user, when you see the `into` method, where the type is inferred, if you are new you don't even know what you convert to, because it is implicit. I believe this can help new users understand.

2 years agoRollup merge of #95108 - scottmcm:more-in-target-display, r=Dylan-DPC
Matthias Krüger [Sun, 20 Mar 2022 08:15:00 +0000 (09:15 +0100)]
Rollup merge of #95108 - scottmcm:more-in-target-display, r=Dylan-DPC

Give more details in `Display` for `hir::Target`

Made because I was making a code change and got a very confusing "should be applied to a method, not a method" error.

```
error[E0718]: `into_try_type` language item must be applied to a method
   --> library\core\src\ops\try_trait.rs:352:32
    |
352 |     #[cfg_attr(not(bootstrap), lang = "into_try_type")]
    |                                ^^^^^^^^^^^^^^^^^^^^^^ attribute should be applied to a method, not a method
```

With this change the error is more actionable

```
error[E0718]: `into_try_type` language item must be applied to a required trait method
   --> library\core\src\ops\try_trait.rs:352:32
    |
352 |     #[cfg_attr(not(bootstrap), lang = "into_try_type")]
    |                                ^^^^^^^^^^^^^^^^^^^^^^ attribute should be applied to a required trait method, not a provided trait method
```

2 years agoRollup merge of #94989 - compiler-errors:stream-alias, r=Dylan-DPC
Matthias Krüger [Sun, 20 Mar 2022 08:15:00 +0000 (09:15 +0100)]
Rollup merge of #94989 - compiler-errors:stream-alias, r=Dylan-DPC

Add Stream alias for AsyncIterator

Fixes #94965

2 years agoRollup merge of #94948 - jhpratt:rustc_deprecated, r=Dylan-DPC
Matthias Krüger [Sun, 20 Mar 2022 08:14:59 +0000 (09:14 +0100)]
Rollup merge of #94948 - jhpratt:rustc_deprecated, r=Dylan-DPC

Fix diagnostics for `#![feature(deprecated_suggestion)]`

Follow up from #94635, where I missed a couple things.

2 years agoRollup merge of #94749 - RalfJung:remove-dir-all-miri, r=cuviper
Matthias Krüger [Sun, 20 Mar 2022 08:14:58 +0000 (09:14 +0100)]
Rollup merge of #94749 - RalfJung:remove-dir-all-miri, r=cuviper

remove_dir_all: use fallback implementation on Miri

Fixes https://github.com/rust-lang/miri/issues/1966

The new implementation requires `openat`, `unlinkat`, and `fdopendir`. These cannot easily be shimmed in Miri since libstd does not expose APIs corresponding to them. So for now it is probably easiest to just use the fallback code in Miri. Nobody should run Miri as root anyway...

2 years agoAuto merge of #95063 - tromey:fix-94458-gdb-char, r=Mark-Simulacrum
bors [Sun, 20 Mar 2022 04:31:23 +0000 (04:31 +0000)]
Auto merge of #95063 - tromey:fix-94458-gdb-char, r=Mark-Simulacrum

Fix debuginfo tests with GDB 11.2

GDB 11.2 added support for DW_ATE_UTF, which caused some test
failures.  This fixes these tests by changing the format that is used,
and adds a new test to verify that characters are emitted as something
that GDB can print in a char-like way.

Fixes #94458

2 years agoFix docs for default rmeta filename.
Eric Huss [Sun, 20 Mar 2022 04:05:31 +0000 (21:05 -0700)]
Fix docs for default rmeta filename.

2 years agoAuto merge of #94976 - jclulow:solaris-festival, r=Mark-Simulacrum
bors [Sun, 20 Mar 2022 01:50:36 +0000 (01:50 +0000)]
Auto merge of #94976 - jclulow:solaris-festival, r=Mark-Simulacrum

solaris build environment should include libsendfile/liblgrp

As of version 0.2.120 of the libc crate, the solaris target now requires
some additional libraries to be present in the sysroot.  Note that the
solaris target doesn't really build against files from Solaris, but
rather against some files from DilOS (a platform similar to both Solaris
and illumos).  Pull in the extra libraries and their compilation links
from that apt repository.

This aims to assist with rust-lang/rust#94052.

2 years agodiagnostics: do not give Option::as_ref suggestion for complex match
Michael Howell [Sat, 19 Mar 2022 22:48:39 +0000 (15:48 -0700)]
diagnostics: do not give Option::as_ref suggestion for complex match

Fixes #82528

2 years agoAuto merge of #94372 - erikdesjardins:asrefinl, r=dtolnay
bors [Sat, 19 Mar 2022 22:32:28 +0000 (22:32 +0000)]
Auto merge of #94372 - erikdesjardins:asrefinl, r=dtolnay

Add #[inline] to trivial AsRef/AsMut impls

These appeared uninlined in some perf runs, but they're trivial.

r? `@ghost`

2 years agoAuto merge of #95103 - ehuss:update-cargo, r=ehuss
bors [Sat, 19 Mar 2022 19:41:10 +0000 (19:41 +0000)]
Auto merge of #95103 - ehuss:update-cargo, r=ehuss

Update cargo

9 commits in 65c82664263feddc5fe2d424be0993c28d46377a..109bfbd055325ef87a6e7f63d67da7e838f8300b
2022-03-09 02:32:56 +0000 to 2022-03-17 21:43:09 +0000
- Refactor RegistryData::load to handle management of the index cache (rust-lang/cargo#10482)
- Separate VCS command paths with "--" (rust-lang/cargo#10483)
- Fix panic when artifact target is used for `[target.'cfg(&lt;target&gt;)'.dependencies` (rust-lang/cargo#10433)
- Bump git2@0.14.2 and libgit2-sys@0.13.2 (rust-lang/cargo#10479)
- vendor: Don't allow multiple values for --sync (rust-lang/cargo#10448)
- Use types to make clere (credential process || token) (rust-lang/cargo#10471)
- Warning on conflicting keys (rust-lang/cargo#10316)
- Registry functions return Poll to enable parallel fetching of index data (rust-lang/cargo#10064)
- Refine the contributor guide (rust-lang/cargo#10468)

2 years agoAuto merge of #95112 - Dylan-DPC:rollup-0jo0loj, r=Dylan-DPC
bors [Sat, 19 Mar 2022 17:00:15 +0000 (17:00 +0000)]
Auto merge of #95112 - Dylan-DPC:rollup-0jo0loj, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #93858 (Add a `process_group` method to UNIX `CommandExt`)
 - #94650 (Relax tests for Windows dos device names)
 - #94991 (Make Weak::new const)
 - #95072 (Re-enable parallel debuginfo tests)
 - #95109 (Extend --check-cfg tests to all predicate inside all/any)

Failed merges:

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

2 years agoRemove animation on source sidebar
Guillaume Gomez [Sat, 19 Mar 2022 15:59:56 +0000 (16:59 +0100)]
Remove animation on source sidebar