Commit graph

135762 commits

Author SHA1 Message Date
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 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 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
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 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
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
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
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
bors a6bd5246da Auto merge of #80267 - 0urobor0s:ouro/61592, r=jyn514
Rustdoc render public underscore_imports as Re-exports

Fixes #61592
2020-12-31 09:07:52 +00:00
bors cb4553bdae Rustdoc render public underscore_imports as Re-exports
Fixes #61592
2020-12-31 09:07:51 +00:00
bors 8b002d5c34 Auto merge of #79150 - m-ou-se:bye-bye-doc-comment-hack, r=jyn514
Remove all doc_comment!{} hacks by using #[doc = expr] where needed.

This replaces about 200 cases of

`````rust
        doc_comment! {
            concat!("The smallest value that can be represented by this integer type.

# Examples

Basic usage:

```
", $Feature, "assert_eq!(", stringify!($SelfT), "::MIN, ", stringify!($Min), ");",
$EndFeature, "
```"),
            #[stable(feature = "assoc_int_consts", since = "1.43.0")]
            pub const MIN: Self = !0 ^ ((!0 as $UnsignedT) >> 1) as Self;
        }
`````
by
```rust
        /// The smallest value that can be represented by this integer type.
        ///
        /// # Examples
        ///
        /// Basic usage:
        ///
        /// ```
        #[doc = concat!("assert_eq!(", stringify!($SelfT), "::MIN, ", stringify!($Min), ");")]
        /// ```
        #[stable(feature = "assoc_int_consts", since = "1.43.0")]
        pub const MIN: Self = !0 ^ ((!0 as $UnsignedT) >> 1) as Self;
```

---

**Note:** For a usable diff, make sure to enable 'ignore whitspace': https://github.com/rust-lang/rust/pull/79150/files?diff=unified&w=1
2020-12-31 06:14:41 +00:00
bors 923e3d2400 Auto merge of #80500 - jyn514:track-caller, r=nagisa
Add `#[track_caller]` to `bug!` and `register_renamed`

Before:

```
thread 'rustc' panicked at 'compiler/rustc_lint/src/context.rs:267:18: invalid lint renaming of broken_intra_doc_links to rustdoc::broken_intra_doc_links', compiler/rustc_middle/src/util/bug.rs:34:26
```

After:

```
thread 'rustc' panicked at 'src/librustdoc/core.rs:455:24: invalid lint renaming of broken_intra_doc_links to rustdoc::broken_intra_doc_links', compiler/rustc_middle/src/util/bug.rs:35:26
```

The reason I added it to `register_renamed` too is that any panic in
that function will be the caller's fault.
2020-12-31 03:17:50 +00:00
Yuki Okushi 7008911080 FIx ICE on wf check for foreign fns 2020-12-31 11:25:53 +09:00
Camelid f7f14f6f0b Add note on panic behavior 2020-12-30 17:39:26 -08:00
Camelid 6f6afae41a Small refactor 2020-12-30 16:41:18 -08:00
Camelid 6c86ebab74 Remove FIXME
Co-authored-by: Joshua Nelson <jyn514@gmail.com>
2020-12-30 16:38:31 -08:00
Camelid 75705ab3a9 Update find_nearest_parent_module 2020-12-30 16:38:25 -08:00
bors f0073a59cf Auto merge of #80435 - pietroalbini:compression-formats, r=Mark-Simulacrum
Only produce .xz tarballs on CI

This PR adds a `./configure` option to choose which tarball compression formats to produce, and changes our CI configuration to only produce `.xz` tarballs. The release process will then recompress everything into `.gz` when producing a release.

This will drastically reduce our storage costs for CI artifacts, as we'd stop storing the same data twice. **Stable, beta and nightly releases will not be affected by this at all.**

Before landing this we'll need to increase the VM size of our release process, to recompress everything in a reasonable amount of time.
r? `@Mark-Simulacrum`
2020-12-31 00:23:13 +00:00
Mara Bos 4614cdd230 Fix typos. 2020-12-30 23:23:02 +01:00
Mara Bos 5694b8e471 Don't use doc_comment!{} hack in nonzero_leading_trailing_zeros!{}. 2020-12-30 22:49:08 +01:00
Mara Bos 27b81bf97a Remove all doc_comment!{} hacks by using #[doc = expr] where needed. 2020-12-30 22:49:08 +01:00
bors 9775ffef2a Auto merge of #80530 - m-ou-se:rollup-zit69ko, r=m-ou-se
Rollup of 9 pull requests

Successful merges:

 - #78934 (refactor: removing library/alloc/src/vec/mod.rs ignore-tidy-filelength)
 - #79479 (Add `Iterator::intersperse`)
 - #80128 (Edit rustc_ast::ast::FieldPat docs)
 - #80424 (Don't give an error when creating a file for the first time)
 - #80458 (Some Promotion Refactoring)
 - #80488 (Do not create dangling &T in Weak<T>::drop)
 - #80491 (Miri: make size/align_of_val work for dangling raw ptrs)
 - #80495 (Rename kw::Invalid -> kw::Empty)
 - #80513 (Add regression test for #80062)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2020-12-30 21:25:15 +00:00
max-heller 947b279bc6 Take type defaults into account in suggestions to reorder generic parameters 2020-12-30 16:00:25 -05:00
Mara Bos 8998e31223
Rollup merge of #80513 - LeSeulArtichaut:80062-test, r=lcnr
Add regression test for #80062

Closes #80062.
r? `@lcnr`
2020-12-30 20:57:00 +00:00
Mara Bos 9e8edc8c22
Rollup merge of #80495 - jyn514:rename-empty, r=petrochenkov
Rename kw::Invalid -> kw::Empty

See https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/Is.20there.20a.20symbol.20for.20the.20empty.20string.3F/near/220054471
for context.

r? `@petrochenkov`
2020-12-30 20:56:58 +00:00
Mara Bos 067f1b7030
Rollup merge of #80491 - RalfJung:dangling-of-val, r=oli-obk
Miri: make size/align_of_val work for dangling raw ptrs

This is needed for https://github.com/rust-lang/rust/issues/80365#issuecomment-752128105.

r? `@oli-obk`
2020-12-30 20:56:56 +00:00
Mara Bos 3d93dfdf6e
Rollup merge of #80488 - CAD97:drop-weak-without-reference, r=m-ou-se
Do not create dangling &T in Weak<T>::drop

Since at this point all strong pointers have been dropped, the wrapped `T` has also been dropped. As such, creating a `&T` to the dropped place is negligent at best (language UB at worst). Since we have `Layout::for_value_raw` now, use that instead of `Layout::for_value` to avoid creating the `&T`.

This does have implications for custom (potentially thin) DSTs, though much less severe than those discussed in #80407. Specifically, one of two things has to be true:

- It has to be possible to use a `*const T` to a dropped (potentially custom, potentially thin) unsized tailed object to determine the layout (size/align) of the object. This is what is currently implemented (though with `&T` instead of `&T`). The validity of reading some location after it has been dropped is an open question IIUC (https://github.com/rust-lang/unsafe-code-guidelines/issues/188) (except when the whole type is `Copy`, per `drop_in_place`'s docs).
  In this design, custom DSTs would get a `*mut T` and use that to return layout, and must be able to do so while in the "zombie" (post-drop, pre-free) state.
- `RcBox`/`ArcInner` compute and store layout eagerly, so that they don't have to ask the type for its layout after dropping it.

Importantly, this is already true today, as you can construct `Rc<DST>`, create a `Weak<DST>`, and drop the `Rc` before the `Weak`. This PR is a strict improvement over the status quo, and the above question about potentially thin DSTs will need to be resolved by any custom DST proposal.
2020-12-30 20:56:54 +00:00
Mara Bos 46111c1901
Rollup merge of #80458 - RalfJung:promotion-refactor, r=oli-obk
Some Promotion Refactoring

Clean up promotion a bit:
* factor out some common code
* more exhaustive matches

This *should* not break anything... the only potentially-breaking change is that `BorrowKind::Shallow | BorrowKind::Unique` are now rejected for internal references.

r? ``@oli-obk``
2020-12-30 20:56:52 +00:00
Mara Bos 1975142c97
Rollup merge of #80424 - jyn514:bootstrap-cleanup, r=Mark-Simulacrum
Don't give an error when creating a file for the first time

Previously, `os.remove` would always give a FileNotFound error the first
time you called it, causing bootstrap to make unnecessary copies. This
now only calls `remove()` if the file exists, avoiding the unnecessary
error.

This is a pretty small cleanup but I think it's useful. Taken from https://github.com/rust-lang/rust/pull/79540.
2020-12-30 20:56:51 +00:00
Mara Bos 3d7cdf667e
Rollup merge of #80128 - pierwill:pierwill-docs-fieldpat, r=jyn514
Edit rustc_ast::ast::FieldPat docs

Punctuation fixes.
2020-12-30 20:56:49 +00:00