Commit graph

140669 commits

Author SHA1 Message Date
The8472
2d8be45743 disable debug assertions in codegen test 2021-03-21 23:05:36 +01:00
Mara Bos
2bd7c1b5de Bump slice_iter_mut_as_slice stable version. 2021-03-21 23:01:28 +01:00
bors
97663b6690 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).
2021-03-21 21:54:09 +00:00
Camelid
f820fd2bc0 rustdoc: Replace pair of Options with an enum
They are never both `None` or both `Some`, so it makes more sense to use
an enum so that we "make impossible states impossible".
2021-03-21 14:42:06 -07:00
Camelid
bfae41d7b0 Fix ICE with use clippy:🅰️:b; 2021-03-21 14:20:28 -07:00
Ralf Jung
4e7f1fa14f post-drop-elab check-const: explain why we still check qualifs 2021-03-21 21:20:59 +01:00
Nikita Popov
68a62b76d4 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.
2021-03-21 20:54:42 +01:00
Nikita Popov
6ac229ca21 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).
2021-03-21 20:54:42 +01:00
The8472
17f4c2a487 add codegen test 2021-03-21 20:54:06 +01:00
The8472
6c67e55270 specialize in-place collection further via TrustedRandomAccess
This allows the optimizer to turn certain iterator pipelines such as

```rust
let vec = vec![0usize; 100];
vec.into_iter().map(|e| e as isize).collect::<Vec<_>>()
```

into a noop.

The optimization only applies when iterator sources are  `T: Copy`
since `impl TrustedRandomAccess for IntoIter<T>`.
No such requirement applies to the output type (`Iterator::Item`).
2021-03-21 20:54:06 +01:00
The8472
a1a04e0842 add transmute-via-iterators bench 2021-03-21 20:54:05 +01:00
The8472
08a1dd287d implement TrustedRandomAccess for array::IntoIter 2021-03-21 20:43:48 +01:00
The8472
895d7a9a09 implement TrustedRandomAccess for Ranges over int types 2021-03-21 20:43:48 +01:00
The8472
1438207c3d use BITS constant 2021-03-21 20:41:01 +01:00
The8472
236c0cf103 implement TrustedLen and TrustedRandomAccess for VecDeque iterators 2021-03-21 20:41:01 +01:00
Nikita Popov
39ed64399e Enable mutable noalias by default for LLVM 12
We don't have any known noalias bugs for LLVM 12 ... yet.
2021-03-21 20:10:54 +01:00
Nikita Popov
c3f9403f59 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.
2021-03-21 20:10:53 +01:00
Nikita Popov
08c5ffd4a3 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.
2021-03-21 20:10:53 +01:00
Nikita Popov
dfc4cafe8e 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.
2021-03-21 20:10:53 +01:00
Mara Bos
0acdada18b Bump osstring_ascii stabilization version to 1.53.0. 2021-03-21 17:49:14 +01:00
bors
f82664191d Auto merge of #83053 - oli-obk:const_stab_version, r=m-ou-se
Fix const stability `since` versions.

fixes #82085

r? `@m-ou-se`
2021-03-21 16:21:39 +00:00
Joshua Nelson
4002171315 Download a more recent LLVM version if src/version is modified
When bumping the bootstrap version, the name of the generated LLVM
shared object file is changed, even though it's the same contents as
before. If bootstrap tries to use an older version, it will get linking
errors:

```
Building rustdoc for stage1 (x86_64-unknown-linux-gnu)
   Compiling rustdoc-tool v0.0.0 (/home/joshua/rustc/src/tools/rustdoc)
error: linking with `cc` failed: exit code: 1
  |
  = note: "cc" "-Wl,--as-needed" ... lots of args ...
  = note: /usr/bin/ld: cannot find -lLLVM-12-rust-1.53.0-nightly
          clang: error: linker command failed with exit code 1 (use -v to see invocation)

error: could not compile `rustdoc-tool`
```
2021-03-21 12:10:34 -04:00
bors
ed75d0686e 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`
2021-03-21 13:00:22 +00:00
Aaron Hill
6d7294a00c
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`
2021-03-21 00:41:12 -04:00
asquared31415
9a9942cb23 add arm llvm requirement 2021-03-20 23:54:13 -04:00
bors
bbf07c0b4f 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
2021-03-21 03:36:22 +00:00
Dylan DPC
69f6a195da
Rollup merge of #83327 - tmiasko:visit-lhs, r=davidtwco
Extend comment in `UsedLocals::visit_lhs`
2021-03-21 02:01:40 +01:00
Dylan DPC
eec77d9967
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.
2021-03-21 02:01:39 +01:00
Dylan DPC
d778a80026
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`
2021-03-21 02:01:38 +01:00
Dylan DPC
0fa6831655
Rollup merge of #83280 - starthal:fix-typo-keyword-docs, r=dtolnay
Fix pluralization in keyword docs
2021-03-21 02:01:37 +01:00
Dylan DPC
118aba359b
Rollup merge of #83040 - lcnr:unused-ct-substs, r=oli-obk
extract `ConstKind::Unevaluated` into a struct

r? `@oli-obk`
2021-03-21 02:01:36 +01:00
Dylan DPC
3a113f18f8
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`
2021-03-21 02:01:34 +01:00
bors
ed4005da44 Auto merge of #83324 - Mark-Simulacrum:nextrel, r=Mark-Simulacrum
Bump to 1.53.0

r? `@Mark-Simulacrum`
2021-03-21 00:50:13 +00:00
Camelid
dc240faed5 Cleanup LLVM debuginfo module docs
* Use Markdown list syntax and unindent a bit to prevent Markdown
  interpreting the nested lists as code blocks
* A few more small typographical cleanups
2021-03-20 14:38:49 -07:00
Camelid
a2e9374048 Move debuginfo docs from doc.rs module to doc.md file
And use `#[doc = include_str!("doc.md")]` in `mod.rs` so the docs are
rendered as if they were inline in the root module.
2021-03-20 14:38:49 -07:00
lcnr
2885ca3cce bless mir-opt tests 2021-03-20 17:22:24 +01:00
lcnr
7c9b5b4ce0 update const_eval_resolve 2021-03-20 17:22:24 +01:00
lcnr
43ebac119b extract ConstKind::Unevaluated into a struct 2021-03-20 17:21:44 +01:00
bors
61edfd591c 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.
2021-03-20 16:20:21 +00:00
Mark Rousskov
cd2c6e9e5f Bump to 1.53.0 2021-03-20 12:19:30 -04:00
Caio
3490170893 Move some tests to more reasonable directories - 5 2021-03-20 11:41:24 -03:00
bors
41b315a470 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)
2021-03-20 09:01:35 +00:00
bors
eb9ec31168 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.
2021-03-20 06:36:42 +00:00
Stephen Albert-Moore
3855597186 Fix broken doc link reference 2021-03-20 00:36:41 -04:00
bors
cd82e451a8 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?
2021-03-20 03:49:10 +00:00
bstrie
567f0e1a39
Stabilize assoc_char_funcs and assoc_char_consts 2021-03-19 20:35:08 -07:00
Erik Desjardins
46fd49cdc3 avoid calling for types which can't be ZSTs 2021-03-19 22:25:56 -04:00
Aaron Hill
443cef5618
Debug-print result when an unstable fingerprint is detected 2021-03-19 21:47:57 -04:00
mark
b9ecba30bc update tests 2021-03-19 19:45:42 -05:00
mark
fd516af66d librustdoc: or_patterns are stable 2021-03-19 19:45:42 -05:00