]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoRollup merge of #80771 - thomcc:nonnull-refmut, r=dtolnay
Dylan DPC [Mon, 22 Mar 2021 01:20:24 +0000 (02:20 +0100)]
Rollup merge of #80771 - thomcc:nonnull-refmut, r=dtolnay

Make NonNull::as_ref (and friends) return refs with unbound lifetimes

# Rationale:

1. The documentation for all of these functions claims that this is what the functions already do, as they all come with this comment:

    > You must enforce Rust's aliasing rules, *since the returned lifetime 'a is arbitrarily chosen* and does not necessarily reflect the actual lifetime of the data...

    So I think it's just a bug that they weren't this way already. Note that had it not been for this part, I wouldn't be making this PR, so if we decide we won't take this change, I'll follow it up with a docs PR to fix this.

2. This is how the equivalent raw pointer functions behave.

    They also take `self` and not `&self`/`&mut self`, but that can't be changed compatibly at this point. This is the next best thing.

3. Without this fix, often code that uses these methods will find it has to expand the lifetime of the result.

    (I can't speak for others but even in unsafe-heavy code, needing to do this unexpectedly is a huge red flag -- if Rust thinks something should have a specific lifetime, I assume it's for a reason)

### Can this cause existing code to be unsound?

I'm confident this can't cause new unsoundness since the reference exists for at most its lifetime, but you get a borrow checker error if you do something that would require/allow the reference to exist past its lifetime.

Additionally, the aliasing rules of a reference only applies while the reference exists.

This *must* be the case, as it is required by the rules used by safe code. (That said, the documentation in this file sort of contradicts it, but I think it's just ambiguity between the lifetime `'a` in `&'a T` and lifetime of the `&'a T` reference itself...)

We are increasing the lifetime of these references, but they should already have hard bounds on that lifetime, or they'd have borrow checker errors.

(CC ``@RalfJung`` because I have gone and done the mistake where I say something definitive about aliasing in Rust which is honestly outside the group of things I should make definitive comments about).

# Caveats

1. This is insta-stable (except for on the unstable functions ofc). I don't think there's any other alternative.

2. I don't believe this is a breaking change in practice. In theory someone could be assigning `NonNull::as_ref` to a function pointer of type `fn(&NonNull<T>) -> &T`. Now they'd need to use a slightly different function pointer type which is (probably) incompatible. This seems pathological, but I guess crater could be used if there are concerns.

3. This has no tests. The old version didn't either that I saw. I could add some stuff that fails to compile without it, if that would be useful.

4. Sometimes the NLL borrow checker gives up and decides lifetimes live till the end of the scope, as opposed to the range where they're used. If this change can cause this to happen more, then my soundness rationale is wrong, and it's likely breaking.

    In practice this seems super unlikely.

Anyway. That was a lot of typing.

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

3 years agoRollup merge of #80193 - zseri:stabilize-osstring-ascii, r=m-ou-se
Dylan DPC [Mon, 22 Mar 2021 01:20:23 +0000 (02:20 +0100)]
Rollup merge of #80193 - zseri:stabilize-osstring-ascii, r=m-ou-se

stabilize `feature(osstring_ascii)`

This PR stabilizes `feature(osstring_ascii)`.

Fixes #70516.

3 years agoAuto merge of #82834 - nikic:mutable-noalias, r=nagisa
bors [Sun, 21 Mar 2021 21:54:09 +0000 (21:54 +0000)]
Auto merge of #82834 - nikic:mutable-noalias, r=nagisa

Enable mutable noalias for LLVM >= 12

Enable mutable noalias by default on LLVM 12, as previously known miscompiles have been resolved. Now it's time to find the next one ;)

 * The `-Z mutable-noalias` option no longer has an explicit default and accepts `-Z mutable-noalias=yes` and `-Z mutable-noalias=no` to override the LLVM version based default behavior.
 * The decision on whether to apply the noalias attribute is moved into rustc_codegen_llvm. rustc_middle only provides us with the necessary information to make the decision.
 * `noalias` is not emitted for types that are `!Unpin`, as a heuristic for self-referential structures (see #54878 and #63818).

3 years agoUpdate doc/reference submodule
Nikita Popov [Sun, 21 Mar 2021 19:13:08 +0000 (20:13 +0100)]
Update doc/reference submodule

In particular this pulls in an update to the auto-deref
recursion_limit example, to no longer rely on the Freeze query.

3 years agoDon't compute optimized PointerKind for unoptimized builds
Nikita Popov [Fri, 19 Mar 2021 21:49:51 +0000 (22:49 +0100)]
Don't compute optimized PointerKind for unoptimized builds

This saves us both the Freeze/Unpin queries, and avoids placing
noalias attributes, which have a compile-time impact on LLVM
even in optnone builds (due to always_inline functions).

3 years agoEnable mutable noalias by default for LLVM 12
Nikita Popov [Thu, 18 Mar 2021 21:50:58 +0000 (22:50 +0100)]
Enable mutable noalias by default for LLVM 12

We don't have any known noalias bugs for LLVM 12 ... yet.

3 years agoDon't consider !Unpin references as noalias
Nikita Popov [Thu, 18 Mar 2021 21:44:36 +0000 (22:44 +0100)]
Don't consider !Unpin references as noalias

Such structures may contain self-references, in which case the
same location may be accessible through a pointer that is not
based-on the noalias pointer.

This is still grey area as far as language semantics are concerned,
but checking for !Unpin as an indicator for self-referential
sturctures seems like a good approach for the meantime.

3 years agoConvert -Z mutable-noalias to Optional<bool>
Nikita Popov [Thu, 18 Mar 2021 21:10:36 +0000 (22:10 +0100)]
Convert -Z mutable-noalias to Optional<bool>

The default value will dependend on the LLVM version in the future,
so don't specify one to start with.

3 years agoMove decision aboute noalias into codegen_llvm
Nikita Popov [Thu, 18 Mar 2021 20:50:28 +0000 (21:50 +0100)]
Move decision aboute noalias into codegen_llvm

The frontend shouldn't be deciding whether or not to use mutable
noalias attributes, as this is a pure LLVM concern. Only provide
the necessary information and do the actual decision in
codegen_llvm.

3 years agoBump osstring_ascii stabilization version to 1.53.0.
Mara Bos [Sun, 21 Mar 2021 16:49:14 +0000 (17:49 +0100)]
Bump osstring_ascii stabilization version to 1.53.0.

3 years agoAuto merge of #83053 - oli-obk:const_stab_version, r=m-ou-se
bors [Sun, 21 Mar 2021 16:21:39 +0000 (16:21 +0000)]
Auto merge of #83053 - oli-obk:const_stab_version, r=m-ou-se

Fix const stability `since` versions.

fixes #82085

r? `@m-ou-se`

3 years agoAuto merge of #83339 - Aaron1011:deep-recollect, r=petrochenkov
bors [Sun, 21 Mar 2021 13:00:22 +0000 (13:00 +0000)]
Auto merge of #83339 - Aaron1011:deep-recollect, r=petrochenkov

Perform 'deep recollection' in test helper macros

Currently, the print helper macro performs 'recollection' by doing
`token_stream.into_iter().collect()`. However, this will not affect
nonterminals that occur nested inside delimited groups, since the
wrapping delimited group will be left untouched.

This commit adds 'deep recollection', which recursively recollects every
delimited group in the token stream. As with normal recollection, we
only print out something if deep recollection results in a different
stringified token stream.

This is useful for catching bugs where we update the AST of a
nonterminal (which affects pretty-printing), but do not update the
attatched `TokenStream`

3 years agoPerform 'deep recollection' in test helper macros
Aaron Hill [Sun, 21 Mar 2021 04:17:19 +0000 (00:17 -0400)]
Perform 'deep recollection' in test helper macros

Currently, the print helper macro performs 'recollection' by doing
`token_stream.into_iter().collect()`. However, this will not affect
nonterminals that occur nested inside delimited groups, since the
wrapping delimited group will be left untouched.

This commit adds 'deep recollection', which recursively recollects every
delimited group in the token stream. As with normal recollection, we
only print out something if deep recollection results in a different
stringified token stream.

This is useful for catching bugs where we update the AST of a
nonterminal (which affects pretty-printing), but do not update the
attatched `TokenStream`

3 years agoAuto merge of #83333 - Dylan-DPC:rollup-0rdt6sz, r=Dylan-DPC
bors [Sun, 21 Mar 2021 03:36:22 +0000 (03:36 +0000)]
Auto merge of #83333 - Dylan-DPC:rollup-0rdt6sz, r=Dylan-DPC

Rollup of 6 pull requests

Successful merges:

 - #82707 (const_evaluatable_checked: Stop eagerly erroring in `is_const_evaluatable`)
 - #83040 (extract `ConstKind::Unevaluated` into a struct)
 - #83280 (Fix pluralization in keyword docs)
 - #83289 (Move some tests to more reasonable directories - 5)
 - #83306 (Extend `proc_macro_back_compat` lint to `js-sys`)
 - #83327 (Extend comment in `UsedLocals::visit_lhs`)

Failed merges:

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

3 years agoRollup merge of #83327 - tmiasko:visit-lhs, r=davidtwco
Dylan DPC [Sun, 21 Mar 2021 01:01:40 +0000 (02:01 +0100)]
Rollup merge of #83327 - tmiasko:visit-lhs, r=davidtwco

Extend comment in `UsedLocals::visit_lhs`

3 years agoRollup merge of #83306 - Aaron1011:js-sys-lint, r=petrochenkov
Dylan DPC [Sun, 21 Mar 2021 01:01:39 +0000 (02:01 +0100)]
Rollup merge of #83306 - Aaron1011:js-sys-lint, r=petrochenkov

Extend `proc_macro_back_compat` lint to `js-sys`

With this PR, we now lint for all cases where we perform some kind of
proc-macro back-compat hack.

The `js-sys` had an internal fix made to properly handle
`None`-delimited groups, so we need to manually check the version in the
filename. As a result, we no longer apply the back-compat hack to cases
where the version number is missing file the file path. This should not
affect any users of the `crates.io` crate.

3 years agoRollup merge of #83289 - c410-f3r:tests-tests-tests, r=petrochenkov
Dylan DPC [Sun, 21 Mar 2021 01:01:38 +0000 (02:01 +0100)]
Rollup merge of #83289 - c410-f3r:tests-tests-tests, r=petrochenkov

Move some tests to more reasonable directories - 5

cc #73494

Threshold is 0.95. Next time I promise I will take a look into the special/misclassified directories.

- [issues/issue-23208.rs](https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-23208.rs) <sup>[issue](https://github.com/rust-lang/rust/issues/23208)</sup>: associated-types 0.951
- [weird-exprs.rs](https://github.com/rust-lang/rust/blob/master/src/test/ui/weird-exprs.rs) <sup>unknown</sup>: destructuring-assignment 0.958
- [issues/issue-1701.rs](https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-1701.rs) <sup>[issue](https://github.com/rust-lang/rust/issues/1701)</sup>: structs-enums 0.974
- [issues/issue-48508-aux.rs](https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-48508-aux.rs) <sup>[issue](https://github.com/rust-lang/rust/issues/48508)</sup>: numbers-arithmetic 0.991
- [fn_must_use.rs](https://github.com/rust-lang/rust/blob/master/src/test/ui/fn_must_use.rs) <sup>unknown</sup>: lint 1.000
- [mir_check_nonconst.rs](https://github.com/rust-lang/rust/blob/master/src/test/ui/mir_check_nonconst.rs) <sup>unknown</sup>: consts 1.002
- [issues/issue-52060.rs](https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-52060.rs) <sup>[issue](https://github.com/rust-lang/rust/issues/52060)</sup>: consts 1.017
- [issues/issue-45729-unsafe-in-generator.rs](https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-45729-unsafe-in-generator.rs) <sup>[issue](https://github.com/rust-lang/rust/issues/45729)</sup>: generator 1.024
- [issues/issue-10392.rs](https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-10392.rs) <sup>[issue](https://github.com/rust-lang/rust/issues/10392)</sup>: pattern 1.039
- [no-implicit-prelude.rs](https://github.com/rust-lang/rust/blob/master/src/test/ui/no-implicit-prelude.rs) <sup>unknown</sup>: resolve 1.071
- [issues/issue-68000-unicode-ident-after-missing-comma.rs](https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-68000-unicode-ident-after-missing-comma.rs) <sup>[issue](https://github.com/rust-lang/rust/issues/68000)</sup>: parser 1.079
- [shadow.rs](https://github.com/rust-lang/rust/blob/master/src/test/ui/shadow.rs) <sup>unknown</sup>: binding 1.099
- [issues/issue-65611.rs](https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-65611.rs) <sup>[issue](https://github.com/rust-lang/rust/issues/65611)</sup>: consts 1.139
- [concat-rpass.rs](https://github.com/rust-lang/rust/blob/master/src/test/ui/concat-rpass.rs) <sup>unknown</sup>: macros 1.194
- [issues/issue-31597.rs](https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-31597.rs) <sup>[issue](https://github.com/rust-lang/rust/issues/31597)</sup>: associated-types 1.195
- [issues/issue-78372.rs](https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-78372.rs) <sup>[issue](https://github.com/rust-lang/rust/issues/78372)</sup>: resolve 1.426
- [impl-trait-in-bindings-issue-73003.rs](https://github.com/rust-lang/rust/blob/master/src/test/ui/impl-trait-in-bindings-issue-73003.rs) <sup>[issue](https://github.com/rust-lang/rust/issues/73003)</sup>: impl-trait 1.471
- [impl-trait-in-bindings.rs](https://github.com/rust-lang/rust/blob/master/src/test/ui/impl-trait-in-bindings.rs) <sup>unknown</sup>: impl-trait 2.500

r? `@petrochenkov`

3 years agoRollup merge of #83280 - starthal:fix-typo-keyword-docs, r=dtolnay
Dylan DPC [Sun, 21 Mar 2021 01:01:37 +0000 (02:01 +0100)]
Rollup merge of #83280 - starthal:fix-typo-keyword-docs, r=dtolnay

Fix pluralization in keyword docs

3 years agoRollup merge of #83040 - lcnr:unused-ct-substs, r=oli-obk
Dylan DPC [Sun, 21 Mar 2021 01:01:36 +0000 (02:01 +0100)]
Rollup merge of #83040 - lcnr:unused-ct-substs, r=oli-obk

extract `ConstKind::Unevaluated` into a struct

r? `@oli-obk`

3 years agoRollup merge of #82707 - BoxyUwU:errooaaar, r=oli-obk
Dylan DPC [Sun, 21 Mar 2021 01:01:34 +0000 (02:01 +0100)]
Rollup merge of #82707 - BoxyUwU:errooaaar, r=oli-obk

const_evaluatable_checked: Stop eagerly erroring in `is_const_evaluatable`

Fixes #82279

We don't want to be emitting errors inside of is_const_evaluatable because we may call this during selection where it should be able to fail silently

There were two errors being emitted in `is_const_evaluatable`. The one causing the compile error in #82279 was inside the match arm for `FailureKind::MentionsParam` but I moved the other error being emitted too since it made things cleaner imo

The `NotConstEvaluatable` enum \*should\* have a fourth variant for when we fail to evaluate a concrete const, e.g. `0 - 1` but that cant happen until #81339

cc `@oli-obk` `@lcnr`
r? `@nikomatsakis`

3 years agoAuto merge of #83324 - Mark-Simulacrum:nextrel, r=Mark-Simulacrum
bors [Sun, 21 Mar 2021 00:50:13 +0000 (00:50 +0000)]
Auto merge of #83324 - Mark-Simulacrum:nextrel, r=Mark-Simulacrum

Bump to 1.53.0

r? `@Mark-Simulacrum`

3 years agobless mir-opt tests
lcnr [Sat, 13 Mar 2021 16:52:50 +0000 (17:52 +0100)]
bless mir-opt tests

3 years agoupdate `const_eval_resolve`
lcnr [Sat, 13 Mar 2021 15:31:38 +0000 (16:31 +0100)]
update `const_eval_resolve`

3 years agoextract `ConstKind::Unevaluated` into a struct
lcnr [Thu, 11 Mar 2021 23:01:34 +0000 (00:01 +0100)]
extract `ConstKind::Unevaluated` into a struct

3 years agoAuto merge of #83314 - Aaron1011:print-unstable-value, r=lcnr
bors [Sat, 20 Mar 2021 16:20:21 +0000 (16:20 +0000)]
Auto merge of #83314 - Aaron1011:print-unstable-value, r=lcnr

Debug-print result when an unstable fingerprint is detected

Helps with issues like #83311

I had previously tried to do this in https://github.com/rust-lang/rust/pull/80692, but it had a significant performance impact (even though the code was never actually run). Hopefully, this will be better now that https://github.com/rust-lang/rust/pull/79100 has been merged.

3 years agoBump to 1.53.0
Mark Rousskov [Sat, 20 Mar 2021 16:19:30 +0000 (12:19 -0400)]
Bump to 1.53.0

3 years agoMove some tests to more reasonable directories - 5
Caio [Sat, 20 Mar 2021 14:41:24 +0000 (11:41 -0300)]
Move some tests to more reasonable directories - 5

3 years agoAuto merge of #83271 - SparrowLii:simd_neg, r=Amanieu
bors [Sat, 20 Mar 2021 09:01:35 +0000 (09:01 +0000)]
Auto merge of #83271 - SparrowLii:simd_neg, r=Amanieu

Add simd_neg platform intrinsic

Stdarch needs to add simd_neg to support the implementation of vneg neon instructions. Look [here](https://github.com/rust-lang/stdarch/pull/1087)

3 years agoAuto merge of #82919 - bstrie:stabchar, r=dtolnay
bors [Sat, 20 Mar 2021 06:36:42 +0000 (06:36 +0000)]
Auto merge of #82919 - bstrie:stabchar, r=dtolnay

Stabilize `assoc_char_funcs` and `assoc_char_consts`

Stabilizes the following associated items on `char`:

* [`char::MAX`](https://doc.rust-lang.org/std/primitive.char.html#associatedconstant.MAX)
* [`char::REPLACEMENT_CHARACTER`](https://doc.rust-lang.org/std/primitive.char.html#associatedconstant.REPLACEMENT_CHARACTER)
* [`char::UNICODE_VERSION`](https://doc.rust-lang.org/std/primitive.char.html#associatedconstant.UNICODE_VERSION)
* [`char::decode_utf16`](https://doc.rust-lang.org/std/primitive.char.html#method.decode_utf16)
* [`char::from_u32`](https://doc.rust-lang.org/std/primitive.char.html#method.from_u32)
* [`char::from_u32_unchecked`](https://doc.rust-lang.org/std/primitive.char.html#method.from_u32_unchecked)
* [`char::from_digit`](https://doc.rust-lang.org/std/primitive.char.html#method.from_digit)

Closes #71763.

3 years agoFix broken doc link reference
Stephen Albert-Moore [Sat, 20 Mar 2021 04:36:41 +0000 (00:36 -0400)]
Fix broken doc link reference

3 years agoAuto merge of #83293 - osa1:82436_perf, r=varkor
bors [Sat, 20 Mar 2021 03:49:10 +0000 (03:49 +0000)]
Auto merge of #83293 - osa1:82436_perf, r=varkor

Revert performance-sensitive change in #82436

This change was done in #82436, as an "optimization". Unfortunately I
missed that this code is not always executed, because of the "continue"
in the conditional above it.

This commit should solve the perf regressions introduced by #82436 as I
think there isn't anything else that could affect runtime performance in
that PR. The `Pick` type grows only one word, which I doubt can cause up
to 8.8% increase in RSS in some of the benchmarks.

---

Could someone with the rights start a perf job please?

3 years agoStabilize `assoc_char_funcs` and `assoc_char_consts`
bstrie [Mon, 8 Mar 2021 23:44:03 +0000 (18:44 -0500)]
Stabilize `assoc_char_funcs` and `assoc_char_consts`

3 years agoDebug-print result when an unstable fingerprint is detected
Aaron Hill [Sat, 20 Mar 2021 01:47:57 +0000 (21:47 -0400)]
Debug-print result when an unstable fingerprint is detected

3 years agoExtend comment in `UsedLocals::visit_lhs`
Tomasz Miąsko [Sat, 20 Mar 2021 00:00:00 +0000 (00:00 +0000)]
Extend comment in `UsedLocals::visit_lhs`

3 years agoAuto merge of #83308 - Dylan-DPC:rollup-p2j6sy8, r=Dylan-DPC
bors [Fri, 19 Mar 2021 23:53:02 +0000 (23:53 +0000)]
Auto merge of #83308 - Dylan-DPC:rollup-p2j6sy8, r=Dylan-DPC

Rollup of 8 pull requests

Successful merges:

 - #79986 (Only build help popup when it's really needed)
 - #82570 (Add `as_str` method for split whitespace str iterators)
 - #83244 (Fix overflowing length in Vec<ZST> to VecDeque)
 - #83254 (Include output stream in `panic!()` documentation)
 - #83269 (Revert the second deprecation of collections::Bound)
 - #83277 (Mark early otherwise optimization unsound)
 - #83285 (Update LLVM to bring in SIMD updates for WebAssembly)
 - #83297 (Do not ICE on ty::Error as an error must already have been reported)

Failed merges:

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

3 years agoRollup merge of #83297 - oli-obk:why_bug_today_if_you_can_delay_to_tomorrow, r=petroc...
Dylan DPC [Fri, 19 Mar 2021 22:01:42 +0000 (23:01 +0100)]
Rollup merge of #83297 - oli-obk:why_bug_today_if_you_can_delay_to_tomorrow, r=petrochenkov

Do not ICE on ty::Error as an error must already have been reported

fixes #83253

3 years agoRollup merge of #83285 - alexcrichton:wasm-simd-update, r=cuviper
Dylan DPC [Fri, 19 Mar 2021 22:01:41 +0000 (23:01 +0100)]
Rollup merge of #83285 - alexcrichton:wasm-simd-update, r=cuviper

Update LLVM to bring in SIMD updates for WebAssembly

This is a continuation of https://github.com/rust-lang/llvm-project/pull/96
to continue to make progress on updating Rust's support for SIMD
intrinsics on WebAssembly to the latest version of the specification.

3 years agoRollup merge of #83277 - spastorino:early_otherwise-opt-unsound, r=oli-obk
Dylan DPC [Fri, 19 Mar 2021 22:01:40 +0000 (23:01 +0100)]
Rollup merge of #83277 - spastorino:early_otherwise-opt-unsound, r=oli-obk

Mark early otherwise optimization unsound

r? `@oli-obk`
cc `@tmiasko`

Related to #78496 and #82905

Should I also bump this one to level 3 or 4 or given that is unsound it doesn't matter?.
Probably need to adjust some tests.

3 years agoRollup merge of #83269 - bstrie:revertdep, r=m-ou-se
Dylan DPC [Fri, 19 Mar 2021 22:01:39 +0000 (23:01 +0100)]
Rollup merge of #83269 - bstrie:revertdep, r=m-ou-se

Revert the second deprecation of collections::Bound

Per the review at https://github.com/rust-lang/rust/pull/82122#discussion_r596448078 and the decision at https://rust-lang.zulipchat.com/#narrow/stream/219381-t-libs/topic/unavoidable.20breakage.20when.20deprecating.20an.20enum.3F , revert this small portion of #82122 for the time being. This doesn't affect the other components of that patch, i.e. `intrinsics::drop_in_place` is still deprecated-for-real, and uses of `collections::Bound` remain removed from the repo.

3 years agoRollup merge of #83254 - jfrimmel:panic_output-stream, r=m-ou-se,joshtriplett
Dylan DPC [Fri, 19 Mar 2021 22:01:38 +0000 (23:01 +0100)]
Rollup merge of #83254 - jfrimmel:panic_output-stream, r=m-ou-se,joshtriplett

Include output stream in `panic!()` documentation

Fixes #83252.

3 years agoRollup merge of #83244 - cuviper:vec_deque-zst, r=m-ou-se
Dylan DPC [Fri, 19 Mar 2021 22:01:37 +0000 (23:01 +0100)]
Rollup merge of #83244 - cuviper:vec_deque-zst, r=m-ou-se

Fix overflowing length in Vec<ZST> to VecDeque

`Vec` can hold up to `usize::MAX` ZST items, but `VecDeque` has a lower
limit to keep its raw capacity as a power of two, so we should check
that in `From<Vec<T>> for VecDeque<T>`. We can also simplify the
capacity check for the remaining non-ZST case.

Before this fix, the new test would fail on the length:

```
thread 'collections::vec_deque::tests::test_from_vec_zst_overflow' panicked at 'assertion failed: `(left == right)`
  left: `0`,
 right: `9223372036854775808`', library/alloc/src/collections/vec_deque/tests.rs:474:5
note: panic did not contain expected string
      panic message: `"assertion failed: `(left == right)`\n  left: `0`,\n right: `9223372036854775808`"`,
 expected substring: `"capacity overflow"`
```

That was a result of `len()` using a mask `& (size - 1)` with the
improper length. Now we do get a "capacity overflow" panic as soon as
that `VecDeque::from(vec)` is attempted.

Fixes #80167.

3 years agoRollup merge of #82570 - WaffleLapkin:split_whitespace_as_str, r=m-ou-se
Dylan DPC [Fri, 19 Mar 2021 22:01:35 +0000 (23:01 +0100)]
Rollup merge of #82570 - WaffleLapkin:split_whitespace_as_str, r=m-ou-se

Add `as_str` method for split whitespace str iterators

This PR adds `as_str` methods to `SplitWhitespace` and `SplitAsciiWhitespace`
str iterators. The methods return the remainder, similar to `as_str` methods on
`Chars` and other split iterators. This PR is a continuation of https://github.com/rust-lang/rust/pull/75265, which added `as_str` for all other str split iterators.

The feature gate for new methods is `#![feature(str_split_whitespace_as_str)]`.

`SplitWhitespace` and `SplitAsciiWhitespace` use iterators under the hood, so to implement `as_str` it's required to either
1. Make fields of some iterators `pub(crate)`
2. Add getter methods (like `into_inner`, `inner`, `inner_mut`...) to some (all) iterators
3. Completely rewrite `SplitWhitespace` and `SplitAsciiWhitespace`

This PR uses the 1. approach since it's easier to implement and requires fewer changes (and no changes to the public API). If you think that's not the right way, please, tell me.

r? `@m-ou-se`

3 years agoRollup merge of #79986 - GuillaumeGomez:build-help-when-needed, r=Nemo157
Dylan DPC [Fri, 19 Mar 2021 22:01:29 +0000 (23:01 +0100)]
Rollup merge of #79986 - GuillaumeGomez:build-help-when-needed, r=Nemo157

Only build help popup when it's really needed

When working on https://github.com/rust-lang/rust/pull/79985, I realized that the help popup was built even when it wasn't needed. This PR only makes the help popup to be built when required.

r? `@jyn514`

3 years agoAuto merge of #83201 - klensy:checkout-v2, r=pietroalbini
bors [Fri, 19 Mar 2021 21:08:41 +0000 (21:08 +0000)]
Auto merge of #83201 - klensy:checkout-v2, r=pietroalbini

use checkout@v2 in CI for master

Updates CI workflow to use checkout@v2 from v1 (as other parts of CI) for master, plus slightly faster checkout as result
compare v2
https://github.com/rust-lang-ci/rust/commit/2ccf06302c08d7d4911aad40e66a9a3ee731c6f9/checks/2113902859/logs
and v1 logs
https://github.com/rust-lang-ci/rust/commit/2ccf06302c08d7d4911aad40e66a9a3ee731c6f9/checks/2115229351/logs

3 years agoExtend `proc_macro_back_compat` lint to `js-sys`
Aaron Hill [Fri, 19 Mar 2021 15:10:01 +0000 (11:10 -0400)]
Extend `proc_macro_back_compat` lint to `js-sys`

With this PR, we now lint for all cases where we perform some kind of
proc-macro back-compat hack.

The `js-sys` had an internal fix made to properly handle
`None`-delimited groups, so we need to manually check the version in the
filename. As a result, we no longer apply the back-compat hack to cases
where the version number is missing file the file path. This should not
affect any users of the `crates.io` crate.

3 years agoAuto merge of #82951 - sexxi-goose:wr-mir-replace-methods2, r=nikomatsakis
bors [Fri, 19 Mar 2021 18:23:44 +0000 (18:23 +0000)]
Auto merge of #82951 - sexxi-goose:wr-mir-replace-methods2, r=nikomatsakis

Replace closures_captures and upvar_capture with closure_min_captures

Removed all uses of closures_captures and upvar_capture and refactored code to work with closure_min_captures. This also involved removing functions that were no longer needed like the bridge.

Closes https://github.com/rust-lang/project-rfc-2229/issues/18
r? `@nikomatsakis`

3 years agoIgnore main.js file length
Guillaume Gomez [Fri, 19 Mar 2021 16:33:27 +0000 (17:33 +0100)]
Ignore main.js file length

3 years agoOnly build help popup when it's really needed
Guillaume Gomez [Sat, 12 Dec 2020 22:32:44 +0000 (23:32 +0100)]
Only build help popup when it's really needed

3 years agoAuto merge of #83301 - Dylan-DPC:rollup-x1yzvhm, r=Dylan-DPC
bors [Fri, 19 Mar 2021 15:38:57 +0000 (15:38 +0000)]
Auto merge of #83301 - Dylan-DPC:rollup-x1yzvhm, r=Dylan-DPC

Rollup of 11 pull requests

Successful merges:

 - #82500 (Reuse `std::sys::unsupported::pipe` on `hermit`)
 - #82759 (Remove unwrap_none/expect_none from compiler/.)
 - #82846 (rustdoc: allow list syntax for #[doc(alias)] attributes)
 - #82892 (Clarify docs for Read::read's return value)
 - #83179 (Extend `proc_macro_back_compat` lint to `actix-web`)
 - #83197 (Move some test-only code to test files)
 - #83208 (Fix gitattibutes for old git versions)
 - #83215 (Deprecate std::os::haiku::raw, which accidentally wasn't deprecated)
 - #83230 (Remove unnecessary `forward_inner_docs` hack)
 - #83236 (Upgrade memmap to memmap2)
 - #83270 (Fix typo/inaccuracy in the documentation of Iterator::skip_while)

Failed merges:

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

3 years agoRollup merge of #83270 - steffahn:missing_word_in_skip_while_doc, r=joshtriplett
Dylan DPC [Fri, 19 Mar 2021 14:03:29 +0000 (15:03 +0100)]
Rollup merge of #83270 - steffahn:missing_word_in_skip_while_doc, r=joshtriplett

Fix typo/inaccuracy in the documentation of Iterator::skip_while

One of the examples used to say “this leads to a possibly confusing situation, where the type of the closure is a double reference” while _actually_ referring to the type of the closure _argument_.

This PR just changes a single word in documentation.

`````@rustbot````` modify labels: A-iterators, T-doc, T-lang

3 years agoRollup merge of #83236 - cjgillot:memmap, r=joshtriplett
Dylan DPC [Fri, 19 Mar 2021 14:03:28 +0000 (15:03 +0100)]
Rollup merge of #83236 - cjgillot:memmap, r=joshtriplett

Upgrade memmap to memmap2

memmap is no longer maintained. memmap2 is a fork that is still maintained. https://rustsec.org/advisories/RUSTSEC-2020-0077.html

The remaining use of memmap is through measureme.

3 years agoRollup merge of #83230 - jyn514:remove-macros, r=joshtriplett
Dylan DPC [Fri, 19 Mar 2021 14:03:27 +0000 (15:03 +0100)]
Rollup merge of #83230 - jyn514:remove-macros, r=joshtriplett

Remove unnecessary `forward_inner_docs` hack

and replace it with `extended_key_value_attributes` feature.

This is https://github.com/rust-lang/rust/pull/79150, but for compiler/.

3 years agoRollup merge of #83215 - bstrie:dephaikuraw, r=joshtriplett
Dylan DPC [Fri, 19 Mar 2021 14:03:26 +0000 (15:03 +0100)]
Rollup merge of #83215 - bstrie:dephaikuraw, r=joshtriplett

Deprecate std::os::haiku::raw, which accidentally wasn't deprecated

In early 2016, all `std::os::*::raw` modules [were deprecated](https://github.com/rust-lang/rust/commit/aa23c98450063992473d40d707273903f8a3937d) in accordance with [RFC 1415](https://github.com/rust-lang/rfcs/blob/master/text/1415-trim-std-os.md). However, at this same time support for Haiku was being added to libstd, landing shortly after the aforementioned commit, and due to some crossed wires a `std::os::haiku::raw` module was added and was not marked as deprecated.

I have been in correspondence with the author of the Haiku patch, ````@nielx,```` who has confirmed that this was simply an oversight and that the definitions from the libc crate should be preferred instead.

3 years agoRollup merge of #83208 - jethrogb:jb/gitignore, r=Xanewok
Dylan DPC [Fri, 19 Mar 2021 14:03:25 +0000 (15:03 +0100)]
Rollup merge of #83208 - jethrogb:jb/gitignore, r=Xanewok

Fix gitattibutes for old git versions

3 years agoRollup merge of #83197 - jyn514:cfg-test-dead-code, r=joshtriplett
Dylan DPC [Fri, 19 Mar 2021 14:03:24 +0000 (15:03 +0100)]
Rollup merge of #83197 - jyn514:cfg-test-dead-code, r=joshtriplett

Move some test-only code to test files

Split out from https://github.com/rust-lang/rust/pull/83185.

3 years agoRollup merge of #83179 - Aaron1011:actix-web-lint, r=petrochenkov
Dylan DPC [Fri, 19 Mar 2021 14:03:23 +0000 (15:03 +0100)]
Rollup merge of #83179 - Aaron1011:actix-web-lint, r=petrochenkov

Extend `proc_macro_back_compat` lint to `actix-web`

Unlike the other cases of this lint, there's no simple way to detect if
an old version of the relevant crate (`syn`) is in use. The `actix-web`
crate only depends on `pin-project` v1.0.0, so checking the version of
`actix-web` does not guarantee that a new enough version of
`pin-project` (and therefore `syn`) is in use.

Instead, we rely on the fact that virtually all of the regressed crates
are pinned to a pre-1.0 version of `pin-project`. When this is the case,
bumping the `actix-web` dependency will pull in the *latest* version of
`pin-project`, which has an explicit dependency on a newer v dependency
on a newer version of `syn`.

The lint message tells users to update `actix-web`, since that's what
they're most likely to have control over. We could potentially tell them
to run `cargo update -p syn`, but I think it's more straightforward to
suggest an explicit change to the `Cargo.toml`

The `actori-web` fork had its last commit over a year ago, and appears
to just be a renamed fork of `actix-web`. Therefore, I've removed the
`actori-web` check entirely - any crates that actually get broken can
simply update `syn` themselves.

3 years agoRollup merge of #82892 - jix:clarify-read-read, r=joshtriplett
Dylan DPC [Fri, 19 Mar 2021 14:03:22 +0000 (15:03 +0100)]
Rollup merge of #82892 - jix:clarify-read-read, r=joshtriplett

Clarify docs for Read::read's return value

Right now the docs for `Read::read`'s return value are phrased in a way that makes it easy for the reader to assume that the return value is never larger than the passed buffer. This PR clarifies that this is a requirement for implementations of the trait, but that callers have to expect a buggy yet safe implementation failing to do so, especially if unchecked accesses to the buffer are done afterwards.

I fell into this trap recently, and when I noticed, I looked at the docs again and had the feeling that I might not have been the first one to miss this.

The same issue of trusting the return value of `read` was also present in std itself for about 2.5 years and only fixed recently, see #80895.

I hope that clarifying the docs might help others to avoid this issue.

3 years agoRollup merge of #82846 - GuillaumeGomez:doc-alias-list, r=jyn514
Dylan DPC [Fri, 19 Mar 2021 14:03:21 +0000 (15:03 +0100)]
Rollup merge of #82846 - GuillaumeGomez:doc-alias-list, r=jyn514

rustdoc: allow list syntax for #[doc(alias)] attributes

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

It now allows to have:

```rust
#[doc(alias = "x")]
// and:
#[doc(alias("y", "z"))]
```

cc ``@jplatte``
r? ``@jyn514``

3 years agoRollup merge of #82759 - m-ou-se:remove-unwrap-none, r=petrochenkov
Dylan DPC [Fri, 19 Mar 2021 14:03:20 +0000 (15:03 +0100)]
Rollup merge of #82759 - m-ou-se:remove-unwrap-none, r=petrochenkov

Remove unwrap_none/expect_none from compiler/.

We're not going to stabilize `Option::{unwrap_none, expect_none}`. (See https://github.com/rust-lang/rust/issues/62633.) This removes the usage of those unstable methods from `compiler/`.

3 years agoRollup merge of #82500 - CDirkx:hermit-pipe, r=joshtriplett
Dylan DPC [Fri, 19 Mar 2021 14:03:14 +0000 (15:03 +0100)]
Rollup merge of #82500 - CDirkx:hermit-pipe, r=joshtriplett

Reuse `std::sys::unsupported::pipe` on `hermit`

Pipes are not supported on `hermit` and `hermit/pipe.rs` is identical to `unsupported/pipe.rs`. This PR reduces duplication between the two by doing the following on `hermit`:

```rust
#[path = "../unsupported/pipe.rs"]
pub mod pipe;
```

3 years agoAdd a second regression test
Oli Scherer [Fri, 19 Mar 2021 13:30:27 +0000 (13:30 +0000)]
Add a second regression test

3 years agoAuto merge of #82754 - rylev:rusage-windows, r=pnkfelix
bors [Fri, 19 Mar 2021 12:44:33 +0000 (12:44 +0000)]
Auto merge of #82754 - rylev:rusage-windows, r=pnkfelix

Attempt to gather similar stats as rusage on Windows

A follow up to #82532. This is a bit hacked in because I think we need to discuss this before merging, but this is an attempt to gather similar metrics as `libc::rusage` on Windows.

Some comments on differences:
* Currently, we're passing `RUSAGE_CHILDREN` to `rusage` which collects statistics on all children that have been waited on and terminated. I believe this is currently just the invocation of the real `rustc` that the shim is wrapping. Does `rustc` itself spawn children processes? The windows version gets the child processes handle when spawning it, and uses that to collect the statistics. For maxrss, `rusage` will return "the resident set size of the largest child, not the maximum resident set size of the process tree.", the Windows version will only collect statistics on the wrapped `rustc` child process directly even if some theoretical sub process has a larger memory footprint.
* There might be subtle differences between `rusage`'s "resident set" and Window's "working set". The "working set" and "resident set" should both be the number of pages that are in memory and which would not cause a page fault when accessed.
* I'm not yet sure how best to get the same information that `ru_minflt`, `ru_inblock`, `ru_oublock`, `ru_nivcsw ` and `ru_nvcsw` provide.

r? `@pnkfelix`

3 years agoDo not ICE on ty::Error as an error must already have been reported
Oli Scherer [Fri, 19 Mar 2021 11:46:27 +0000 (11:46 +0000)]
Do not ICE on ty::Error as an error must already have been reported

3 years agoRevert performance-sensitive change in #82436
Ömer Sinan Ağacan [Fri, 19 Mar 2021 08:37:52 +0000 (11:37 +0300)]
Revert performance-sensitive change in #82436

This change was done in #82436, as an "optimization". Unfortunately I
missed that this code is not always executed, because of the "continue"
in the conditional above it.

This commit should solve the perf regressions introduced by #82436 as I
think there isn't anything else that could affect runtime performance in
that PR. The `Pick` type grows only one word, which I doubt can cause up
to 8.8% increase in RSS in some of the benchmarks.

3 years agoHash hir_owner in typeck results
Aman Arora [Fri, 19 Mar 2021 04:39:39 +0000 (00:39 -0400)]
Hash hir_owner in typeck results

3 years agoAuto merge of #71780 - jcotton42:string_remove_matches, r=joshtriplett
bors [Fri, 19 Mar 2021 00:47:37 +0000 (00:47 +0000)]
Auto merge of #71780 - jcotton42:string_remove_matches, r=joshtriplett

Implement String::remove_matches

Closes #50206.

I lifted the function help from `@frewsxcv's` original PR (#50015), hope they don't mind.

I'm also wondering whether it would be useful for `remove_matches` to collect up the removed substrings into a `Vec` and return them, right now they're just overwritten by the copy and lost.

3 years agoReplace closures_captures and upvar_capture with closure_min_captures
Jennifer Wills [Wed, 23 Dec 2020 20:38:22 +0000 (15:38 -0500)]
Replace closures_captures and upvar_capture with closure_min_captures

make changes to liveness to use closure_min_captures

use different span

borrow check uses new structures

rename to CapturedPlace

stop using upvar_capture in regionck

remove the bridge

cleanup from rebase + remove the upvar_capture reference from mutability_errors.rs

remove line from livenes test

make our unused var checking more consistent

update tests

adding more warnings to the tests

move is_ancestor_or_same_capture to rustc_middle/ty

update names to reflect the closures

add FIXME

check that all captures are immutable borrows before returning

add surrounding if statement like the original

move var out of the loop and rename

Co-authored-by: Logan Mosier <logmosier@gmail.com>
Co-authored-by: Roxane Fruytier <roxane.fruytier@hotmail.com>
3 years agoMark early otherwise optimization unsound
Santiago Pastorino [Thu, 18 Mar 2021 20:35:46 +0000 (17:35 -0300)]
Mark early otherwise optimization unsound

3 years agoUpdate LLVM to bring in SIMD updates for WebAssembly
Alex Crichton [Thu, 18 Mar 2021 18:12:28 +0000 (11:12 -0700)]
Update LLVM to bring in SIMD updates for WebAssembly

This is a continuation of https://github.com/rust-lang/llvm-project/pull/96
to continue to make progress on updating Rust's support for SIMD
intrinsics on WebAssembly to the latest version of the specification.

3 years agoClarify docs for Read::read's return value
Jannis Harder [Mon, 8 Mar 2021 10:58:05 +0000 (11:58 +0100)]
Clarify docs for Read::read's return value

3 years agoFix pluralization in keyword docs
Stephen Albert-Moore [Thu, 18 Mar 2021 21:04:58 +0000 (17:04 -0400)]
Fix pluralization in keyword docs

3 years agoApply suggestions from code review
J. Frimmel [Thu, 18 Mar 2021 20:15:19 +0000 (21:15 +0100)]
Apply suggestions from code review

Co-authored-by: Josh Triplett <josh@joshtriplett.org>
3 years agocorrect macro names
SparrowLii [Thu, 18 Mar 2021 19:47:13 +0000 (03:47 +0800)]
correct macro names

3 years agoAdd simd_neg platform intrinsic
SparrowLii [Thu, 18 Mar 2021 18:16:21 +0000 (02:16 +0800)]
Add simd_neg platform intrinsic

3 years agoFix typo/inaccuracy in the documentation of Iterator::skip_while
Frank Steffahn [Thu, 18 Mar 2021 17:58:22 +0000 (18:58 +0100)]
Fix typo/inaccuracy in the documentation of Iterator::skip_while

One of the examples used to say “this leads to a possibly confusing situation,
where the type of the closure is a double reference” while _actually_ referring to
the type of the closure _argument_.

3 years agoRevert the second deprecation of collections::Bound
bstrie [Thu, 18 Mar 2021 17:57:31 +0000 (13:57 -0400)]
Revert the second deprecation of collections::Bound

3 years agoUpgrade memmap to memmap2 in other crates.
Camille GILLOT [Wed, 17 Mar 2021 16:29:45 +0000 (17:29 +0100)]
Upgrade memmap to memmap2 in other crates.

3 years agoAuto merge of #83257 - RalfJung:miri, r=RalfJung
bors [Thu, 18 Mar 2021 17:31:11 +0000 (17:31 +0000)]
Auto merge of #83257 - RalfJung:miri, r=RalfJung

update Miri

Fixes https://github.com/rust-lang/rust/issues/83242
Cc `@rust-lang/miri` r? `@ghost`

3 years agoExtend `proc_macro_back_compat` lint to `actix-web`
Aaron Hill [Tue, 16 Mar 2021 02:59:21 +0000 (22:59 -0400)]
Extend `proc_macro_back_compat` lint to `actix-web`

Unlike the other cases of this lint, there's no simple way to detect if
an old version of the relevant crate (`syn`) is in use. The `actix-web`
crate only depends on `pin-project` v1.0.0, so checking the version of
`actix-web` does not guarantee that a new enough version of
`pin-project` (and therefore `syn`) is in use.

Instead, we rely on the fact that virtually all of the regressed crates
are pinned to a pre-1.0 version of `pin-project`. When this is the case,
bumping the `actix-web` dependency will pull in the *latest* version of
`pin-project`, which has an explicit dependency on a newer v dependency
on a newer version of `syn`.

The lint message tells users to update `actix-web`, since that's what
they're most likely to have control over. We could potentially tell them
to run `cargo update -p syn`, but I think it's more straightforward to
suggest an explicit change to the `Cargo.toml`

The `actori-web` fork had its last commit over a year ago, and appears
to just be a renamed fork of `actix-web`. Therefore, I've removed the
`actori-web` check entirely - any crates that actually get broken can
simply update `syn` themselves.

3 years agoAuto merge of #83166 - cjgillot:defkey-vge, r=oli-obk
bors [Thu, 18 Mar 2021 14:46:38 +0000 (14:46 +0000)]
Auto merge of #83166 - cjgillot:defkey-vge, r=oli-obk

Iterate on DefId for variances and generics.

Split from #80347

3 years agoIncorporate review feedback #2
Julian Frimmel [Thu, 18 Mar 2021 14:15:28 +0000 (15:15 +0100)]
Incorporate review feedback #2

3 years agoRemove unwrap_none/expect_none from compiler/.
Mara Bos [Thu, 4 Mar 2021 12:06:01 +0000 (13:06 +0100)]
Remove unwrap_none/expect_none from compiler/.

3 years agoAdd more information about panicking
Julian Frimmel [Thu, 18 Mar 2021 13:23:05 +0000 (14:23 +0100)]
Add more information about panicking

This includes the description of the default `std` behavior and mentions
the `panic::set_hook()` function.

3 years agoupdate Miri
Ralf Jung [Thu, 18 Mar 2021 11:14:31 +0000 (12:14 +0100)]
update Miri

3 years agoAuto merge of #77566 - Marwes:smaller_hashmap, r=Amanieu
bors [Thu, 18 Mar 2021 11:03:49 +0000 (11:03 +0000)]
Auto merge of #77566 - Marwes:smaller_hashmap, r=Amanieu

feat: Update hashbrown to instantiate less llvm IR

Includes https://github.com/rust-lang/hashbrown/pull/204 and https://github.com/rust-lang/hashbrown/pull/205 (not yet merged) which both serve to reduce the amount of IR generated for hashmaps.

Inspired by the llvm-lines data gathered in https://github.com/rust-lang/rust/pull/76680 (cc `@Julian-Wollersberger)`

3 years agoInclude output stream in `panic!()` documentation
Julian Frimmel [Thu, 18 Mar 2021 08:52:21 +0000 (09:52 +0100)]
Include output stream in `panic!()` documentation

3 years agoAuto merge of #81312 - dylni:clarify-btree-range-search-comments, r=m-ou-se
bors [Thu, 18 Mar 2021 08:18:06 +0000 (08:18 +0000)]
Auto merge of #81312 - dylni:clarify-btree-range-search-comments, r=m-ou-se

Clarify BTree `range_search` comments

These comments were added by #81169. However, the soundness issue [might not be exploitable here](https://github.com/rust-lang/rust/pull/81169#issuecomment-765271717), so the comments should be updated.

cc `@ssomers`

3 years agoAuto merge of #82868 - petrochenkov:bto, r=estebank
bors [Thu, 18 Mar 2021 05:27:26 +0000 (05:27 +0000)]
Auto merge of #82868 - petrochenkov:bto, r=estebank

Report missing cases of `bare_trait_objects`

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

3 years agoAuto merge of #76447 - pickfire:async-pub, r=estebank
bors [Thu, 18 Mar 2021 02:32:39 +0000 (02:32 +0000)]
Auto merge of #76447 - pickfire:async-pub, r=estebank

Detect async visibility wrong order, `async pub`

Partially address #76437.

3 years agoReport missing cases of `bare_trait_objects`
Vadim Petrochenkov [Thu, 18 Mar 2021 00:02:44 +0000 (03:02 +0300)]
Report missing cases of `bare_trait_objects`

3 years agohir: Preserve used syntax in `TyKind::TraitObject`
Vadim Petrochenkov [Sat, 13 Mar 2021 12:44:29 +0000 (15:44 +0300)]
hir: Preserve used syntax in `TyKind::TraitObject`

3 years agoAuto merge of #83247 - Dylan-DPC:rollup-bdwmvjg, r=Dylan-DPC
bors [Wed, 17 Mar 2021 23:39:51 +0000 (23:39 +0000)]
Auto merge of #83247 - Dylan-DPC:rollup-bdwmvjg, r=Dylan-DPC

Rollup of 11 pull requests

Successful merges:

 - #82191 (Vec::dedup_by optimization)
 - #82270 (Emit error when trying to use assembler syntax directives in `asm!`)
 - #82434 (Add more links between hash and btree collections)
 - #83080 (Make source-based code coverage compatible with MIR inlining)
 - #83168 (Extend `proc_macro_back_compat` lint to `procedural-masquerade`)
 - #83192 (ci/docker: Add SDK/NDK level 21 to android docker for 32bit platforms)
 - #83204 (Simplify C compilation for Fortanix-SGX target)
 - #83216 (Allow registering tool lints with `register_tool`)
 - #83223 (Display error details when a `mmap` call fails)
 - #83228 (Don't show HTML diff if tidy isn't installed for rustdoc tests)
 - #83231 (Switch riscvgc-unknown-none-elf use lp64d ABI)

Failed merges:

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

3 years agoRollup merge of #83231 - DieracDelta:lp64d-abi-for-riscvgc-unknown-none-elf, r=estebank
Dylan DPC [Wed, 17 Mar 2021 23:28:17 +0000 (00:28 +0100)]
Rollup merge of #83231 - DieracDelta:lp64d-abi-for-riscvgc-unknown-none-elf, r=estebank

Switch riscvgc-unknown-none-elf use lp64d ABI

Corrects #83229 by directly specifying the target abi in the spec in the same way as is done for the `riscv64gc-unknown-linux-gnu` target [here](https://github.com/rust-lang/rust/blob/master/compiler/rustc_target/src/spec/riscv64gc_unknown_linux_gnu.rs).

3 years agoRollup merge of #83228 - GuillaumeGomez:no-diff-if-no-tidy, r=jyn514
Dylan DPC [Wed, 17 Mar 2021 23:28:16 +0000 (00:28 +0100)]
Rollup merge of #83228 - GuillaumeGomez:no-diff-if-no-tidy, r=jyn514

Don't show HTML diff if tidy isn't installed for rustdoc tests

The output without the `tidy` tool is just way too big to be of any use. It makes reading the error much more complicated.

r? ``@jyn514``

3 years agoRollup merge of #83223 - JohnTitor:display-err-from-mmap, r=joshtriplett
Dylan DPC [Wed, 17 Mar 2021 23:28:15 +0000 (00:28 +0100)]
Rollup merge of #83223 - JohnTitor:display-err-from-mmap, r=joshtriplett

Display error details when a `mmap` call fails

Fixes #82388

3 years agoRollup merge of #83216 - jyn514:register-tool, r=petrochenkov
Dylan DPC [Wed, 17 Mar 2021 23:28:14 +0000 (00:28 +0100)]
Rollup merge of #83216 - jyn514:register-tool, r=petrochenkov

Allow registering tool lints with `register_tool`

Previously, there was no way to add a custom tool prefix, even if the tool
itself had registered a lint:

 ```rust
 #![feature(register_tool)]
 #![register_tool(xyz)]
 #![warn(xyz::my_lint)]
 ```

```
$ rustc unknown-lint.rs  --crate-type lib
error[E0710]: an unknown tool name found in scoped lint: `xyz::my_lint`
 --> unknown-lint.rs:3:9
  |
3 | #![warn(xyz::my_lint)]
  |         ^^^
```

This allows opting-in to lints from other tools using `register_tool`.

cc https://github.com/rust-lang/rust/issues/66079#issuecomment-788589193, ``@chorman0773``
r? ``@petrochenkov``

3 years agoRollup merge of #83204 - jethrogb:jb/sgx-c-build, r=joshtriplett,raoulstrackx
Dylan DPC [Wed, 17 Mar 2021 23:28:12 +0000 (00:28 +0100)]
Rollup merge of #83204 - jethrogb:jb/sgx-c-build, r=joshtriplett,raoulstrackx

Simplify C compilation for Fortanix-SGX target

cc ``@raoulstrackx``

3 years agoRollup merge of #83192 - kinnison:add-android-21, r=Mark-Simulacrum
Dylan DPC [Wed, 17 Mar 2021 23:28:11 +0000 (00:28 +0100)]
Rollup merge of #83192 - kinnison:add-android-21, r=Mark-Simulacrum

ci/docker: Add SDK/NDK level 21 to android docker for 32bit platforms

Certain features of Linux (getauxval() and epoll_create1()) are only
available in android SDK/NDK levels 18 and 21 respectively.  The 32bit
platform is currently on level 14 for compatibility with Android 4.0.

This patch adds SDK/NDK level 21 to the docker for 32 bit platforms,
while leaving the default setup at level 14.

With this done, projects such as `rustup` which rely on these dockers
can build with modern ecosystem crates such as tokio 1.0, by using
the level 21 toolchain, but those which do not need to switch will
be unaffected, since the level 14 toolchain remains available.

3 years agoRollup merge of #83168 - Aaron1011:lint-procedural-masquerade, r=petrochenkov
Dylan DPC [Wed, 17 Mar 2021 23:28:10 +0000 (00:28 +0100)]
Rollup merge of #83168 - Aaron1011:lint-procedural-masquerade, r=petrochenkov

Extend `proc_macro_back_compat` lint to `procedural-masquerade`

We now lint on *any* use of `procedural-masquerade` crate. While this
crate still exists, its main reverse dependency (`cssparser`) no longer
depends on it. Any crates still depending off should stop doing so, as
it only exists to support very old Rust versions.

If a crate actually needs to support old versions of rustc via
`procedural-masquerade`, then they'll just need to accept the warning
until we remove it entirely (at the same time as the back-compat hack).
The latest version of `procedural-masquerade` does work with the
latest rustc, but trying to check for the version seems like more
trouble than it's worth.

While working on this, I realized that the `proc-macro-hack` check was
never actually doing anything. The corresponding enum variant in
`proc-macro-hack` is named `Value` or `Nested` - it has never been
called `Input`. Due to a strange Crater issue, the Crater run that
tested adding this did *not* end up testing it - some of the crates that
would have failed did not actually have their tests checked, making it
seem as though the `proc-macro-hack` check was working.

The Crater issue is being discussed at
https://rust-lang.zulipchat.com/#narrow/stream/242791-t-infra/topic/Nearly.20identical.20Crater.20runs.20processed.20a.20crate.20differently/near/230406661

Despite the `proc-macro-hack` check not actually doing anything, we
haven't gotten any reports from users about their build being broken.
I went ahead and removed it entirely, since it's clear that no one is
being affected by the `proc-macro-hack` regression in practice.

3 years agoRollup merge of #83080 - tmiasko:inline-coverage, r=wesleywiser
Dylan DPC [Wed, 17 Mar 2021 23:28:09 +0000 (00:28 +0100)]
Rollup merge of #83080 - tmiasko:inline-coverage, r=wesleywiser

Make source-based code coverage compatible with MIR inlining

When codegenning code coverage use the instance that coverage data was
originally generated for, to ensure basic level of compatibility with
MIR inlining.

Fixes #83061