Commit graph

135900 commits

Author SHA1 Message Date
bors
a609fb45ef Auto merge of #80547 - lqd:const_generics_defaults, r=varkor
In which we start to parse const generics defaults

As discussed in this [zulip topic](https://rust-lang.zulipchat.com/#narrow/stream/260443-project-const-generics/topic/const.20generic.20defaults), this PR extracts the parsing parts from `@JulianKnodt's` PR #75384 for a better user-experience using the newly stabilized `min_const_generics` (albeit temporary) as shown in #80507: trying to use default values on const generics currently results in parse errors, as if the user didn't use the correct syntax (which is somewhat true but also misleading).

This PR extracts (and slightly modifies in a couple places) `@JulianKnodt's` parsing code (with attribution if I've done everything correctly), AST and HIR changes, and feature gate setup.

This feature is now marked as "incomplete" and thus will also print out the expected "const generics default values are unstable" error instead of a syntax error. Note that, as I've only extracted the parsing part, the actual feature will not work at all if enabled. There will be ICEs, and inference errors on the const generics default values themselves.

Fixes #80507.

Once this merges, I'll:
- modify the const generics tracking issue to refer to the `const_generics_defaults` gate rather than the older temporary name it uses there.
- create the GH `F-const_generics_defaults` label

r? `@varkor`
2021-01-01 13:17:42 +00:00
bors
18d27b2c94 Auto merge of #80310 - Manishearth:box-try-alloc, r=kennytm
Add fallible Box, Arc, and Rc allocator APIs

cc https://github.com/rust-lang/rust/issues/48043

It was suggested in https://github.com/rust-lang/rust/issues/48043#issuecomment-748008486 that `Box::try_*` follows the spirit of RFC 2116. This PR is an attempt to add the relevant APIs, tied to the same feature gate. Happy to make any changes or turn this into an RFC if necessary.

cc `@rust-lang/wg-allocators`
2021-01-01 10:29:43 +00:00
Rémy Rakic
942b7ce2c1 make const_generics_defaults use the unstable syntax mechanism
This is important to not accidentally stabilize the parsing of the syntax while it still is experimental and not formally accepted
2021-01-01 11:01:01 +01:00
Rémy Rakic
1fc3c4c16d adjust const generics defaults FIXMEs to the new feature gate 2021-01-01 11:01:01 +01:00
Rémy Rakic
907ba75eb0 update min_const_generics tests using default values for const params
The `const_generics_defaults` now handles them, and they correctly parse, so we can update these tests expecting a parser error .
2021-01-01 10:55:17 +01:00
Rémy Rakic
64244b2201 add test for the const_generics_defaults feature gate 2021-01-01 10:55:16 +01:00
Rémy Rakic
ea8fa36bb4 mark const_generics_defaults as an incomplete feature 2021-01-01 10:55:16 +01:00
Rémy Rakic
5f4bb468c1 fix typo in feature gates file 2021-01-01 10:55:16 +01:00
Julian Knodt
48dec842f2 first pass at default values for const generics
- Adds optional default values to const generic parameters in the AST
  and HIR
- Parses these optional default values
- Adds a `const_generics_defaults` feature gate
2021-01-01 10:55:10 +01:00
Julian Knodt
61f33bfd29 first pass at default values for const generics
- Adds optional default values to const generic parameters in the AST
  and HIR
- Parses these optional default values
- Adds a `const_generics_defaults` feature gate
2021-01-01 10:55:10 +01:00
bors
60919e416d Auto merge of #6526 - matthiaskrgr:version, r=Manishearth
make clippy version number correspond to rustc version number.

clippy 0.1.50 corresponds to rustc 1.50.x

This bumps the clippy version number from 0.0.212 to 0.1.50

Fixes #6499

Notes:
I used `cargo --version` because that way we can honour the version set in the `rust-toolchain` file.
When we bump the bootstrap compiler from 1.50 to 1.51, the version numbers will have to be changed to 1.51 or the test will fail.

---

changelog: make clippy version number correspond to rustc version number (rust 1.50.0 -> clippy 0.1.50)
2021-01-01 09:01:32 +00:00
bors
e1fc9ff4a7 Auto merge of #80539 - JohnTitor:ui-test-root-cleanup, r=petrochenkov
Reduce the entry on `src/test/ui` (UI test root)

CC #73494, similar to #79776.

r? `@petrochenkov`
2021-01-01 07:46:11 +00:00
Joshua Nelson
139ef750ee Clean bootstrap artifacts on x.py clean 2021-01-01 00:02:54 -05:00
Corey Farwell
d482de30ea Merge remote-tracking branch 'origin/master' into frewsxcv-san 2020-12-31 23:27:33 -05:00
bors
f8ab56bf32 Auto merge of #79576 - m-ou-se:2021, r=Mark-Simulacrum
Add edition 2021.

🎆 Happy new ~~year~~ Rust. 🍾

This adds --edition=2021, and updates suggestions about 2018 to say "2018 *or later*".

Related Cargo PR: https://github.com/rust-lang/cargo/pull/8922

---

Edit: This adds the new edition as *unstable*. Without `-Z unstable-options`, `--edition=2021` results in:
```
$ rustc --edition=2021
error: edition 2021 is unstable and only available with -Z unstable-options.
```
2021-01-01 03:41:31 +00:00
bors
99ad5a1a28 Auto merge of #80566 - Dylan-DPC:rollup-rns6est, r=Dylan-DPC
Rollup of 8 pull requests

Successful merges:

 - #80323 (Update and improve `rustc_codegen_{llvm,ssa}` docs)
 - #80368 (rustdoc: Render visibilities succinctly)
 - #80514 (Fix broken ./x.py install)
 - #80519 (Take type defaults into account in suggestions to reorder generic parameters)
 - #80526 (Update LLVM)
 - #80532 (remove unnecessary trailing semicolon from bootstrap)
 - #80548 (FIx ICE on wf check for foreign fns)
 - #80551 (support pattern as const parents in type_of)

Failed merges:

 - #80547 (In which we start to parse const generics defaults)

r? `@ghost`
`@rustbot` modify labels: rollup
2021-01-01 00:59:12 +00:00
Michael Howell
a3958d039d
Use Array.prototype.filter instead of open-coding
Part of #79052, originally suggested in https://github.com/rust-lang/rust/pull/79052#discussion_r523468743

Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2020-12-31 17:51:46 -07:00
Yuki Okushi
9fb9f290b4 Reduce ROOT_ENTRY_LIMIT to 1500 2021-01-01 09:23:11 +09:00
Yuki Okushi
4530da7ff0 Move feature gate-related tests 2021-01-01 09:23:11 +09:00
Yuki Okushi
97031b12cf Move rmeta-related tests 2021-01-01 09:23:10 +09:00
Yuki Okushi
a73ad6b22a Move builtin-superkinds-related tests 2021-01-01 09:23:10 +09:00
Yuki Okushi
049971c990 Move block-related tests 2021-01-01 09:23:10 +09:00
Dylan DPC
96c11f98d7
Rollup merge of #80551 - lcnr:const-arg-wildcard, r=varkor
support pattern as const parents in type_of

nice to know that there's still stuff about rust i didn't know about 😆

fixes #80531

r? `@varkor`
2020-12-31 22:21:00 +01:00
Dylan DPC
33806d2599
Rollup merge of #80548 - JohnTitor:wfcheck-foreign-fn-ice, r=davidtwco
FIx ICE on wf check for foreign fns

Fixes #80468

r? `@davidtwco` `@lcnr`
2020-12-31 22:20:59 +01:00
Dylan DPC
30c4e6da85
Rollup merge of #80532 - tmiasko:rm;, r=Mark-Simulacrum
remove unnecessary trailing semicolon from bootstrap
2020-12-31 22:20:56 +01:00
Dylan DPC
408573d031
Rollup merge of #80526 - tmandry:up-llvm, r=nikic
Update LLVM

- [GlobalISel][IRTranslator] Fix a crash when the use of an extractvalue is a non-dominated metadata use.
- [asan] Use dynamic shadow memory position on Apple Silicon macOS

r? ``@cuviper``
2020-12-31 22:20:55 +01:00
Dylan DPC
1f431f9066
Rollup merge of #80519 - max-heller:issue-80512-fix, r=varkor
Take type defaults into account in suggestions to reorder generic parameters

Fixes #80512
2020-12-31 22:20:53 +01:00
Dylan DPC
5bffc265b0
Rollup merge of #80514 - pietroalbini:fix-install, r=Mark-Simulacrum
Fix broken ./x.py install

During my tarball refactorings in https://github.com/rust-lang/rust/pull/79788 I changed the directory layout used by the tarball generation code, and that broke the other parts of rustbuild which hardcoded the paths of those directories. Namely, `./x.py install` relied on the uncompressed copy of the tarball left behind by `fabricate`/`rust-installer`, causing https://github.com/rust-lang/rust/issues/80494.

While the easy fix for https://github.com/rust-lang/rust/issues/80494 would've been to just update the hardcoded paths to match the new structure, that fix would leave us in the same situation if we were to change the directory layout again in the future. Instead I refactored the code to return a `GeneratedTarball` struct as the output of all the dist steps, and I put all the paths the rest of rustbuild needs to care about in its fields. That way, future changes to `src/bootstrap/tarball.rs` will not break other stuff.

This PR is best reviewed commit-by-commit.
r? `@Mark-Simulacrum`
`@rustbot` modify labels: beta-nominated beta-accepted T-release
2020-12-31 22:20:51 +01:00
Dylan DPC
7d247c9246
Rollup merge of #80368 - camelid:rustdoc-succinct-vis, r=jyn514
rustdoc: Render visibilities succinctly

Fixes #79139.

r? `@jyn514`
2020-12-31 22:20:49 +01:00
Dylan DPC
55cfcd596f
Rollup merge of #80323 - camelid:codegen-base-docs, r=nagisa
Update and improve `rustc_codegen_{llvm,ssa}` docs

Fixes #75342.

These docs were very out of date and misleading. They even said that
they codegen'd the *AST*!

For some reason, the `rustc_codegen_ssa::base` docs were exactly
identical to the `rustc_codegen_llvm::base` docs. They didn't really
make sense, because they had LLVM-specific information even though
`rustc_codegen_ssa` is supposed to be somewhat generic. So I removed
them as they were misleading.

r? ``@pnkfelix`` maybe?
2020-12-31 22:20:43 +01:00
Camelid
2c405aea5d Fix tests that incorrectly used !@has instead of @!has
The command is `@!has`, not `!@has`. I don't think these checks were
doing anything before! Ideally we would accept `!@has` as well, or at
least fail tests that use `!@has`. The current behavior seems to be
silently ignoring the check, which is very confusing.
2020-12-31 12:47:09 -08:00
Camelid
5604a18a60 Add @!has checks to ensure private items don't have pub 2020-12-31 12:08:20 -08:00
Camelid
dda887a02c Add FIXME for visibility of a module 2020-12-31 12:00:23 -08:00
Camelid
0506789014 Remove many unnecessary manual link resolves from library
Now that #76934 has merged, we can remove a lot of these! E.g, this is
no longer necessary:

    [`Vec<T>`]: Vec
2020-12-31 11:54:32 -08:00
Mara Bos
3cbdbe8dcd Enable Pat2021 in edition 2021. 2020-12-31 19:39:44 +01:00
Mara Bos
3d9d0e9d3e Require -Z unstable-options for unstable editions. 2020-12-31 19:06:09 +01:00
Mara Bos
c574ded57d Consistently call editions "Rust 20xx" in messages. 2020-12-31 19:06:09 +01:00
Mara Bos
f16ef7d7ce Add edition 2021. 2020-12-31 19:06:09 +01:00
Manish Goregaokar
375e7c5864 More inline, doc fixes 2020-12-31 16:49:44 +00:00
Manish Goregaokar
8f3cb7d75d Make [A]Rc::allocate_for_layout() use try_allocate_for_layout() 2020-12-31 16:36:28 +00:00
Matthias Krüger
59397d6abb make clippy version number correspond to rustc version number.
clippy 0.1.50 corresponds to rustc 1.50.x

This bumps the clippy version number from 0.0.212 to 0.1.50

Fixes #6499
2020-12-31 16:29:26 +01:00
bors
44e3daf5ee Auto merge of #80459 - mark-i-m:or-pat-reg, r=petrochenkov
Implement edition-based macro :pat feature

This PR does two things:
1. Fixes the perf regression from https://github.com/rust-lang/rust/pull/80100#issuecomment-750893149
2. Implements `:pat2018` and `:pat2021` matchers, as described by `@joshtriplett`  in https://github.com/rust-lang/rust/issues/54883#issuecomment-745509090 behind the feature gate `edition_macro_pat`.

r? `@petrochenkov`

cc `@Mark-Simulacrum`
2020-12-31 14:52:26 +00:00
Bastian Kauschke
2aef46b17b support pattern as const parents in type_of 2020-12-31 14:10:49 +01:00
Mara Bos
929a64fd4c
Improve library tracking issue template 2020-12-31 13:52:39 +01:00
bors
b33e234155 Auto merge of #79895 - Kerollmops:slice-group-by, r=m-ou-se
The return of the GroupBy and GroupByMut iterators on slice

According to https://github.com/rust-lang/rfcs/pull/2477#issuecomment-742034372, I am opening this PR again, this time I implemented it in safe Rust only, it is therefore much easier to read and is completely safe.

This PR proposes to add two new methods to the slice, the `group_by` and `group_by_mut`. These two methods provide a way to iterate over non-overlapping sub-slices of a base slice that are separated by the predicate given by the user (e.g. `Partial::eq`, `|a, b| a.abs() < b.abs()`).

```rust
let slice = &[1, 1, 1, 3, 3, 2, 2, 2];

let mut iter = slice.group_by(|a, b| a == b);
assert_eq!(iter.next(), Some(&[1, 1, 1][..]));
assert_eq!(iter.next(), Some(&[3, 3][..]));
assert_eq!(iter.next(), Some(&[2, 2, 2][..]));
assert_eq!(iter.next(), None);
```

[An RFC](https://github.com/rust-lang/rfcs/pull/2477) was open 2 years ago but wasn't necessary.
2020-12-31 12:00:43 +00:00
Clément Renault
8b53be6604
Replace the tracking issue for the slice_group_by feature 2020-12-31 12:13:03 +01:00
Clément Renault
a2d55d70c4
Add an extra example to the two methods 2020-12-31 11:57:40 +01:00
Pietro Albini
8e0ab0fb5e
bootstrap: use the correct paths during ./x.py install 2020-12-31 11:38:32 +01:00
Pietro Albini
1fab57491d
bootstrap: change the dist outputs to GeneratedTarball
The struct will allow to store more context on the generated tarballs.
2020-12-31 11:38:05 +01:00
Pietro Albini
aac429ffd3
bootstrap: never delete the tarball temporary directory
Files in the temporary directory are used by ./x.py install.
2020-12-31 11:34:38 +01:00