]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoAdd snake case lint note about keyword identifiers which cannot be raw
Skynoodle [Sat, 2 Jan 2021 15:46:41 +0000 (15:46 +0000)]
Add snake case lint note about keyword identifiers which cannot be raw

3 years agoAdd suggestion to use raw identifiers when fixing snake-case lints
Skynoodle [Fri, 1 Jan 2021 18:34:20 +0000 (18:34 +0000)]
Add suggestion to use raw identifiers when fixing snake-case lints

3 years agoAdd reserved identifier test cases for snake case lint
Skynoodle [Fri, 1 Jan 2021 18:20:56 +0000 (18:20 +0000)]
Add reserved identifier test cases for snake case lint

3 years agoAuto merge of #80547 - lqd:const_generics_defaults, r=varkor
bors [Fri, 1 Jan 2021 13:17:42 +0000 (13:17 +0000)]
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`

3 years agoAuto merge of #80310 - Manishearth:box-try-alloc, r=kennytm
bors [Fri, 1 Jan 2021 10:29:43 +0000 (10:29 +0000)]
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`

3 years agomake `const_generics_defaults` use the unstable syntax mechanism
Rémy Rakic [Thu, 31 Dec 2020 17:32:06 +0000 (18:32 +0100)]
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

3 years agoadjust const generics defaults FIXMEs to the new feature gate
Rémy Rakic [Thu, 31 Dec 2020 01:50:23 +0000 (02:50 +0100)]
adjust const generics defaults FIXMEs to the new feature gate

3 years agoupdate `min_const_generics` tests using default values for const params
Rémy Rakic [Thu, 31 Dec 2020 01:04:52 +0000 (02:04 +0100)]
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 .

3 years agoadd test for the `const_generics_defaults` feature gate
Rémy Rakic [Thu, 31 Dec 2020 01:03:15 +0000 (02:03 +0100)]
add test for the `const_generics_defaults` feature gate

3 years agomark `const_generics_defaults` as an incomplete feature
Rémy Rakic [Thu, 31 Dec 2020 01:02:49 +0000 (02:02 +0100)]
mark `const_generics_defaults` as an incomplete feature

3 years agofix typo in feature gates file
Rémy Rakic [Thu, 31 Dec 2020 01:01:57 +0000 (02:01 +0100)]
fix typo in feature gates file

3 years agofirst pass at default values for const generics
Julian Knodt [Thu, 31 Dec 2020 00:58:27 +0000 (01:58 +0100)]
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

3 years agoAuto merge of #80539 - JohnTitor:ui-test-root-cleanup, r=petrochenkov
bors [Fri, 1 Jan 2021 07:46:11 +0000 (07:46 +0000)]
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`

3 years agoAuto merge of #79576 - m-ou-se:2021, r=Mark-Simulacrum
bors [Fri, 1 Jan 2021 03:41:31 +0000 (03:41 +0000)]
Auto merge of #79576 - m-ou-se:2021, r=Mark-Simulacrum

Add edition 2021.

:fireworks: Happy new ~~year~~ Rust. :champagne:

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.
```

3 years agoAuto merge of #80566 - Dylan-DPC:rollup-rns6est, r=Dylan-DPC
bors [Fri, 1 Jan 2021 00:59:12 +0000 (00:59 +0000)]
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

3 years agoReduce `ROOT_ENTRY_LIMIT` to 1500
Yuki Okushi [Wed, 30 Dec 2020 23:26:24 +0000 (08:26 +0900)]
Reduce `ROOT_ENTRY_LIMIT` to 1500

3 years agoMove feature gate-related tests
Yuki Okushi [Wed, 30 Dec 2020 23:25:10 +0000 (08:25 +0900)]
Move feature gate-related tests

3 years agoMove rmeta-related tests
Yuki Okushi [Wed, 30 Dec 2020 23:23:00 +0000 (08:23 +0900)]
Move rmeta-related tests

3 years agoMove builtin-superkinds-related tests
Yuki Okushi [Wed, 30 Dec 2020 23:15:53 +0000 (08:15 +0900)]
Move builtin-superkinds-related tests

3 years agoMove block-related tests
Yuki Okushi [Wed, 30 Dec 2020 23:09:22 +0000 (08:09 +0900)]
Move block-related tests

3 years agoRollup merge of #80551 - lcnr:const-arg-wildcard, r=varkor
Dylan DPC [Thu, 31 Dec 2020 21:21:00 +0000 (22:21 +0100)]
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 :laughing:

fixes #80531

r? `@varkor`

3 years agoRollup merge of #80548 - JohnTitor:wfcheck-foreign-fn-ice, r=davidtwco
Dylan DPC [Thu, 31 Dec 2020 21:20:59 +0000 (22:20 +0100)]
Rollup merge of #80548 - JohnTitor:wfcheck-foreign-fn-ice, r=davidtwco

FIx ICE on wf check for foreign fns

Fixes #80468

r? `@davidtwco` `@lcnr`

3 years agoRollup merge of #80532 - tmiasko:rm;, r=Mark-Simulacrum
Dylan DPC [Thu, 31 Dec 2020 21:20:56 +0000 (22:20 +0100)]
Rollup merge of #80532 - tmiasko:rm;, r=Mark-Simulacrum

remove unnecessary trailing semicolon from bootstrap

3 years agoRollup merge of #80526 - tmandry:up-llvm, r=nikic
Dylan DPC [Thu, 31 Dec 2020 21:20:55 +0000 (22:20 +0100)]
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``

3 years agoRollup merge of #80519 - max-heller:issue-80512-fix, r=varkor
Dylan DPC [Thu, 31 Dec 2020 21:20:53 +0000 (22:20 +0100)]
Rollup merge of #80519 - max-heller:issue-80512-fix, r=varkor

Take type defaults into account in suggestions to reorder generic parameters

Fixes #80512

3 years agoRollup merge of #80514 - pietroalbini:fix-install, r=Mark-Simulacrum
Dylan DPC [Thu, 31 Dec 2020 21:20:51 +0000 (22:20 +0100)]
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

3 years agoRollup merge of #80368 - camelid:rustdoc-succinct-vis, r=jyn514
Dylan DPC [Thu, 31 Dec 2020 21:20:49 +0000 (22:20 +0100)]
Rollup merge of #80368 - camelid:rustdoc-succinct-vis, r=jyn514

rustdoc: Render visibilities succinctly

Fixes #79139.

r? `@jyn514`

3 years agoRollup merge of #80323 - camelid:codegen-base-docs, r=nagisa
Dylan DPC [Thu, 31 Dec 2020 21:20:43 +0000 (22:20 +0100)]
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?

3 years agoAdd `@!has` checks to ensure private items don't have `pub`
Camelid [Thu, 31 Dec 2020 20:04:13 +0000 (12:04 -0800)]
Add `@!has` checks to ensure private items don't have `pub`

3 years agoAdd FIXME for visibility of a module
Camelid [Thu, 31 Dec 2020 20:00:23 +0000 (12:00 -0800)]
Add FIXME for visibility of a module

3 years agoEnable Pat2021 in edition 2021.
Mara Bos [Thu, 31 Dec 2020 18:09:28 +0000 (19:09 +0100)]
Enable Pat2021 in edition 2021.

3 years agoRequire `-Z unstable-options` for unstable editions.
Mara Bos [Thu, 24 Dec 2020 15:48:41 +0000 (16:48 +0100)]
Require `-Z unstable-options` for unstable editions.

3 years agoConsistently call editions "Rust 20xx" in messages.
Mara Bos [Mon, 30 Nov 2020 21:11:29 +0000 (22:11 +0100)]
Consistently call editions "Rust 20xx" in messages.

3 years agoAdd edition 2021.
Mara Bos [Wed, 30 Dec 2020 13:33:46 +0000 (14:33 +0100)]
Add edition 2021.

3 years agoMore inline, doc fixes
Manish Goregaokar [Thu, 31 Dec 2020 16:48:51 +0000 (16:48 +0000)]
More inline, doc fixes

3 years agoMake [A]Rc::allocate_for_layout() use try_allocate_for_layout()
Manish Goregaokar [Thu, 31 Dec 2020 16:36:28 +0000 (16:36 +0000)]
Make [A]Rc::allocate_for_layout() use try_allocate_for_layout()

3 years agoAuto merge of #80459 - mark-i-m:or-pat-reg, r=petrochenkov
bors [Thu, 31 Dec 2020 14:52:26 +0000 (14:52 +0000)]
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`

3 years agosupport pattern as const parents in type_of
Bastian Kauschke [Thu, 31 Dec 2020 09:55:20 +0000 (10:55 +0100)]
support pattern as const parents in type_of

3 years agoAuto merge of #79895 - Kerollmops:slice-group-by, r=m-ou-se
bors [Thu, 31 Dec 2020 12:00:43 +0000 (12:00 +0000)]
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.

3 years agoReplace the tracking issue for the slice_group_by feature
Clément Renault [Thu, 31 Dec 2020 11:13:03 +0000 (12:13 +0100)]
Replace the tracking issue for the slice_group_by feature

3 years agoAdd an extra example to the two methods
Clément Renault [Thu, 31 Dec 2020 10:57:40 +0000 (11:57 +0100)]
Add an extra example to the two methods

3 years agobootstrap: use the correct paths during ./x.py install
Pietro Albini [Wed, 30 Dec 2020 13:00:24 +0000 (14:00 +0100)]
bootstrap: use the correct paths during ./x.py install

3 years agobootstrap: change the dist outputs to GeneratedTarball
Pietro Albini [Wed, 30 Dec 2020 11:20:13 +0000 (12:20 +0100)]
bootstrap: change the dist outputs to GeneratedTarball

The struct will allow to store more context on the generated tarballs.

3 years agobootstrap: never delete the tarball temporary directory
Pietro Albini [Wed, 30 Dec 2020 11:10:31 +0000 (12:10 +0100)]
bootstrap: never delete the tarball temporary directory

Files in the temporary directory are used by ./x.py install.

3 years agoAuto merge of #80267 - 0urobor0s:ouro/61592, r=jyn514
bors [Thu, 31 Dec 2020 09:07:52 +0000 (09:07 +0000)]
Auto merge of #80267 - 0urobor0s:ouro/61592, r=jyn514

Rustdoc render public underscore_imports as Re-exports

Fixes #61592

3 years agoRustdoc render public underscore_imports as Re-exports
bors [Thu, 31 Dec 2020 09:07:51 +0000 (09:07 +0000)]
Rustdoc render public underscore_imports as Re-exports

Fixes #61592

3 years agoReuse Box::try_new_*_in() in Box::new_*_in()
Manish Goregaokar [Thu, 31 Dec 2020 08:43:30 +0000 (08:43 +0000)]
Reuse Box::try_new_*_in() in Box::new_*_in()

3 years agoAdd fallible Arc APIs (`Arc::try_new_*`)
Manish Goregaokar [Thu, 31 Dec 2020 08:30:23 +0000 (08:30 +0000)]
Add fallible Arc APIs (`Arc::try_new_*`)

3 years agoAdd fallible Rc APIs (`Rc::try_new_*`)
Manish Goregaokar [Thu, 31 Dec 2020 08:14:16 +0000 (08:14 +0000)]
Add fallible Rc APIs (`Rc::try_new_*`)

3 years agoAdd fallible box APIs (`Box::try_new_*`)
Manish Goregaokar [Thu, 31 Dec 2020 06:40:17 +0000 (06:40 +0000)]
Add fallible box APIs (`Box::try_new_*`)

3 years agoAdd fallible box allocator APIs (`Box::try_new_*_in()`)
Manish Goregaokar [Tue, 22 Dec 2020 20:10:18 +0000 (12:10 -0800)]
Add fallible box allocator APIs (`Box::try_new_*_in()`)

3 years agoAuto merge of #79150 - m-ou-se:bye-bye-doc-comment-hack, r=jyn514
bors [Thu, 31 Dec 2020 06:14:41 +0000 (06:14 +0000)]
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

3 years agoAuto merge of #80500 - jyn514:track-caller, r=nagisa
bors [Thu, 31 Dec 2020 03:17:50 +0000 (03:17 +0000)]
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.

3 years agoFIx ICE on wf check for foreign fns
Yuki Okushi [Thu, 31 Dec 2020 02:25:53 +0000 (11:25 +0900)]
FIx ICE on wf check for foreign fns

3 years agoAdd note on panic behavior
Camelid [Thu, 31 Dec 2020 01:39:03 +0000 (17:39 -0800)]
Add note on panic behavior

3 years agoSmall refactor
Camelid [Thu, 31 Dec 2020 00:41:18 +0000 (16:41 -0800)]
Small refactor

3 years agoRemove FIXME
Camelid [Thu, 31 Dec 2020 00:29:47 +0000 (16:29 -0800)]
Remove FIXME

Co-authored-by: Joshua Nelson <jyn514@gmail.com>
3 years agoUpdate `find_nearest_parent_module`
Camelid [Thu, 31 Dec 2020 00:38:25 +0000 (16:38 -0800)]
Update `find_nearest_parent_module`

3 years agoAuto merge of #80435 - pietroalbini:compression-formats, r=Mark-Simulacrum
bors [Thu, 31 Dec 2020 00:23:13 +0000 (00:23 +0000)]
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`

3 years agoMove cast-related tests
Yuki Okushi [Wed, 30 Dec 2020 23:05:46 +0000 (08:05 +0900)]
Move cast-related tests

3 years agoMove binop-related tests
Yuki Okushi [Wed, 30 Dec 2020 23:04:03 +0000 (08:04 +0900)]
Move binop-related tests

3 years agoMove array-slice-vec-related tests
Yuki Okushi [Wed, 30 Dec 2020 23:01:58 +0000 (08:01 +0900)]
Move array-slice-vec-related tests

3 years agoMove parser-related tests
Yuki Okushi [Wed, 30 Dec 2020 22:53:54 +0000 (07:53 +0900)]
Move parser-related tests

3 years agoFix typos.
Mara Bos [Wed, 30 Dec 2020 22:23:02 +0000 (23:23 +0100)]
Fix typos.

3 years agoDon't use doc_comment!{} hack in nonzero_leading_trailing_zeros!{}.
Mara Bos [Wed, 30 Dec 2020 21:36:17 +0000 (22:36 +0100)]
Don't use doc_comment!{} hack in nonzero_leading_trailing_zeros!{}.

3 years agoRemove all doc_comment!{} hacks by using #[doc = expr] where needed.
Mara Bos [Tue, 17 Nov 2020 22:57:29 +0000 (23:57 +0100)]
Remove all doc_comment!{} hacks by using #[doc = expr] where needed.

3 years agoAuto merge of #80530 - m-ou-se:rollup-zit69ko, r=m-ou-se
bors [Wed, 30 Dec 2020 21:25:15 +0000 (21:25 +0000)]
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

3 years agoTake type defaults into account in suggestions to reorder generic parameters
max-heller [Wed, 30 Dec 2020 16:43:30 +0000 (11:43 -0500)]
Take type defaults into account in suggestions to reorder generic parameters

3 years agoRollup merge of #80513 - LeSeulArtichaut:80062-test, r=lcnr
Mara Bos [Wed, 30 Dec 2020 20:57:00 +0000 (20:57 +0000)]
Rollup merge of #80513 - LeSeulArtichaut:80062-test, r=lcnr

Add regression test for #80062

Closes #80062.
r? `@lcnr`

3 years agoRollup merge of #80495 - jyn514:rename-empty, r=petrochenkov
Mara Bos [Wed, 30 Dec 2020 20:56:58 +0000 (20:56 +0000)]
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`

3 years agoRollup merge of #80491 - RalfJung:dangling-of-val, r=oli-obk
Mara Bos [Wed, 30 Dec 2020 20:56:56 +0000 (20:56 +0000)]
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`

3 years agoRollup merge of #80488 - CAD97:drop-weak-without-reference, r=m-ou-se
Mara Bos [Wed, 30 Dec 2020 20:56:54 +0000 (20:56 +0000)]
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.

3 years agoRollup merge of #80458 - RalfJung:promotion-refactor, r=oli-obk
Mara Bos [Wed, 30 Dec 2020 20:56:52 +0000 (20:56 +0000)]
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``

3 years agoRollup merge of #80424 - jyn514:bootstrap-cleanup, r=Mark-Simulacrum
Mara Bos [Wed, 30 Dec 2020 20:56:51 +0000 (20:56 +0000)]
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.

3 years agoRollup merge of #80128 - pierwill:pierwill-docs-fieldpat, r=jyn514
Mara Bos [Wed, 30 Dec 2020 20:56:49 +0000 (20:56 +0000)]
Rollup merge of #80128 - pierwill:pierwill-docs-fieldpat, r=jyn514

Edit rustc_ast::ast::FieldPat docs

Punctuation fixes.

3 years agoRollup merge of #79479 - camelid:intersperse, r=m-ou-se
Mara Bos [Wed, 30 Dec 2020 20:56:47 +0000 (20:56 +0000)]
Rollup merge of #79479 - camelid:intersperse, r=m-ou-se

Add `Iterator::intersperse`

This is a rebase of #75784. I'm hoping to push this past the finish line!

cc `@jonas-schievink`

3 years agoRollup merge of #78934 - DeveloperC286:issue_60302_vec, r=m-ou-se
Mara Bos [Wed, 30 Dec 2020 20:56:45 +0000 (20:56 +0000)]
Rollup merge of #78934 - DeveloperC286:issue_60302_vec, r=m-ou-se

refactor: removing library/alloc/src/vec/mod.rs ignore-tidy-filelength

This PR removes the need for ignore-tidy-filelength for library/alloc/src/vec/mod.rs which is part of the issue #60302

It is probably easiest to review this PR by looking at it commit by commit rather than looking at the overall diff.

3 years agoAdd tracking issue
Camelid [Sat, 28 Nov 2020 23:55:07 +0000 (15:55 -0800)]
Add tracking issue

3 years agoAdd Iterator::intersperse
Jonas Schievink [Fri, 21 Aug 2020 19:56:40 +0000 (21:56 +0200)]
Add Iterator::intersperse

3 years agoUpdate LLVM
Tyler Mandry [Wed, 30 Dec 2020 19:14:15 +0000 (19:14 +0000)]
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

3 years agoAuto merge of #80511 - Mark-Simulacrum:bump-stage0, r=pietroalbini
bors [Wed, 30 Dec 2020 18:32:31 +0000 (18:32 +0000)]
Auto merge of #80511 - Mark-Simulacrum:bump-stage0, r=pietroalbini

Bump bootstrap compiler to 1.50 beta

r? `@pietroalbini`

3 years agoImplement edition-based macro pat feature
mark [Mon, 28 Dec 2020 22:57:13 +0000 (16:57 -0600)]
Implement edition-based macro pat feature

3 years agoFix rustdoc link in vec/into_iter.rs.
Mara Bos [Wed, 30 Dec 2020 15:35:02 +0000 (15:35 +0000)]
Fix rustdoc link in vec/into_iter.rs.

3 years agoAuto merge of #80510 - JohnTitor:rollup-gow7y0l, r=JohnTitor
bors [Wed, 30 Dec 2020 15:30:56 +0000 (15:30 +0000)]
Auto merge of #80510 - JohnTitor:rollup-gow7y0l, r=JohnTitor

Rollup of 7 pull requests

Successful merges:

 - #80185 (Fix ICE when pointing at multi bytes character)
 - #80260 (slightly more typed interface to panic implementation)
 - #80311 (Improvements to NatVis support)
 - #80337 (Use `desc` as a doc-comment for queries if there are no doc comments)
 - #80381 (Revert "Cleanup markdown span handling")
 - #80492 (remove empty wraps, don't return Results from from infallible functions)
 - #80509 (where possible, pass slices instead of &Vec or &String (clippy::ptr_arg))

Failed merges:

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

3 years agoAdd regression test for #80062
LeSeulArtichaut [Wed, 30 Dec 2020 14:59:44 +0000 (15:59 +0100)]
Add regression test for #80062

3 years agobootstrap: extract from any compression algorithm during distcheck
Pietro Albini [Wed, 30 Dec 2020 15:05:57 +0000 (16:05 +0100)]
bootstrap: extract from any compression algorithm during distcheck

3 years agoRename kw::Invalid -> kw::Empty
Joshua Nelson [Wed, 30 Dec 2020 01:28:08 +0000 (20:28 -0500)]
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.

3 years agoBump bootstrap compiler to 1.50 beta
Mark Rousskov [Wed, 30 Dec 2020 13:04:59 +0000 (08:04 -0500)]
Bump bootstrap compiler to 1.50 beta

3 years agoRollup merge of #80509 - matthiaskrgr:ptr_arg, r=varkor
Yuki Okushi [Wed, 30 Dec 2020 13:49:26 +0000 (22:49 +0900)]
Rollup merge of #80509 - matthiaskrgr:ptr_arg, r=varkor

where possible, pass slices instead of &Vec or &String (clippy::ptr_arg)

3 years agoRollup merge of #80492 - matthiaskrgr:tasty_wraps, r=varkor
Yuki Okushi [Wed, 30 Dec 2020 13:49:24 +0000 (22:49 +0900)]
Rollup merge of #80492 - matthiaskrgr:tasty_wraps, r=varkor

remove empty wraps, don't return Results from from infallible functions

This makes code easier to understand because it is more obvious when a function actually can't fail (return Err or None)

Make functions that only ever return Some(x), return x directly
Remove return type from functions that return Option<(), Err> but would only ever return Ok(()).

Found with `clippy::unnecessary_wraps`

3 years agoRollup merge of #80381 - rust-lang:revert-80244-spans, r=GuillaumeGomez
Yuki Okushi [Wed, 30 Dec 2020 13:49:23 +0000 (22:49 +0900)]
Rollup merge of #80381 - rust-lang:revert-80244-spans, r=GuillaumeGomez

Revert "Cleanup markdown span handling"

Reverts rust-lang/rust#80244. This caused a diagnostic regression, originally it was:

```
warning: unresolved link to `std::process::Comman`
 --> link.rs:3:10
  |
3 | //! [a]: std::process::Comman
  |          ^^^^^^^^^^^^^^^^^^^^ no item named `Comman` in module `process`
  |
  = note: `#[warn(broken_intra_doc_links)]` on by default
```
but after that PR rustdoc now displays
```
warning: unresolved link to `std::process::Comman`
 --> link.rs:1:14
  |
1 | //! Links to [a] [link][a]
  |              ^^^ no item named `Comman` in module `process`
  |
  = note: `#[warn(broken_intra_doc_links)]` on by default
```
which IMO is much less clear.

cc `@bugadani,` thanks for catching this in https://github.com/rust-lang/rust/pull/77859.
r? `@GuillaumeGomez`

3 years agoRollup merge of #80337 - jyn514:add-query-desc, r=varkor
Yuki Okushi [Wed, 30 Dec 2020 13:49:21 +0000 (22:49 +0900)]
Rollup merge of #80337 - jyn514:add-query-desc, r=varkor

Use `desc` as a doc-comment for queries if there are no doc comments

This at least gives *some* idea of what the query does even if it's not very readable. Some examples:

![image](https://user-images.githubusercontent.com/23638587/103021399-13e15c00-4518-11eb-8121-940774ae2fd1.png)
![image](https://user-images.githubusercontent.com/23638587/103021448-222f7800-4518-11eb-8ee6-cc10795fdc22.png)
![image](https://user-images.githubusercontent.com/23638587/103021434-1d6ac400-4518-11eb-885b-59d00c57bc70.png)

I want to turn `{}` into either `_` or the stringified expr, but [I'm not sure how to do that](https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/Evaluate.20format.20string.20in.20proc-macro). In the meantime, this is better than having no docs at all.

3 years agoRollup merge of #80311 - sivadeilra:natvis, r=petrochenkov
Yuki Okushi [Wed, 30 Dec 2020 13:49:19 +0000 (22:49 +0900)]
Rollup merge of #80311 - sivadeilra:natvis, r=petrochenkov

Improvements to NatVis support

NatVis files describe how to display types in some Windows debuggers,
such as Visual Studio, WinDbg, and VS Code.

This commit makes several improvements:

* Adds visualizers for Rc<T>, Weak<T>, and Arc<T>.

* Changes [size] to [len], for consistency with the Rust API.
  Visualizers often use [size] to mirror the size() method on C++ STL
  collections.

* Several visualizers used the PVOID and ULONG typedefs. These are part
  of the Windows API; they are not guaranteed to always be defined in a
  pure Rust DLL/EXE. I converted PVOID to `void*` and `ULONG` to
  `unsigned long`.

* Cosmetic change: Removed {} braces around the visualized display
  for `Option` types. They now display simply as `Some(value)` or
  `None`, which reflects what is written in source code.

* The visualizer for `alloc::string::String` makes assumptions about
  the layout of `String` (it casts `String*` to another type), rather
  than using symbolic expressions. This commit changes the visualizer
  so that it simply uses symbolic expressions to access the string
  data and string length.

* The visualizers for `str` and `String` now place the character data
  array under a synthetic `[chars]` node. When expanding a `String`
  node, users rarely want to see an array of characters. This just places
  them behind one expansion node / level.

3 years agoRollup merge of #80260 - RalfJung:less-untyped-panics, r=m-ou-se
Yuki Okushi [Wed, 30 Dec 2020 13:49:17 +0000 (22:49 +0900)]
Rollup merge of #80260 - RalfJung:less-untyped-panics, r=m-ou-se

slightly more typed interface to panic implementation

The panic payload is currently being passed around as a `usize`. However, it actually is a pointer, and the involved types are available on all ends of this API, so I propose we use the proper pointer type to avoid some casts. Avoiding int-to-ptr casts also makes this code work with `miri -Zmiri-track-raw-pointers`.

3 years agoRollup merge of #80185 - JohnTitor:issue-80134, r=davidtwco
Yuki Okushi [Wed, 30 Dec 2020 13:49:16 +0000 (22:49 +0900)]
Rollup merge of #80185 - JohnTitor:issue-80134, r=davidtwco

Fix ICE when pointing at multi bytes character

Fixes #80134

Seems this ICE was introduced by #73953, checking width of span to avoid ICE.

3 years agoFix ICE when pointing at multi bytes character
Yuki Okushi [Sat, 19 Dec 2020 10:29:56 +0000 (19:29 +0900)]
Fix ICE when pointing at multi bytes character

3 years agoCTFE: test size/align_of_val_raw on dangling pointers
Ralf Jung [Wed, 30 Dec 2020 13:29:33 +0000 (14:29 +0100)]
CTFE: test size/align_of_val_raw on dangling pointers

3 years agoAuto merge of #79684 - usbalbin:const_copy, r=oli-obk
bors [Wed, 30 Dec 2020 12:43:02 +0000 (12:43 +0000)]
Auto merge of #79684 - usbalbin:const_copy, r=oli-obk

Make copy[_nonoverlapping] const

Constifies
* `intrinsics::copy` and `intrinsics::copy_nonoverlapping`
* `ptr::read` and `ptr::read_unaligned`
  * `*const T::read` and `*const T::read_unaligned`
  * `*mut T::read` and `*mut T::read_unaligned`
* `MaybeUninit::assume_init_read`

3 years agoremove unused return types such as empty Results or Options that would always be...
Matthias Krüger [Tue, 29 Dec 2020 21:24:15 +0000 (22:24 +0100)]
remove unused return types such as empty Results or Options that would always be Some(..)

remove unused return type of dropck::check_drop_obligations()
don't wrap return type in Option in get_macro_by_def_id() since we would always return Some(..)
remove redundant return type of back::write::optimize()
don't Option-wrap return type of compute_type_parameters() since we always return Some(..)
don't return empty Result in assemble_generator_candidates()
don't return empty Result in assemble_closure_candidates()
don't return empty result in assemble_fn_pointer_candidates()
don't return empty result in assemble_candidates_from_impls()
don't return empty result in assemble_candidates_from_auto_impls()
don't return emtpy result in assemble_candidates_for_trait_alias()
don't return empty result in assemble_builtin_bound_candidates()
don't return empty results in assemble_extension_candidates_for_traits_in_scope() and assemble_extension_candidates_for_trait()
remove redundant wrapping of return type of StripItem::strip() since it always returns Some(..)
remove unused return type of assemble_extension_candidates_for_all_traits()

3 years agowhere possible, pass slices instead of &Vec or &String (clippy::ptr_arg)
Matthias Krüger [Wed, 30 Dec 2020 11:59:07 +0000 (12:59 +0100)]
where possible, pass slices instead of &Vec or &String (clippy::ptr_arg)