]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoShow invisible delimeters (within comments) when pretty printing.
Nicholas Nethercote [Fri, 29 Apr 2022 07:58:41 +0000 (17:58 +1000)]
Show invisible delimeters (within comments) when pretty printing.

2 years agoAuto merge of #96393 - joboet:pthread_parker, r=thomcc
bors [Thu, 28 Apr 2022 21:58:08 +0000 (21:58 +0000)]
Auto merge of #96393 - joboet:pthread_parker, r=thomcc

std: directly use pthread in UNIX parker implementation

`Mutex` and `Condvar` are being replaced by more efficient implementations, which need thread parking themselves (see #93740). Therefore we should use the `pthread` synchronization primitives directly. Also, we can avoid allocating the mutex and condition variable because the `Parker` struct is being placed in an `Arc` anyways.

This basically is just a copy of the current `Mutex` and `Condvar` code, which will however be removed (again, see #93740). An alternative implementation could be to use dedicated private `OsMutex` and `OsCondvar` types, but all the other platforms supported by std actually have their own thread parking primitives.

I used `Pin` to guarantee a stable address for the `Parker` struct, while the current implementation does not, rather using extra unsafe declaration. Since the thread struct is shared anyways, I assumed this would not add too much clutter while being clearer.

2 years agoAuto merge of #96528 - Dylan-DPC:rollup-iedbjli, r=Dylan-DPC
bors [Thu, 28 Apr 2022 19:32:59 +0000 (19:32 +0000)]
Auto merge of #96528 - Dylan-DPC:rollup-iedbjli, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #95312 (Ensure that `'_` and GAT yields errors)
 - #96405 (Migrate ambiguous plus diagnostic to the new derive macro)
 - #96409 (Recover suggestions to introduce named lifetime under NLL)
 - #96433 (rustc_ast: Harmonize delimiter naming with `proc_macro::Delimiter`)
 - #96480 (Fixed grammatical error in example comment)

Failed merges:

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

2 years agoRollup merge of #96480 - user-simon:patch-1, r=Dylan-DPC
Dylan DPC [Thu, 28 Apr 2022 18:13:03 +0000 (20:13 +0200)]
Rollup merge of #96480 - user-simon:patch-1, r=Dylan-DPC

Fixed grammatical error in example comment

Added missing "we" in sentence.

2 years agoRollup merge of #96433 - petrochenkov:delim, r=nnethercote
Dylan DPC [Thu, 28 Apr 2022 18:13:02 +0000 (20:13 +0200)]
Rollup merge of #96433 - petrochenkov:delim, r=nnethercote

rustc_ast: Harmonize delimiter naming with `proc_macro::Delimiter`

Compiler cannot reuse `proc_macro::Delimiter` directly due to extra impls, but can at least use the same naming.

After this PR the only difference between these two enums is that `proc_macro::Delimiter::None` is turned into `token::Delimiter::Invisible`.
It's my mistake that the invisible delimiter is called `None` on stable, during the stabilization I audited the naming and wrote the docs, but missed the fact that the `None` naming gives a wrong and confusing impression about what this thing is.

cc https://github.com/rust-lang/rust/pull/96421
r? ``@nnethercote``

2 years agoRollup merge of #96409 - marmeladema:fix-nll-introduce-named-lifetime-suggestion...
Dylan DPC [Thu, 28 Apr 2022 18:13:01 +0000 (20:13 +0200)]
Rollup merge of #96409 - marmeladema:fix-nll-introduce-named-lifetime-suggestion, r=jackh726

Recover suggestions to introduce named lifetime under NLL

Fixes #96157

r? ```@jackh726```

Built on top of #96385 so only the second commit is relevant

2 years agoRollup merge of #96405 - pvdrz:ambiguous-plus-diagnostic, r=davidtwco
Dylan DPC [Thu, 28 Apr 2022 18:12:59 +0000 (20:12 +0200)]
Rollup merge of #96405 - pvdrz:ambiguous-plus-diagnostic, r=davidtwco

Migrate ambiguous plus diagnostic to the new derive macro

r? ````@davidtwco```` ````@jyn514````

2 years agoRollup merge of #95312 - marmeladema:tests-for-issue-95305, r=jackh726
Dylan DPC [Thu, 28 Apr 2022 18:12:57 +0000 (20:12 +0200)]
Rollup merge of #95312 - marmeladema:tests-for-issue-95305, r=jackh726

Ensure that `'_` and GAT yields errors

Fixes #95305

```@bors``` r? ```@jackh726```

2 years agoAuto merge of #95171 - Kobzol:llvm-ci-update, r=nikic
bors [Thu, 28 Apr 2022 16:27:18 +0000 (16:27 +0000)]
Auto merge of #95171 - Kobzol:llvm-ci-update, r=nikic

Update LLVM used for building rustc in CI for x64

LLVM 14 was tagged. It is needed for building [BOLT](https://github.com/rust-lang/rust/pull/94381), and it also improves max RSS quite [a lot](https://perf.rust-lang.org/compare.html?start=6970f88db3ac2a9cefa9c585228291ae1f18fb04&end=67acb7e3ffcc11d67abfd29c390aac629f3c0e97&stat=max-rss).

GCC was bumped to allow building the new LLVM version. The changes in building LLVM were done to speed up the build a bit by ignoring unused parts and to turn off parts that were problematic to compile even with the bumped GCC.

2 years agoUpdate LLVM submodule
Jakub Beránek [Thu, 28 Apr 2022 14:02:52 +0000 (16:02 +0200)]
Update LLVM submodule

2 years agoUpdate LLVM used for building rustc in CI for x64 to LLVM 14.0.2
Jakub Beránek [Wed, 27 Apr 2022 07:53:38 +0000 (09:53 +0200)]
Update LLVM used for building rustc in CI for x64 to LLVM 14.0.2

2 years agostd: update debuginfo check to match type definition
joboet [Thu, 28 Apr 2022 13:34:43 +0000 (15:34 +0200)]
std: update debuginfo check to match type definition

2 years agoAuto merge of #95976 - b-naber:valtree-constval-conversion, r=oli-obk
bors [Thu, 28 Apr 2022 13:18:22 +0000 (13:18 +0000)]
Auto merge of #95976 - b-naber:valtree-constval-conversion, r=oli-obk

Implement Valtree to ConstValue conversion

Once we start to use `ValTree`s in the type system we will need to be able to convert them into `ConstValue` instances, which we want to continue to use after MIR construction.

r? `@oli-obk`

cc `@RalfJung`

2 years agostd: simplify UNIX parker timeouts
joboet [Wed, 27 Apr 2022 17:28:27 +0000 (19:28 +0200)]
std: simplify UNIX parker timeouts

2 years agoAuto merge of #95904 - paolobarbolini:vecdeque-specextend, r=the8472
bors [Thu, 28 Apr 2022 09:27:21 +0000 (09:27 +0000)]
Auto merge of #95904 - paolobarbolini:vecdeque-specextend, r=the8472

Add VecDeque::extend from vec::IntoIter and slice::Iter specializations

Inspired from the [`Vec` `SpecExtend` implementation](https://github.com/rust-lang/rust/blob/027a232755fa9728e9699337267f6675dfd0a8ba/library/alloc/src/vec/spec_extend.rs), but without the specialization for `TrustedLen` which I'll look into in the future.

Should help #95632 and https://github.com/KillingSpark/zstd-rs/pull/17

## Benchmarks

Before

```
test vec_deque::bench_extend_bytes    ... bench:         862 ns/iter (+/- 10)
test vec_deque::bench_extend_vec      ... bench:         883 ns/iter (+/- 19)
```

After

```
test vec_deque::bench_extend_bytes    ... bench:           8 ns/iter (+/- 0)
test vec_deque::bench_extend_vec      ... bench:          24 ns/iter (+/- 1)

```

2 years agorustc_ast: Harmonize delimiter naming with `proc_macro::Delimiter`
Vadim Petrochenkov [Tue, 26 Apr 2022 12:40:14 +0000 (15:40 +0300)]
rustc_ast: Harmonize delimiter naming with `proc_macro::Delimiter`

2 years agoAuto merge of #96503 - ehuss:update-cargo, r=ehuss
bors [Thu, 28 Apr 2022 06:58:54 +0000 (06:58 +0000)]
Auto merge of #96503 - ehuss:update-cargo, r=ehuss

Update cargo

8 commits in edffc4ada3d77799e5a04eeafd9b2f843d29fc23..f63f23ff1f1a12ede8585bbd1bbf0c536e50293d
2022-04-19 17:38:29 +0000 to 2022-04-28 03:15:50 +0000
- move workspace inheritance untable docs to the correct place (rust-lang/cargo#10609)
- Cargo add support for workspace inheritance (rust-lang/cargo#10606)
- chore: Upgrade toml_edit (rust-lang/cargo#10603)
- Mark .cargo/git and .cargo/registry as cache dirs (rust-lang/cargo#10553)
- fix(yank): Use '--version' like install (rust-lang/cargo#10575)
- Disallow setting registry tokens with --config (rust-lang/cargo#10580)
- Set cargo --version git hash length to 9 (rust-lang/cargo#10579)
- Prefer `key.workspace = true` to `key = { workspace = true }` (rust-lang/cargo#10584)

2 years agoUpdate cargo
Eric Huss [Thu, 28 Apr 2022 05:42:54 +0000 (22:42 -0700)]
Update cargo

2 years agoAuto merge of #96085 - jsgf:deny-unused-deps, r=compiler-errors
bors [Thu, 28 Apr 2022 04:17:52 +0000 (04:17 +0000)]
Auto merge of #96085 - jsgf:deny-unused-deps, r=compiler-errors

Make sure `-Dunused-crate-dependencies --json unused-externs` makes rustc exit with error status

This PR:
- fixes compiletest to understand unused extern notifications
- adds tests for `--json unused-externs`
- makes sure that deny-level unused externs notifications are treated as compile errors
  - refactors the `emit_unused_externs` callstack to plumb through the level as an enum as a string, and adds `Level::is_error`

Update: adds `--json unused-externs-silent` with the original behaviour since Cargo needs it. Should address `@est31's` concerns.

Fixes: https://github.com/rust-lang/rust/issues/96068
2 years agoAdd VecDeque::extend from vec::IntoIter and slice::Iter specializations
Paolo Barbolini [Sun, 10 Apr 2022 22:00:03 +0000 (00:00 +0200)]
Add VecDeque::extend from vec::IntoIter and slice::Iter specializations

2 years agoAuto merge of #96495 - Dylan-DPC:rollup-9lm4tpp, r=Dylan-DPC
bors [Thu, 28 Apr 2022 01:37:03 +0000 (01:37 +0000)]
Auto merge of #96495 - Dylan-DPC:rollup-9lm4tpp, r=Dylan-DPC

Rollup of 7 pull requests

Successful merges:

 - #96377 (make `fn() -> _ { .. }` suggestion MachineApplicable)
 - #96397 (Make EncodeWide implement FusedIterator)
 - #96421 (Less `NoDelim`)
 - #96432 (not need `Option` for `dbg_scope`)
 - #96466 (Better error messages when collecting into `[T; n]`)
 - #96471 (replace let else with `?`)
 - #96483 (Add missing `target_feature` to the list of well known cfg names)

Failed merges:

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

2 years agoRollup merge of #96483 - Urgau:check-cfg-target_feature, r=petrochenkov
Dylan DPC [Thu, 28 Apr 2022 00:40:37 +0000 (02:40 +0200)]
Rollup merge of #96483 - Urgau:check-cfg-target_feature, r=petrochenkov

Add missing `target_feature` to the list of well known cfg names

This PR adds the missing `target_feature` cfg name to the list of well known cfg names.

It was notice missing in https://github.com/rust-lang/rust/issues/96472 thanks to `@bjorn3,` the reason being that `--check-cfg=names()` automatically inherit the names passed by `--cfg` (or internal to `rustc`) and is seems that the vast majority of targets have at least one target feature leading to `target_feature` being a well known name in most target but it should always be a well known name so this PR add it unconditionally to list.

r? `@petrochenkov`

2 years agoRollup merge of #96471 - BoxyUwU:let_else_considered_harmful, r=lcnr
Dylan DPC [Thu, 28 Apr 2022 00:40:36 +0000 (02:40 +0200)]
Rollup merge of #96471 - BoxyUwU:let_else_considered_harmful, r=lcnr

replace let else with `?`

r? `@oli-obk`

2 years agoRollup merge of #96466 - compiler-errors:error-collect-array, r=davidtwco
Dylan DPC [Thu, 28 Apr 2022 00:40:35 +0000 (02:40 +0200)]
Rollup merge of #96466 - compiler-errors:error-collect-array, r=davidtwco

Better error messages when collecting into `[T; n]`

Fixes #96461

2 years agoRollup merge of #96432 - SparrowLii:dbg_scope, r=davidtwco
Dylan DPC [Thu, 28 Apr 2022 00:40:34 +0000 (02:40 +0200)]
Rollup merge of #96432 - SparrowLii:dbg_scope, r=davidtwco

not need `Option` for `dbg_scope`

This PR fixes a few FIXME about not using `Option` in `dbg_scope` field of `DebugScope`, during `create_function_debug_context` func in codegen parts.
Added a `BitSet<SourceScope>` parameter to `make_mir_scope` to indicate whether the `DebugScope` has been instantiated.
cc ````@eddyb````

2 years agoRollup merge of #96421 - nnethercote:less-NoDelim, r=petrochenkov
Dylan DPC [Thu, 28 Apr 2022 00:40:34 +0000 (02:40 +0200)]
Rollup merge of #96421 - nnethercote:less-NoDelim, r=petrochenkov

Less `NoDelim`

Currently there are several places where `NoDelim` (which really means "implicit delimiter" or "invisible delimiter") is used to mean "no delimiter". The name `NoDelim` is a bit misleading, and may be a cause.

This PR changes these places, e.g. by changing a `DelimToken` to `Option<DelimToken>` and then using `None` to mean "no delimiter". As a result, the *only* place where `NoDelim` values are now produced is within:
- `Delimiter::to_internal()`, when converting from `Delimiter::None`.
- `FlattenNonterminals::process_token()`, when converting `TokenKind::Interpolated`.

r? ````@petrochenkov````

2 years agoRollup merge of #96397 - AronParker:issue-96368-fix, r=dtolnay
Dylan DPC [Thu, 28 Apr 2022 00:40:33 +0000 (02:40 +0200)]
Rollup merge of #96397 - AronParker:issue-96368-fix, r=dtolnay

Make EncodeWide implement FusedIterator

[`EncodeUtf16`](https://doc.rust-lang.org/std/str/struct.EncodeUtf16.html) and [`EncodeWide`](https://doc.rust-lang.org/std/os/windows/ffi/struct.EncodeWide.html) currently serve similar purposes: They convert from UTF-8 to UTF-16 and WTF-8 to WTF-16, respectively. `EncodeUtf16` wraps a &str, whereas `EncodeWide` wraps an &OsStr.

When Iteration has concluded, these iterators wrap an empty slice, which will forever yield `None` values. Hence, `EncodeUtf16` rightfully implements `FusedIterator`. However, `EncodeWide` in contrast does not, even though it serves an almost identical purpose.

This PR attempts to fix that issue. I consider this change minor and non-controversial, hence why I have not added a RFC/FCP. Please let me know if the stability attribute is wrong or contains a wrong version number. Thanks in advance.

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

2 years agoRollup merge of #96377 - compiler-errors:infer-rustfix, r=petrochenkov
Dylan DPC [Thu, 28 Apr 2022 00:40:32 +0000 (02:40 +0200)]
Rollup merge of #96377 - compiler-errors:infer-rustfix, r=petrochenkov

make `fn() -> _ { .. }` suggestion MachineApplicable

This might not be valid, but it would be nice to promote this to `MachineApplicable` so people can use rustfix here.

Also de65fcf009d07019689cfad7f327667e390a325d is to [restore the suggestion for `issue-77179.rs`](https://github.com/rust-lang/rust/commit/de65fcf009d07019689cfad7f327667e390a325d#diff-12e43fb5d6d12ec7cb5c6b48204a18d113cf5de0e12eb71a358b639bd9aadaf0R8). (though in this case, the code in that issue still doesn't compile, so it's not marked with rustfix).

2 years agoAuto merge of #91557 - cjgillot:ast-lifetimes-named, r=petrochenkov
bors [Wed, 27 Apr 2022 23:13:28 +0000 (23:13 +0000)]
Auto merge of #91557 - cjgillot:ast-lifetimes-named, r=petrochenkov

Perform lifetime resolution on the AST for lowering

Lifetime resolution is currently implemented several times. Once during lowering in order to introduce in-band lifetimes, and once in the resolve_lifetimes query. However, due to the global nature of lifetime resolution and how it interferes with hygiene, it is better suited on the AST.

This PR implements a first draft of lifetime resolution on the AST. For now, we specifically target named lifetimes and everything we need to remove lifetime resolution from lowering. Some diagnostics have already been ported, and sometimes made more precise using available hygiene information. Follow-up PRs will address in particular the resolution of anonymous lifetimes on the AST.

We reuse the rib design of the current resolution framework. Specific `LifetimeRib` and `LifetimeRibKind` types are introduced. The most important variant is `LifetimeRibKind::Generics`, which happens each time we encounter something which may introduce generic lifetime parameters. It can be an item or a `for<...>` binder. The `LifetimeBinderKind` specifies how this rib behaves with respect to in-band lifetimes.

r? `@petrochenkov`

2 years agoEnsure that `'_` and GAT yields errors
marmeladema [Fri, 25 Mar 2022 17:26:55 +0000 (18:26 +0100)]
Ensure that `'_` and GAT yields errors

2 years agoRecover suggestions to introduce named lifetime under NLL
marmeladema [Mon, 25 Apr 2022 22:17:25 +0000 (00:17 +0200)]
Recover suggestions to introduce named lifetime under NLL

2 years agoCollect extra lifetime parameters during late resolution.
Camille GILLOT [Sun, 24 Apr 2022 13:49:00 +0000 (15:49 +0200)]
Collect extra lifetime parameters during late resolution.

2 years agoRefactor generic collection.
Camille GILLOT [Wed, 20 Apr 2022 19:08:06 +0000 (21:08 +0200)]
Refactor generic collection.

2 years agoCreate a specific struct for lifetime capture.
Camille GILLOT [Wed, 20 Apr 2022 18:13:42 +0000 (20:13 +0200)]
Create a specific struct for lifetime capture.

2 years agoBless tests.
Camille GILLOT [Fri, 11 Mar 2022 10:58:59 +0000 (11:58 +0100)]
Bless tests.

2 years agoHandle TAIT.
Camille GILLOT [Tue, 29 Mar 2022 13:37:21 +0000 (15:37 +0200)]
Handle TAIT.

2 years agoUse LifetimeRes during lowering.
Camille GILLOT [Thu, 7 Apr 2022 18:54:13 +0000 (20:54 +0200)]
Use LifetimeRes during lowering.

2 years agoDo not resolve elided lifetimes in path twice.
Camille GILLOT [Thu, 21 Apr 2022 16:39:43 +0000 (18:39 +0200)]
Do not resolve elided lifetimes in path twice.

2 years agoUpdate comment.
Camille GILLOT [Tue, 26 Apr 2022 16:54:34 +0000 (18:54 +0200)]
Update comment.

2 years agoAdd VecDeque::extend benchmark
Paolo Barbolini [Mon, 11 Apr 2022 06:12:14 +0000 (08:12 +0200)]
Add VecDeque::extend benchmark

2 years agoAdd missing `target_feature` to the list of well known cfg names
Loïc BRANSTETT [Wed, 27 Apr 2022 17:11:56 +0000 (19:11 +0200)]
Add missing `target_feature` to the list of well known cfg names

2 years agoAdd --json unused-externs-silent with original behaviour
Jeremy Fitzhardinge [Sun, 17 Apr 2022 00:11:33 +0000 (17:11 -0700)]
Add --json unused-externs-silent with original behaviour

Since Cargo wants to do its own fatal error handling for unused
dependencies, add the option `--json unused-externs-silent` which
has the original behaviour of not indicating non-zero exit status for
`deny`/`forbid`-level unused dependencies.

2 years agoPlumb through rustc_lint_defs::Level as enum rather than string.
Jeremy Fitzhardinge [Fri, 15 Apr 2022 08:24:49 +0000 (01:24 -0700)]
Plumb through rustc_lint_defs::Level as enum rather than string.

2 years agoMake --json unused-extern deny/forbid level messages cause exit with error status
Jeremy Fitzhardinge [Fri, 15 Apr 2022 07:37:40 +0000 (00:37 -0700)]
Make --json unused-extern deny/forbid level messages cause exit with error status

Closes: https://github.com/rust-lang/rust/issues/96068
2 years agoAdd tests for --json unused-externs
Jeremy Fitzhardinge [Fri, 15 Apr 2022 17:33:08 +0000 (10:33 -0700)]
Add tests for --json unused-externs

There were none at all. These test for original functionality,
but this also adds a test that `-Dunused-crate-dependencies`
causes a compilation failure, which currently fails
(https://github.com/rust-lang/rust/issues/96068). This is fixed in
subsequent changes.

2 years agocompiletest: add support for unused extern notifications
Jeremy Fitzhardinge [Fri, 15 Apr 2022 17:46:58 +0000 (10:46 -0700)]
compiletest: add support for unused extern notifications

As generated by --json unused-externs.

2 years agoAuto merge of #96179 - klensy:bump-deps-04-22, r=Mark-Simulacrum
bors [Wed, 27 Apr 2022 16:20:59 +0000 (16:20 +0000)]
Auto merge of #96179 - klensy:bump-deps-04-22, r=Mark-Simulacrum

Bump deps

Update few deps:

First commit: vulnerable or yanked ones:
* openssl-src 111.17.0+1.1.1m -> 111.18.0+1.1.1n vuln https://rustsec.org/advisories/RUSTSEC-2022-0014
* crossbeam-channel 0.5.2 -> 0.5.4 yanked: https://github.com/crossbeam-rs/crossbeam/pull/802 (https://github.com/crossbeam-rs/crossbeam/blob/crossbeam-channel-0.5.4/crossbeam-channel/CHANGELOG.md)
* crossbeam-utils 0.8.6 -> 0.8.8 yanked: https://github.com/crossbeam-rs/crossbeam/security/advisories/GHSA-qc84-gqf4-9926 (https://github.com/crossbeam-rs/crossbeam/blob/crossbeam-utils-0.8.8/crossbeam-utils/CHANGELOG.md)

Second commit: no notable changes, most of them touched only to remove other ones:
* Updating ammonia v3.1.3 -> v3.2.0
* Updating html5ever v0.25.1 -> v0.26.0
* Updating markup5ever v0.10.1 -> v0.11.0
* Removing markup5ever_rcdom v0.1.0
* Updating phf v0.8.0 -> v0.10.1
* Updating phf_codegen v0.8.0 -> v0.10.0
* Updating phf_generator v0.8.0 -> v0.10.0
* Updating phf_shared v0.8.0 -> v0.10.0
* Updating rand v0.8.4 -> v0.8.5
* Removing rand_hc v0.3.0
* Removing rand_pcg v0.2.1
* Updating string_cache v0.8.0 -> v0.8.3
* Updating string_cache_codegen v0.5.1 -> v0.5.2
* Removing xml5ever v0.16.1

drops markup5ever_rcdom, rand_hc, rand_pcg, xml5ever versions

* rand 0.8.4 -> 0.8.5 (https://github.com/rust-random/rand/blob/0.8.5/CHANGELOG.md#085---2021-08-20)

Third one is perf oriented:
* proc-macro2 v1.0.30 -> v1.0.37 https://github.com/dtolnay/proc-macro2/compare/1.0.30...1.0.37 (https://github.com/dtolnay/proc-macro2/releases, for example https://github.com/dtolnay/proc-macro2/releases/tag/1.0.36)
* quote v1.0.7 -> v1.0.18 https://github.com/dtolnay/quote/compare/1.0.7...1.0.18 (https://github.com/dtolnay/quote/releases) multiple perf improvements: https://github.com/dtolnay/quote/releases/tag/1.0.16, https://github.com/dtolnay/quote/releases/tag/1.0.14, https://github.com/dtolnay/quote/releases/tag/1.0.11
* syn v1.0.80 -> v1.0.91 https://github.com/dtolnay/syn/compare/1.0.80...1.0.91 (https://github.com/dtolnay/syn/releases): didn't find good examples, but given, that there exist private api across `proc-macro2`, `quote` by the same author, *i think* it may take advantage of it.

2 years agoFixed grammatical error in example comment
Simon [Wed, 27 Apr 2022 15:27:02 +0000 (17:27 +0200)]
Fixed grammatical error in example comment

2 years agocombine all unsized types and add another recursive call to process nested unsized...
b-naber [Wed, 27 Apr 2022 09:11:54 +0000 (11:11 +0200)]
combine all unsized types and add another recursive call to process nested unsized types correctly

2 years agoAuto merge of #95170 - jyn514:ci-llvm, r=Mark-Simulacrum
bors [Wed, 27 Apr 2022 13:27:22 +0000 (13:27 +0000)]
Auto merge of #95170 - jyn514:ci-llvm, r=Mark-Simulacrum

Move `download-ci-llvm` out of bootstrap.py

This is ready for review. It has been tested on Windows, Linux, and NixOS.

The second commit ports the changes from https://github.com/rust-lang/rust/pull/95234 to Rust; I can remove it if desired.

Helps with https://github.com/rust-lang/rust/issues/94829.

As a follow-up, this makes it possible to avoid downloading llvm until it's needed for building `rustc_llvm`; it would be nice to do that, but it shouldn't go in the first draft. It might also be possible to avoid requiring python until tests run (currently there's a check in `sanity.rs`), but I haven't looked too much into that.

`@rustbot` label +A-rustbuild

2 years agoAuto merge of #96371 - c410-f3r:z-errors, r=petrochenkov
bors [Wed, 27 Apr 2022 10:46:32 +0000 (10:46 +0000)]
Auto merge of #96371 - c410-f3r:z-errors, r=petrochenkov

Move some tests to more reasonable places

cc https://github.com/rust-lang/rust/issues/73494
r? `@petrochenkov`

2 years agorename `sum_with_parens`
Christian Poveda [Wed, 27 Apr 2022 10:03:16 +0000 (12:03 +0200)]
rename `sum_with_parens`

2 years agotut tut tut
Ellen [Wed, 27 Apr 2022 07:51:33 +0000 (08:51 +0100)]
tut tut tut

2 years agoBetter error messages when collecting into `[T; n]`
Michael Goulet [Wed, 27 Apr 2022 04:09:26 +0000 (21:09 -0700)]
Better error messages when collecting into `[T; n]`

2 years agoAuto merge of #96195 - sunfishcode:sunfishcode/handle-or-error-type, r=joshtriplett
bors [Wed, 27 Apr 2022 03:42:59 +0000 (03:42 +0000)]
Auto merge of #96195 - sunfishcode:sunfishcode/handle-or-error-type, r=joshtriplett

 Define a dedicated error type for `HandleOrNull` and `HandleOrInvalid`.

Define `NullHandleError` and `InvalidHandleError` types, that implement std::error::Error, and use them as the error types in `HandleOrNull` and `HandleOrInvalid`,

This addresses [this concern](https://github.com/rust-lang/rust/issues/87074#issuecomment-1080031167).

This is the same as #95387.

r? `@joshtriplett`

2 years agoMove some tests to more reasonable places
Caio [Wed, 27 Apr 2022 02:38:04 +0000 (23:38 -0300)]
Move some tests to more reasonable places

2 years agoTAITs are suggestable
Michael Goulet [Mon, 25 Apr 2022 03:41:37 +0000 (20:41 -0700)]
TAITs are suggestable

2 years agomake `fn() -> _ {}` suggestion MachineApplicable
Michael Goulet [Mon, 25 Apr 2022 03:11:51 +0000 (20:11 -0700)]
make `fn() -> _ {}` suggestion MachineApplicable

2 years agoAuto merge of #96459 - Dylan-DPC:rollup-de6ud9d, r=Dylan-DPC
bors [Wed, 27 Apr 2022 01:01:58 +0000 (01:01 +0000)]
Auto merge of #96459 - Dylan-DPC:rollup-de6ud9d, r=Dylan-DPC

Rollup of 6 pull requests

Successful merges:

 - #92569 (Improve Error Messaging for Unconstructed Structs and Enum Variants in Generic Contexts)
 - #96370 (Cleanup `report_method_error` a bit)
 - #96383 (Fix erased region escaping into wfcheck due to #95395)
 - #96385 (Recover most `impl Trait` and `dyn Trait` lifetime bound suggestions under NLL)
 - #96410 (rustdoc: do not write `{{root}}` in `pub use ::foo` docs)
 - #96430 (Fix handling of `!` in rustdoc search)

Failed merges:

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

2 years agoRollup merge of #96430 - GuillaumeGomez:search-exclamation, r=notriddle
Dylan DPC [Wed, 27 Apr 2022 00:47:12 +0000 (02:47 +0200)]
Rollup merge of #96430 - GuillaumeGomez:search-exclamation, r=notriddle

Fix handling of `!` in rustdoc search

Fixes #96399.

I also updated the eBNF.

cc `@jsha`
r? `@notriddle`

2 years agoRollup merge of #96410 - notriddle:notriddle/issue-95873, r=GuillaumeGomez
Dylan DPC [Wed, 27 Apr 2022 00:47:11 +0000 (02:47 +0200)]
Rollup merge of #96410 - notriddle:notriddle/issue-95873, r=GuillaumeGomez

rustdoc: do not write `{{root}}` in `pub use ::foo` docs

Fixes #95873

2 years agoRollup merge of #96385 - marmeladema:nll-fix-trait-lifetime-bound-suggestions, r...
Dylan DPC [Wed, 27 Apr 2022 00:47:11 +0000 (02:47 +0200)]
Rollup merge of #96385 - marmeladema:nll-fix-trait-lifetime-bound-suggestions, r=jackh726

Recover most `impl Trait` and `dyn Trait` lifetime bound suggestions under NLL

This is done by replacing the duplicated (and very partial) implementation from borrowck with one inspsired from `NiceRegionError::try_report_static_impl_trait` and by re-using `suggest_new_region_bound`.

Fixes #96277

r? ```@jackh726```

2 years agoRollup merge of #96383 - compiler-errors:issue-96381, r=estebank
Dylan DPC [Wed, 27 Apr 2022 00:47:10 +0000 (02:47 +0200)]
Rollup merge of #96383 - compiler-errors:issue-96381, r=estebank

Fix erased region escaping into wfcheck due to #95395

We can just use `liberate_late_bound_regions` instead of `erase_late_bound_regions`... This gives us `ReEarlyBound` instead of `ReErased`, the former being something typeck actually knows how to deal with...

Fixes #96381

Side-note: We only actually get far enough in the compiler pipeline to cause this ICE when we're invoking rustdoc. We actually abort rustc right before wfcheck because of the error that we emit (having `_` in the type signature). Why does rustdoc keep going even though we raise an error?

2 years agoRollup merge of #96370 - compiler-errors:cleanup-report_method_error, r=estebank
Dylan DPC [Wed, 27 Apr 2022 00:47:07 +0000 (02:47 +0200)]
Rollup merge of #96370 - compiler-errors:cleanup-report_method_error, r=estebank

Cleanup `report_method_error` a bit

1. Remove an unnecessary indentation level
2. Split out a couple of large functions from this humongo function body

2 years agoRollup merge of #92569 - George-lewis:87181, r=estebank
Dylan DPC [Wed, 27 Apr 2022 00:47:07 +0000 (02:47 +0200)]
Rollup merge of #92569 - George-lewis:87181, r=estebank

Improve Error Messaging for Unconstructed Structs and Enum Variants in Generic Contexts

Improves error messaging for empty-tuple structs and enum variants in certain generic contexts. See new ui tests for examples.

Closes #87181

2 years agoMake explicit an unreachable `NoDelim` case in `rustfmt`.
Nicholas Nethercote [Tue, 26 Apr 2022 05:09:11 +0000 (15:09 +1000)]
Make explicit an unreachable `NoDelim` case in `rustfmt`.

2 years agoAvoid producing `NoDelim` values in `FrameData`.
Nicholas Nethercote [Tue, 26 Apr 2022 06:21:55 +0000 (16:21 +1000)]
Avoid producing `NoDelim` values in `FrameData`.

2 years agoAuto merge of #96425 - oli-obk:fix_incremental_regression_unsafety_checking, r=compil...
bors [Tue, 26 Apr 2022 22:35:40 +0000 (22:35 +0000)]
Auto merge of #96425 - oli-obk:fix_incremental_regression_unsafety_checking, r=compiler-errors

Fix incremental perf regression unsafety checking

Perf regression introduced in #96294

We will simply avoid emitting the name of the unsafe function in MIR unsafeck, since we're moving to THIR unsafeck anyway.

2 years agoAvoid producing `NoDelim` values in `Frame`.
Nicholas Nethercote [Tue, 26 Apr 2022 05:38:10 +0000 (15:38 +1000)]
Avoid producing `NoDelim` values in `Frame`.

The code currently ignores the actual delimiter on the RHS and fakes up
a `NoDelim`/`DelimSpan::dummy()` one. This commit changes it to use the
actual delimiter.

The commit also reorders the fields for the `Delimited` variant to match
the `Sequence` variant.

2 years agoAvoid producing `NoDelim` values in `MacArgs::delim()`.
Nicholas Nethercote [Tue, 26 Apr 2022 05:21:15 +0000 (15:21 +1000)]
Avoid producing `NoDelim` values in `MacArgs::delim()`.

2 years agoAvoid producing `NoDelim` values in `TokenCursorFrame`.
Nicholas Nethercote [Tue, 26 Apr 2022 03:14:38 +0000 (13:14 +1000)]
Avoid producing `NoDelim` values in `TokenCursorFrame`.

2 years agoTidy
George [Tue, 26 Apr 2022 21:05:49 +0000 (17:05 -0400)]
Tidy

2 years agoAdd new diagnostic
George [Tue, 26 Apr 2022 21:04:44 +0000 (17:04 -0400)]
Add new diagnostic

2 years agoFix the filename in the expected error message.
Dan Gohman [Tue, 26 Apr 2022 19:47:24 +0000 (12:47 -0700)]
Fix the filename in the expected error message.

2 years agoUpdate rustdoc search test to check `!`
Guillaume Gomez [Tue, 26 Apr 2022 11:58:43 +0000 (13:58 +0200)]
Update rustdoc search test to check `!`

2 years agoUpdate rustdoc search parser to handle `!` correctly
Guillaume Gomez [Tue, 26 Apr 2022 11:58:23 +0000 (13:58 +0200)]
Update rustdoc search parser to handle `!` correctly

2 years agoAdd `only-windows` versions of the coerce-issue-49593-box-never test.
Dan Gohman [Tue, 26 Apr 2022 16:52:22 +0000 (09:52 -0700)]
Add `only-windows` versions of the coerce-issue-49593-box-never test.

2 years agoaccount for custom DSTs in valtree -> constvalue conversion
b-naber [Tue, 26 Apr 2022 08:58:45 +0000 (10:58 +0200)]
account for custom DSTs in valtree -> constvalue conversion

2 years agoAuto merge of #96428 - GuillaumeGomez:rollup-4noqr33, r=GuillaumeGomez
bors [Tue, 26 Apr 2022 15:59:46 +0000 (15:59 +0000)]
Auto merge of #96428 - GuillaumeGomez:rollup-4noqr33, r=GuillaumeGomez

Rollup of 8 pull requests

Successful merges:

 - #94022 (Clarify that `Cow::into_owned` returns owned data)
 - #94703 (Fix codegen bug in "ptx-kernel" abi related to arg passing)
 - #95949 (Implement Default for AssertUnwindSafe)
 - #96361 (Switch JS code to ES6)
 - #96372 (Suggest calling method on nested field when struct is missing method)
 - #96386 (simplify `describe_field` func in borrowck's diagnostics part)
 - #96400 (Correct documentation for `Rvalue::ShallowInitBox`)
 - #96415 (Remove references to git.io)

Failed merges:

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

2 years agoRevert "add `DefId` to unsafety violations and display function path in E0133"
Oli Scherer [Tue, 26 Apr 2022 10:43:00 +0000 (10:43 +0000)]
Revert "add `DefId` to unsafety violations and display function path in E0133"

This reverts commit 8b8f6653cfd54525714f02efe7af0a0f830e185c.

2 years agoUpdate src/test/rustdoc/issue-95873.rs
Michael Howell [Tue, 26 Apr 2022 14:13:30 +0000 (07:13 -0700)]
Update src/test/rustdoc/issue-95873.rs

Co-authored-by: Guillaume Gomez <guillaume1.gomez@gmail.com>
2 years agonot need `Option` for `dbg_scope`
SparrowLii [Tue, 26 Apr 2022 13:00:19 +0000 (21:00 +0800)]
not need `Option` for `dbg_scope`

2 years agoRollup merge of #96415 - ehuss:git-io, r=bjorn3
Guillaume Gomez [Tue, 26 Apr 2022 11:22:31 +0000 (13:22 +0200)]
Rollup merge of #96415 - ehuss:git-io, r=bjorn3

Remove references to git.io

The git.io service is shutting down soon (see https://github.blog/changelog/2022-04-25-git-io-deprecation/). This removes the references of those short links with the actual destination.

2 years agoRollup merge of #96400 - JakobDegen:shallow-init-docs, r=Dylan-DPC
Guillaume Gomez [Tue, 26 Apr 2022 11:22:30 +0000 (13:22 +0200)]
Rollup merge of #96400 - JakobDegen:shallow-init-docs, r=Dylan-DPC

Correct documentation for `Rvalue::ShallowInitBox`

As a part of the big MIR docs PR, I had added a comment indicating that `Rvalue::ShallowInitBox` is disallowed after drop elaboration, but this is not true (no idea why I thought it was). Codegen has support for it, and trying to enforce this rule in the validator causes compiling core to ICE on the very first `box` statement.

That being said, this `Rvalue` probably *should* be banned after drop elaboration - it doesn't seem like it's still useful for much. However, I do not have time right now to actually go investigate how difficult a change that is to make, so in the meantime fixing the docs to reflect the current situation seems like the right step.

r? rust-lang/mir-opt

2 years agoRollup merge of #96386 - SparrowLii:des_field, r=jackh726
Guillaume Gomez [Tue, 26 Apr 2022 11:22:29 +0000 (13:22 +0200)]
Rollup merge of #96386 - SparrowLii:des_field, r=jackh726

simplify `describe_field` func in borrowck's diagnostics part

This PR simplify the `describe_field` func in borrowck's diagnostics part, besides fix the FIXME in it.

2 years agoRollup merge of #96372 - compiler-errors:field-method-suggest, r=oli-obk
Guillaume Gomez [Tue, 26 Apr 2022 11:22:29 +0000 (13:22 +0200)]
Rollup merge of #96372 - compiler-errors:field-method-suggest, r=oli-obk

Suggest calling method on nested field when struct is missing method

Similar to the suggestion to change `x.field` to `x.nested.field`, implement a similar suggestion for when `x.method()` should be replaced with `x.nested.method()`.

2 years agoRollup merge of #96361 - GuillaumeGomez:es6, r=notriddle
Guillaume Gomez [Tue, 26 Apr 2022 11:22:28 +0000 (13:22 +0200)]
Rollup merge of #96361 - GuillaumeGomez:es6, r=notriddle

Switch JS code to ES6

Considering it's already quite big, I'll do the remaining files in another PR.

Part of #93058.

r? ``@notriddle``

2 years agoRollup merge of #95949 - SoniEx2:patch-5, r=m-ou-se
Guillaume Gomez [Tue, 26 Apr 2022 11:22:27 +0000 (13:22 +0200)]
Rollup merge of #95949 - SoniEx2:patch-5, r=m-ou-se

Implement Default for AssertUnwindSafe

Trait impls are still insta-stable yeah...?

2 years agoRollup merge of #94703 - kjetilkjeka:nvptx-kernel-args-abi2, r=nagisa
Guillaume Gomez [Tue, 26 Apr 2022 11:22:27 +0000 (13:22 +0200)]
Rollup merge of #94703 - kjetilkjeka:nvptx-kernel-args-abi2, r=nagisa

Fix codegen bug in "ptx-kernel" abi related to arg passing

I found a codegen bug in the nvptx abi related to that args are passed as ptrs ([see comment](https://github.com/rust-lang/rust/issues/38788#issuecomment-1048999928)), this is not as specified in the [ptx-interoperability doc](https://docs.nvidia.com/cuda/ptx-writers-guide-to-interoperability/) or how C/C++ does it. It will also almost always fail in practice since device/host uses different memory spaces for most hardware.

This PR fixes the bug and add tests for passing structs to ptx kernels.

I observed that all nvptx assembly tests had been marked as [ignore a long time ago](https://github.com/rust-lang/rust/pull/59752#issuecomment-501713428). I'm not sure if the new one should be marked as ignore, it passed on my computer but it might fail if ptx-linker is missing on the server? I guess this is outside scope for this PR and should be looked at in a different issue/PR.

I only fixed the nvptx64-nvidia-cuda target and not the potential code paths for the non-existing 32bit target. Even though 32bit nvptx is not a supported target there are still some code under the hood supporting codegen for 32 bit ptx. I was advised to create an MCP to find out if this code should be removed or updated.

Perhaps ``@RDambrosio016`` would have interest in taking a quick look at this.

2 years agoRollup merge of #94022 - jongiddy:cow-into-owned-docs, r=Dylan-DPC
Guillaume Gomez [Tue, 26 Apr 2022 11:22:26 +0000 (13:22 +0200)]
Rollup merge of #94022 - jongiddy:cow-into-owned-docs, r=Dylan-DPC

Clarify that `Cow::into_owned` returns owned data

Two sections of the `Cow::into_owned` docs imply that `into_owned` returns a `Cow`. Clarify that it returns the underlying owned object, either cloned or extracted from the `Cow`.

2 years agoAuto merge of #96424 - oli-obk:miri_update, r=oli-obk
bors [Tue, 26 Apr 2022 10:14:05 +0000 (10:14 +0000)]
Auto merge of #96424 - oli-obk:miri_update, r=oli-obk

update miri submodule

r? `@ghost`

fixes  #96402

2 years agoadd hacky closure to struct_tail_with_normalize in order to allow us to walk valtrees...
b-naber [Tue, 26 Apr 2022 08:56:04 +0000 (10:56 +0200)]
add hacky closure to struct_tail_with_normalize in order to allow us to walk valtrees in lockstep with the type

2 years agoupdate miri submodule
Oli Scherer [Tue, 26 Apr 2022 09:41:00 +0000 (09:41 +0000)]
update miri submodule

2 years agoseparate messages by a newline
Christian Poveda [Tue, 26 Apr 2022 09:13:23 +0000 (11:13 +0200)]
separate messages by a newline

2 years agomove `AmbigousPlus` outside
Christian Poveda [Tue, 26 Apr 2022 09:12:48 +0000 (11:12 +0200)]
move `AmbigousPlus` outside

2 years agoavoid `format!`
Christian Poveda [Tue, 26 Apr 2022 09:11:23 +0000 (11:11 +0200)]
avoid `format!`

2 years agoAuto merge of #94034 - willcrichton:fix-trait-suggestion-for-binops, r=estebank
bors [Tue, 26 Apr 2022 07:29:15 +0000 (07:29 +0000)]
Auto merge of #94034 - willcrichton:fix-trait-suggestion-for-binops, r=estebank

Fix incorrect suggestion for trait bounds involving binary operators

This PR fixes #93927, #92347, #93744 by replacing the bespoke trait-suggestion logic in `op.rs` with a more common code path.

The downside is that this fix causes some suggestions to not include an `Output=` type, reducing their usefulness.

Note that this causes one case in the `missing-bounds.rs` test to fail rustfix. So I would need to move that code into a separate non-fix test if this PR is otherwise acceptable.

2 years agoAuto merge of #96404 - tmandry:roll-llvm, r=cuviper
bors [Tue, 26 Apr 2022 04:48:33 +0000 (04:48 +0000)]
Auto merge of #96404 - tmandry:roll-llvm, r=cuviper

Update LLVM submodule

* [[fuchsia] Don't include duplicate profiling symbols for Fuchsia
](https://github.com/rust-lang/llvm-project/commit/326efc90ac5bf79a8fdd90898addf86bb6a6e404)
* [[MIPS] Initial support for MIPS-I load delay slots
](https://github.com/rust-lang/llvm-project/commit/161fd6b0b10464dd3f7ed50af7aea7df5a1acccf)

r? `@rust-lang/wg-llvm`

2 years agoUpdate unop path, fix tests
Will Crichton [Tue, 26 Apr 2022 02:14:09 +0000 (19:14 -0700)]
Update unop path, fix tests

2 years agoAuto merge of #96414 - Dylan-DPC:rollup-t4ofhoa, r=Dylan-DPC
bors [Tue, 26 Apr 2022 01:52:46 +0000 (01:52 +0000)]
Auto merge of #96414 - Dylan-DPC:rollup-t4ofhoa, r=Dylan-DPC

Rollup of 6 pull requests

Successful merges:

 - #90312 (Fix some confusing wording and improve slice-search-related docs)
 - #96149 (Remove unused macro rules)
 - #96279 (rustdoc: Remove .woff font files)
 - #96355 (Better handle too many `#` recovery in raw str)
 - #96379 (delay bug when adjusting `NeverToAny` twice during diagnostic code)
 - #96384 (do not consider two extern types to be similar)

Failed merges:

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