]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoAuto merge of #89089 - JohnTitor:rollup-6s6mccx, r=JohnTitor
bors [Sun, 19 Sep 2021 11:03:09 +0000 (11:03 +0000)]
Auto merge of #89089 - JohnTitor:rollup-6s6mccx, r=JohnTitor

Rollup of 10 pull requests

Successful merges:

 - #87960 (Suggest replacing an inexisting field for an unmentioned field)
 - #88855 (Allow simd_shuffle to accept vectors of any length)
 - #88966 (Check for shadowing issues involving block labels)
 - #88996 (Fix linting when trailing macro expands to a trailing semi)
 - #89017 (fix potential race in AtomicU64 time monotonizer)
 - #89021 (Add a separate error for `dyn Trait` in `const fn`)
 - #89051 (Add intra-doc links and small changes to `std::os` to be more consistent)
 - #89053 (refactor: VecDeques IntoIter fields to private)
 - #89055 (Suggest better place to add call parentheses for method expressions wrapped in parentheses)
 - #89081 (Fix a typo)

Failed merges:

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

2 years agoRollup merge of #89081 - ondra05:patch-1, r=dtolnay
Yuki Okushi [Sun, 19 Sep 2021 08:31:35 +0000 (17:31 +0900)]
Rollup merge of #89081 - ondra05:patch-1, r=dtolnay

Fix a typo

Removed extra spaces in front of commas

2 years agoRollup merge of #89055 - Kobzol:wrapped-method-expr-call-parens, r=wesleywiser
Yuki Okushi [Sun, 19 Sep 2021 08:31:35 +0000 (17:31 +0900)]
Rollup merge of #89055 - Kobzol:wrapped-method-expr-call-parens, r=wesleywiser

Suggest better place to add call parentheses for method expressions wrapped in parentheses

I wanted to improve the suggestion a bit to both remove the wrapping parentheses **and** add call parentheses by both calling `suggest_method_call` and using `multipart_suggestion`. But I very quickly ran into a problem where multiple overlapping machine applicable suggestions cannot be properly applied together. So I applied the suggestion from the issue and only added the call parentheses directly after the expression.

Fixes: https://github.com/rust-lang/rust/issues/89044
2 years agoRollup merge of #89053 - DeveloperC286:into_iter_fields_to_private, r=Mark-Simulacrum
Yuki Okushi [Sun, 19 Sep 2021 08:31:34 +0000 (17:31 +0900)]
Rollup merge of #89053 - DeveloperC286:into_iter_fields_to_private, r=Mark-Simulacrum

refactor: VecDeques IntoIter fields to private

Made the fields of VecDeque's IntoIter private by creating a IntoIter::from(...) function to create a new instance of IntoIter and migrating usage to use IntoIter::from(...).

2 years agoRollup merge of #89051 - schctl:master, r=jyn514
Yuki Okushi [Sun, 19 Sep 2021 08:31:33 +0000 (17:31 +0900)]
Rollup merge of #89051 - schctl:master, r=jyn514

Add intra-doc links and small changes to `std::os` to be more consistent

I believe that a few items in `std::os` should be linked. I've also added a basic example in `std::os::windows`.

2 years agoRollup merge of #89021 - WaffleLapkin:separate_error_for_dyn_trait_in_const_fn, r...
Yuki Okushi [Sun, 19 Sep 2021 08:31:33 +0000 (17:31 +0900)]
Rollup merge of #89021 - WaffleLapkin:separate_error_for_dyn_trait_in_const_fn, r=estebank

Add a separate error for `dyn Trait` in `const fn`

Previously "trait bounds other than `Sized` on const fn parameters are unstable" error was used for both trait bounds (`<T: Trait>`) and trait objects (`dyn Trait`). This was pretty confusing.

This PR adds a separate error for trait objects: "trait objects in const fn are unstable". The error for trait bounds is otherwise intact.

This is follow up to #88907

r? ``@estebank``

``@rustbot`` label: +A-diagnostics

2 years agoRollup merge of #89017 - the8472:fix-u64-time-monotonizer, r=kennytm
Yuki Okushi [Sun, 19 Sep 2021 08:31:32 +0000 (17:31 +0900)]
Rollup merge of #89017 - the8472:fix-u64-time-monotonizer, r=kennytm

fix potential race in AtomicU64 time monotonizer

The AtomicU64-based monotonizer introduced in #83093 is incorrect because several threads could try to update the value concurrently and a thread which doesn't have the newest value among all the updates could win.

That bug probably has little real world impact since it doesn't make observed time worse than hardware clocks. The worst case would probably be a thread which has a clock that is behind by several cycles observing several inconsistent fixups, which should be similar to observing the unfiltered backslide in the first place.

New benchmarks, they don't look as good as the original PR but still an improvement compared to the mutex.
I don't know why the contended mutex case is faster now than in the previous benchmarks.

```
actually_monotonic() == true:
test time::tests::instant_contention_01_threads                   ... bench:          44 ns/iter (+/- 0)
test time::tests::instant_contention_02_threads                   ... bench:          45 ns/iter (+/- 0)
test time::tests::instant_contention_04_threads                   ... bench:          45 ns/iter (+/- 0)
test time::tests::instant_contention_08_threads                   ... bench:          45 ns/iter (+/- 0)
test time::tests::instant_contention_16_threads                   ... bench:          46 ns/iter (+/- 0)

atomic u64:
test time::tests::instant_contention_01_threads                   ... bench:          66 ns/iter (+/- 0)
test time::tests::instant_contention_02_threads                   ... bench:         287 ns/iter (+/- 14)
test time::tests::instant_contention_04_threads                   ... bench:         296 ns/iter (+/- 43)
test time::tests::instant_contention_08_threads                   ... bench:         604 ns/iter (+/- 163)
test time::tests::instant_contention_16_threads                   ... bench:       1,147 ns/iter (+/- 29)

mutex:
test time::tests::instant_contention_01_threads                   ... bench:          78 ns/iter (+/- 0)
test time::tests::instant_contention_02_threads                   ... bench:         652 ns/iter (+/- 275)
test time::tests::instant_contention_04_threads                   ... bench:         900 ns/iter (+/- 32)
test time::tests::instant_contention_08_threads                   ... bench:       1,927 ns/iter (+/- 62)
test time::tests::instant_contention_16_threads                   ... bench:       3,748 ns/iter (+/- 146)
```

2 years agoRollup merge of #88996 - Aaron1011:trailing-macro-semi, r=petrochenkov
Yuki Okushi [Sun, 19 Sep 2021 08:31:31 +0000 (17:31 +0900)]
Rollup merge of #88996 - Aaron1011:trailing-macro-semi, r=petrochenkov

Fix linting when trailing macro expands to a trailing semi

When a macro is used in the trailing expression position of a block
(e.g. `fn foo() { my_macro!() }`), we currently parse it as an
expression, rather than a statement. As a result, we ended up
using the `NodeId` of the containing statement as our `lint_node_id`,
even though we don't normally do this for macro calls.

If such a macro expands to an expression with a `#[cfg]` attribute,
then the trailing statement can get removed entirely. This lead to
an ICE, since we were usng the `NodeId` of the expression to emit
a lint.

Ths commit makes us skip updating `lint_node_id` when handling
a macro in trailing expression position. This will cause us to
lint at the closest parent of the macro call.

2 years agoRollup merge of #88966 - tmiasko:block-label-shadowing, r=petrochenkov
Yuki Okushi [Sun, 19 Sep 2021 08:31:30 +0000 (17:31 +0900)]
Rollup merge of #88966 - tmiasko:block-label-shadowing, r=petrochenkov

Check for shadowing issues involving block labels

2 years agoRollup merge of #88855 - calebzulawski:feature/simd_shuffle, r=nagisa
Yuki Okushi [Sun, 19 Sep 2021 08:31:29 +0000 (17:31 +0900)]
Rollup merge of #88855 - calebzulawski:feature/simd_shuffle, r=nagisa

Allow simd_shuffle to accept vectors of any length

cc ``@rust-lang/project-portable-simd`` ``@workingjubilee``

2 years agoRollup merge of #87960 - hkmatsumoto:suggest-inexisting-field-for-unmentioned-field...
Yuki Okushi [Sun, 19 Sep 2021 08:31:29 +0000 (17:31 +0900)]
Rollup merge of #87960 - hkmatsumoto:suggest-inexisting-field-for-unmentioned-field, r=estebank

Suggest replacing an inexisting field for an unmentioned field

Fix #87938

This PR adds a suggestion to replace an inexisting field for an
unmentioned field. Given the following code:
```rust
enum Foo {
    Bar { alpha: u8, bravo: u8, charlie: u8 },
}

fn foo(foo: Foo) {
    match foo {
        Foo::Bar {
            alpha,
            beta, // `bravo` miswritten as `beta` here.
            charlie,
        } => todo!(),
    }
}
```
the compiler now emits the error messages below.
```text
error[E0026]: variant `Foo::Bar` does not have a field named `beta`
 --> src/lib.rs:9:13
  |
9 |             beta, // `bravo` miswritten as `beta` here.
  |             ^^^^
  |             |
  |             variant `Foo::Bar` does not have this field
  |             help: `Foo::Bar` has a field named `bravo`: `bravo`
```

Note that this suggestion is available iff the number of inexisting
fields and unmentioned fields are both 1.

2 years agoAuto merge of #89031 - the8472:outline-once-cell-init-closure, r=Mark-Simulacrum
bors [Sun, 19 Sep 2021 08:05:45 +0000 (08:05 +0000)]
Auto merge of #89031 - the8472:outline-once-cell-init-closure, r=Mark-Simulacrum

Don't inline OnceCell initialization closures

The more general variant of #89026, originally suggested in https://github.com/rust-lang/rust/pull/86898#issuecomment-920138051

2 years agoAuto merge of #89028 - Aaron1011:coercion-cause, r=nagisa
bors [Sun, 19 Sep 2021 04:34:16 +0000 (04:34 +0000)]
Auto merge of #89028 - Aaron1011:coercion-cause, r=nagisa

Propagate coercion cause into `try_coerce`

Currently, `coerce_inner` discards its `ObligationCause`
when calling `try_coerce`. This interfers with other
diagnostc improvements I'm working on, since we will lose
the original span by the time the actual coercion occurs.

Additionally, we now use the span of the trailing expression
(rather than the span of the entire function) when performing
a coercion in `check_return_expr`. This currently has no visible
effect on any of the unit tests, but will unblock future
diagnostic improvements.

2 years agoAuto merge of #88968 - tmiasko:start-block-no-predecessors, r=davidtwco
bors [Sun, 19 Sep 2021 01:38:17 +0000 (01:38 +0000)]
Auto merge of #88968 - tmiasko:start-block-no-predecessors, r=davidtwco

Start block is not allowed to have basic block predecessors

* The MIR validator is extended to detect potential violations.
* The start block has no predecessors after building MIR, so no changes are required there.
* The SimplifyCfg could previously violate this requirement when collapsing goto chains, so transformation is disabled for the start block, which also substantially simplifies the implementation.
* The LLVM function entry block also must not have basic block predecessors. Previously, to ensure that code generation had to perform necessary adjustments. This now became unnecessary.

The motivation behind the change is to align with analogous requirement in LLVM, and to avoid potential latent bugs like the one reported in #88043.

2 years agoAuto merge of #89079 - ehuss:update-cargo, r=ehuss
bors [Sat, 18 Sep 2021 22:54:11 +0000 (22:54 +0000)]
Auto merge of #89079 - ehuss:update-cargo, r=ehuss

Update cargo

1 commits in 33ee5f82edb50af87b952c5b28de0f5fb41ebf18..9a28ac83c9eb73e42ffafac552c0a55f00dbf40c
2021-09-17 13:51:54 +0000 to 2021-09-18 15:42:28 -0500
- Temporarily revert curl-sys update. (rust-lang/cargo#9920)

2 years agoFix typo
ondra05 [Sat, 18 Sep 2021 21:39:56 +0000 (23:39 +0200)]
Fix typo

Removed extra spaces in front of commas

2 years agoUpdate cargo
Eric Huss [Sat, 18 Sep 2021 20:58:26 +0000 (13:58 -0700)]
Update cargo

2 years agoAuto merge of #89000 - Mark-Simulacrum:no-new-lrc, r=petrochenkov
bors [Sat, 18 Sep 2021 20:13:21 +0000 (20:13 +0000)]
Auto merge of #89000 - Mark-Simulacrum:no-new-lrc, r=petrochenkov

Reuse existing shared Lrc for MatchImpl parent

This is a small performance win for the hot path, which helps to address this regression: https://github.com/rust-lang/rust/pull/87244#issuecomment-883635813.

2 years agoAuto merge of #88994 - Aaron1011:intercrate-caching, r=jackh726
bors [Sat, 18 Sep 2021 17:18:28 +0000 (17:18 +0000)]
Auto merge of #88994 - Aaron1011:intercrate-caching, r=jackh726

Disable the evaluation cache when in intercrate mode

It's possible to use the same `InferCtxt` with both
an intercrate and non-intercrate `SelectionContext`. However,
the local (inferctxt) evaluation cache is not aware of this
distinction, so this kind of `InferCtxt` re-use will pollute
the cache wth bad results.

This commit avoids the issue by disabling the evaluation cache
entirely during intercrate mode.

2 years agoAuto merge of #82183 - michaelwoerister:lazier-defpathhash-loading2, r=wesleywiser
bors [Sat, 18 Sep 2021 14:37:39 +0000 (14:37 +0000)]
Auto merge of #82183 - michaelwoerister:lazier-defpathhash-loading2, r=wesleywiser

Simplify lazy DefPathHash decoding by using an on-disk hash table.

This PR simplifies the logic around mapping `DefPathHash` values encountered during incremental compilation to valid `DefId`s in the current session. It is able to do so by using an on-disk hash table encoding that allows for looking up values directly, i.e. without deserializing the entire table.

The main simplification comes from not having to keep track of `DefPathHashes` being used during the compilation session.

2 years agoAuto merge of #88650 - sapessi:issue-77175-fix, r=estebank
bors [Sat, 18 Sep 2021 11:56:23 +0000 (11:56 +0000)]
Auto merge of #88650 - sapessi:issue-77175-fix, r=estebank

Skip single use lifetime lint for generated opaque types

Fix: #77175

The opaque type generated by the desugaring process of an async function uses the lifetimes defined by the originating function. The DefId for the lifetimes in the opaque type are different from the ones in the originating async function - as they should be, as far as I understand, and could therefore be considered a single use lifetimes, this causes the single_use_lifetimes lint to fail compilation if explicitly denied. This fix skips the lint for lifetimes used only once in generated opaque types for an async function that are declared in the parent async function definition.

More info in the comments on the original issue: 1 and 2

2 years agoSuggest better place to add call parentheses for method expressions wrapped in parent...
Jakub Beránek [Fri, 17 Sep 2021 20:18:05 +0000 (22:18 +0200)]
Suggest better place to add call parentheses for method expressions wrapped in parentheses

2 years agoAuto merge of #88988 - Mark-Simulacrum:avoid-into-ok, r=nagisa
bors [Sat, 18 Sep 2021 09:15:40 +0000 (09:15 +0000)]
Auto merge of #88988 - Mark-Simulacrum:avoid-into-ok, r=nagisa

Avoid codegen for Result::into_ok in lang_start

This extra codegen seems to be the cause for the regressions in max-rss on #86034. While LLVM will certainly optimize the dead code away, avoiding it's generation in the first place seems good, particularly when it is so simple.

#86034 produced this [diff](https://gist.github.com/Mark-Simulacrum/95c7599883093af3b960c35ffadf4dab#file-86034-diff) for a simple `fn main() {}`. With this PR, that diff [becomes limited to just a few extra IR instructions](https://gist.github.com/Mark-Simulacrum/95c7599883093af3b960c35ffadf4dab#file-88988-from-pre-diff) -- no extra functions.

Note that these are pre-optimization; LLVM surely will eliminate this during optimization. However, that optimization can end up generating more work and bump memory usage, and this eliminates that.

2 years agoAuto merge of #88980 - tmiasko:instrument-debug, r=oli-obk
bors [Sat, 18 Sep 2021 06:11:02 +0000 (06:11 +0000)]
Auto merge of #88980 - tmiasko:instrument-debug, r=oli-obk

Use explicit log level in tracing instrument macro

Specify a log level in tracing instrument macro explicitly.

Additionally reduce the used log level from a default info level to a
debug level (all of those appear to be developer oriented logs, so there
should be no need to include them in release builds).

2 years agoAuto merge of #88978 - bjorn3:move_symbol_interner_lock, r=Mark-Simulacrum
bors [Sat, 18 Sep 2021 03:30:13 +0000 (03:30 +0000)]
Auto merge of #88978 - bjorn3:move_symbol_interner_lock, r=Mark-Simulacrum

Move the Lock into symbol::Interner

This makes it easier to make the symbol interner (near) lock free in case of concurrent accesses in the future.

With https://github.com/rust-lang/rust/pull/87867 landed this shouldn't affect performance anymore.

2 years agoAuto merge of #88965 - fee1-dead:const-drop-1, r=oli-obk
bors [Sat, 18 Sep 2021 00:18:28 +0000 (00:18 +0000)]
Auto merge of #88965 - fee1-dead:const-drop-1, r=oli-obk

Fast reject for NeedsNonConstDrop

Hopefully fixes the regression in #88558.

I've always wanted to help with the performance of rustc, but it doesn't feel the same when you are fixing a regression caused by your own PR...

r? `@oli-obk`

2 years ago./x.py test --bless
Tomasz Miąsko [Sat, 18 Sep 2021 00:00:00 +0000 (00:00 +0000)]
./x.py test --bless

2 years agoRemove support for reentrant start blocks from codegen
Tomasz Miąsko [Tue, 14 Sep 2021 00:00:00 +0000 (00:00 +0000)]
Remove support for reentrant start blocks from codegen

The start block is guaranteed not to have any basic block predecessors.

2 years agoDo not collapse goto chains beginning with the start block
Tomasz Miąsko [Wed, 15 Sep 2021 00:00:00 +0000 (00:00 +0000)]
Do not collapse goto chains beginning with the start block

If any block on a goto chain has more than one predecessor, then the new
start block would have basic block predecessors.

Skip the transformation for the start block altogether, to avoid
violating the new invariant that the start block does not have any basic
block predecessors.

2 years agoStart block is not allowed to have basic block predecessors
Tomasz Miąsko [Tue, 14 Sep 2021 00:00:00 +0000 (00:00 +0000)]
Start block is not allowed to have basic block predecessors

2 years agoAuto merge of #88962 - fee1-dead:const-drop, r=oli-obk
bors [Fri, 17 Sep 2021 21:37:01 +0000 (21:37 +0000)]
Auto merge of #88962 - fee1-dead:const-drop, r=oli-obk

inline(always) on check_recursion_limit

r? `@oli-obk`

#88558 caused a regression, this PR adds `#[inline(always)]` to `check_recursion_limit`, a possible suspect of that regression.

2 years agorefactor: VecDeques IntoIter fields to private
DeveloperC286 [Fri, 17 Sep 2021 19:48:34 +0000 (20:48 +0100)]
refactor: VecDeques IntoIter fields to private

2 years agoAuto merge of #88956 - ehuss:update-cargo, r=ehuss
bors [Fri, 17 Sep 2021 18:48:26 +0000 (18:48 +0000)]
Auto merge of #88956 - ehuss:update-cargo, r=ehuss

Update cargo

13 commits in e515c3277bf0681bfc79a9e763861bfe26bb05db..33ee5f82edb50af87b952c5b28de0f5fb41ebf18
2021-09-08 14:32:15 +0000 to 2021-09-17 13:51:54 +0000
- Update curl-sys (rust-lang/cargo#9917)
- Bump Cargo's curl requirement to 7.79.0 (rust-lang/cargo#9914)
- Revert "When a dependency does not have a version, git or path, fails directly" (rust-lang/cargo#9911)
- Add some contributor docs for debugging testsuite tests. (rust-lang/cargo#9904)
- Fix warnings when documenting with `--document-private-items` (rust-lang/cargo#9903)
- Improve "wrong output" error. (rust-lang/cargo#9905)
- Fix warnings from better precision of `dead_code` lint (rust-lang/cargo#9906)
- Bump to 0.58.0, update changelog (rust-lang/cargo#9900)
- Fix rustc --profile=dev unstable check. (rust-lang/cargo#9898)
- config.md: fix typo (rust-lang/cargo#9896)
- Enable some tests on windows. (rust-lang/cargo#9893)
- Enable strip test on macos. (rust-lang/cargo#9889)
- Fix `cargo fix --edition` on stable. (rust-lang/cargo#9890)

2 years agoUpdate cargo
Eric Huss [Wed, 15 Sep 2021 03:07:04 +0000 (20:07 -0700)]
Update cargo

2 years agomodify std::os docs to be more consistent
Sachin Cherian [Fri, 17 Sep 2021 17:53:21 +0000 (23:23 +0530)]
modify std::os docs to be more consistent

> add intra doc links
> add a usage example for the os::windows module

2 years agouse AtomicU64::fetch_update instead of handrolled RMW-loop
The8472 [Fri, 17 Sep 2021 16:42:16 +0000 (18:42 +0200)]
use AtomicU64::fetch_update instead of handrolled RMW-loop

2 years agoAuto merge of #89047 - GuillaumeGomez:rollup-29gmr02, r=GuillaumeGomez
bors [Fri, 17 Sep 2021 15:49:22 +0000 (15:49 +0000)]
Auto merge of #89047 - GuillaumeGomez:rollup-29gmr02, r=GuillaumeGomez

Rollup of 10 pull requests

Successful merges:

 - #86422 (Emit clearer diagnostics for parens around `for` loop heads)
 - #87460 (Point to closure when emitting 'cannot move out' for captured variable)
 - #87566 (Recover invalid assoc type bounds using `==`)
 - #88666 (Improve build command for compiler docs)
 - #88899 (Do not issue E0071 if a type error has already been reported)
 - #88949 (Fix handling of `hir::GenericArg::Infer` in `wrong_number_of_generic_args.rs`)
 - #88953 (Add chown functions to std::os::unix::fs to change the owner and group of files)
 - #88954 (Allow `panic!("{}", computed_str)` in const fn.)
 - #88964 (Add rustdoc version into the help popup)
 - #89012 (Suggest removing `#![feature]` for library features that have been stabilized)

Failed merges:

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

2 years agoRollup merge of #89012 - vishadGoyal:issue-88802-fix, r=jyn514
Guillaume Gomez [Fri, 17 Sep 2021 15:41:21 +0000 (17:41 +0200)]
Rollup merge of #89012 - vishadGoyal:issue-88802-fix, r=jyn514

Suggest removing `#![feature]` for library features that have been stabilized

Issue: https://github.com/rust-lang/rust/issues/88802
Delayed the check if #![feature] has been used to enable lib features in a non-nightly build to occur after TyCtxt has been constructed.

2 years agoRollup merge of #88964 - GuillaumeGomez:version-help, r=Nemo157
Guillaume Gomez [Fri, 17 Sep 2021 15:41:19 +0000 (17:41 +0200)]
Rollup merge of #88964 - GuillaumeGomez:version-help, r=Nemo157

Add rustdoc version into the help popup

After a discussion with a rustdoc user about a specific behaviour, we realized we were not talking about the same version. To add on top of it, it was actually not that simple to find out the version since it was hosted documentation.

So to simplify things, I added the version into the help popup:

![Screenshot from 2021-09-16 10-45-52](https://user-images.githubusercontent.com/3050060/133581128-b93b460a-e1cb-4a31-9f2f-97c7a916cfcc.png)

Does the version format looks or would you prefer that I add more information? We can also add the commit hash, commit date, host and release.

cc `@rust-lang/rustdoc`
r? `@jyn514`

2 years agoRollup merge of #88954 - nbdd0121:panic3, r=oli-obk
Guillaume Gomez [Fri, 17 Sep 2021 15:41:19 +0000 (17:41 +0200)]
Rollup merge of #88954 - nbdd0121:panic3, r=oli-obk

Allow `panic!("{}", computed_str)` in const fn.

Special-case `panic!("{}", arg)` and translate it to `panic_display(&arg)`. `panic_display` will behave like `panic_any` in cosnt eval and behave like `panic!(format_args!("{}", arg))` in runtime.

This should bring Rust 2015 and 2021 to feature parity in terms of `const_panic`; and hopefully would unblock the stabilisation of #51999.

`@rustbot` modify labels: +T-compiler +T-libs +A-const-eval +A-const-fn

r? `@oli-obk`

2 years agoRollup merge of #88953 - joshtriplett:chown, r=dtolnay
Guillaume Gomez [Fri, 17 Sep 2021 15:41:18 +0000 (17:41 +0200)]
Rollup merge of #88953 - joshtriplett:chown, r=dtolnay

Add chown functions to std::os::unix::fs to change the owner and group of files

This is a straightforward wrapper that uses the existing helpers for C
string handling and errno handling.

Having this available is convenient for UNIX utility programs written in
Rust, and avoids having to call unsafe functions like `libc::chown`
directly and handle errors manually, in a program that may otherwise be
entirely safe code.

In addition, these functions provide a more Rustic interface by
accepting appropriate traits and using `None` rather than `-1`.

2 years agoRollup merge of #88949 - FabianWolff:issue-87563, r=estebank
Guillaume Gomez [Fri, 17 Sep 2021 15:41:17 +0000 (17:41 +0200)]
Rollup merge of #88949 - FabianWolff:issue-87563, r=estebank

Fix handling of `hir::GenericArg::Infer` in `wrong_number_of_generic_args.rs`

Fixes #87563. More precisely, I have fixed the "index out of bounds" error, which is what #87563 is about. The example given there still ICEs due to running into this `todo!()`, but I'd say that this is a separate issue:
https://github.com/rust-lang/rust/blob/c3c0f80d6081092faff801542dd82f0e2420152b/compiler/rustc_typeck/src/astconv/mod.rs#L460-L463

2 years agoRollup merge of #88899 - FabianWolff:issue-88844, r=matthewjasper
Guillaume Gomez [Fri, 17 Sep 2021 15:41:16 +0000 (17:41 +0200)]
Rollup merge of #88899 - FabianWolff:issue-88844, r=matthewjasper

Do not issue E0071 if a type error has already been reported

Fixes #88844. A suggested fix is already included in the error message for E0412, so with my changes, E0071 is simply not emitted anymore if the type in question is a "type error". This makes sense, I think, because we cannot confidently state that something is "not a struct" if we couldn't resolve it properly; and it's unnecessary to pollute the output with this additional error message, as it is a direct consequence of the former error.

I have also addressed the issue mentioned in https://github.com/rust-lang/rust/issues/88844#issuecomment-917324856 by changing the fixed example in the documentation to more closely match the erroneous code example.

2 years agoRollup merge of #88666 - GuillaumeGomez:compiler-docs, r=Mark-Simulacrum
Guillaume Gomez [Fri, 17 Sep 2021 15:41:15 +0000 (17:41 +0200)]
Rollup merge of #88666 - GuillaumeGomez:compiler-docs, r=Mark-Simulacrum

Improve build command for compiler docs

It was rather complicated to document rustc crates. With this, you can directly run:

```console
x.py doc compiler
x.py doc compiler/rustc_hir_pretty
```

The second commit adds the handling of the `--open` flag.

r? `@Mark-Simulacrum`

2 years agoRollup merge of #87566 - JohnTitor:find-eqeq-on-assoc-type-bounds, r=estebank
Guillaume Gomez [Fri, 17 Sep 2021 15:41:14 +0000 (17:41 +0200)]
Rollup merge of #87566 - JohnTitor:find-eqeq-on-assoc-type-bounds, r=estebank

Recover invalid assoc type bounds using `==`

Fix #87493
r? `@estebank`

2 years agoRollup merge of #87460 - FabianWolff:issue-87456, r=Aaron1011
Guillaume Gomez [Fri, 17 Sep 2021 15:41:13 +0000 (17:41 +0200)]
Rollup merge of #87460 - FabianWolff:issue-87456, r=Aaron1011

Point to closure when emitting 'cannot move out' for captured variable

Attempts to fix #87456. The error message now points to the capturing closure, but I was not able to explain _why_ the closure implements `Fn` or `FnMut` (`TypeckResults::closure_kind_origins` did not contain anything for the closure in question).

cc `@Aaron1011`

2 years agoRollup merge of #86422 - JohnTitor:clearer-parens-err-for-loop, r=estebank
Guillaume Gomez [Fri, 17 Sep 2021 15:41:12 +0000 (17:41 +0200)]
Rollup merge of #86422 - JohnTitor:clearer-parens-err-for-loop, r=estebank

Emit clearer diagnostics for parens around `for` loop heads

Fixes #63113
r? `@estebank`

2 years agoAdd rustdoc version into the help popup
Guillaume Gomez [Wed, 15 Sep 2021 11:37:29 +0000 (13:37 +0200)]
Add rustdoc version into the help popup

2 years agoUpdate odht to 0.2.1
Michael Woerister [Fri, 10 Sep 2021 12:12:30 +0000 (14:12 +0200)]
Update odht to 0.2.1

2 years agoCorrectly handle "--open" option when building compiler docs
Guillaume Gomez [Sun, 5 Sep 2021 15:24:09 +0000 (17:24 +0200)]
Correctly handle "--open" option when building compiler docs

2 years agoAllow to pass "compiler" arguments to doc subcommand
Guillaume Gomez [Sun, 5 Sep 2021 15:20:37 +0000 (17:20 +0200)]
Allow to pass "compiler" arguments to doc subcommand

2 years agoAuto merge of #88945 - Aaron1011:no-projection-completion, r=wesleywiser,jackh726
bors [Fri, 17 Sep 2021 09:44:28 +0000 (09:44 +0000)]
Auto merge of #88945 - Aaron1011:no-projection-completion, r=wesleywiser,jackh726

Remove concept of 'completion' from the projection cache

Fixes #88910

When we initially store a `NormalizedTy` in the projection cache,
we discard all obligations that we can (while ensuring that we
don't cause any issues with incremental compilation).

Marking a projection cache entry as 'completed' discards all
obligations associated with it. This can only cause problems,
since any obligations stored in the cache are there for a reason
(e.g. they evaluate to `EvaluatedToOkModuloRegions`).

This commit removes `complete` and `complete_normalized` entirely.

2 years agoAuto merge of #89037 - JohnTitor:rollup-rd9btbs, r=JohnTitor
bors [Fri, 17 Sep 2021 06:47:35 +0000 (06:47 +0000)]
Auto merge of #89037 - JohnTitor:rollup-rd9btbs, r=JohnTitor

Rollup of 10 pull requests

Successful merges:

 - #86382 (Make diagnostics clearer for `?` operators)
 - #87529 (Fix ICE in `improper_ctypes_definitions` lint with all-ZST transparent types)
 - #88339 (Add TcpListener::into_incoming and IntoIncoming)
 - #88735 (Don't lint about missing code examples in derived traits)
 - #88751 (Couple of changes to FileSearch and SearchPath)
 - #88883 (Move some tests to more reasonable directories - 7)
 - #88887 (Const Deref)
 - #88911 (Improve error message for type mismatch in generator arguments)
 - #89014 (PassWrapper: handle separate Module*SanitizerPass)
 - #89033 (Set the library path in sysroot-crates-are-unstable)

Failed merges:

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

2 years agoApply review comments
Yuki Okushi [Fri, 17 Sep 2021 05:10:41 +0000 (14:10 +0900)]
Apply review comments

2 years agoRollup merge of #89033 - cuviper:sysroot-lib-path, r=Mark-Simulacrum
Yuki Okushi [Fri, 17 Sep 2021 05:09:51 +0000 (14:09 +0900)]
Rollup merge of #89033 - cuviper:sysroot-lib-path, r=Mark-Simulacrum

Set the library path in sysroot-crates-are-unstable

Most of the `run-make-fulldeps` tests use a make-driven rustc command
that includes `HOST_RPATH_DIR` in the library path, but this particular
test runs from python instead. When the toolchain is built without
`rpath` enabled, we need that library path in the environment so it can
find its own libraries.

2 years agoRollup merge of #89014 - durin42:llvm-14-module-pass-manager, r=nikic
Yuki Okushi [Fri, 17 Sep 2021 05:09:50 +0000 (14:09 +0900)]
Rollup merge of #89014 - durin42:llvm-14-module-pass-manager, r=nikic

PassWrapper: handle separate Module*SanitizerPass

Change ab41eef9aca3 in LLVM split MemorySanitizerPass into
MemorySanitizerPass for functions and ModuleMemorySanitizerPass for
modules. There's a related change for ThreadSanitizerPass, and in here
since we're using a ModulePassManager I only add the module flavor of
the pass on LLVM 14.

r? `@nikic` cc `@nagisa`

2 years agoRollup merge of #88911 - FabianWolff:issue-88653, r=petrochenkov
Yuki Okushi [Fri, 17 Sep 2021 05:09:49 +0000 (14:09 +0900)]
Rollup merge of #88911 - FabianWolff:issue-88653, r=petrochenkov

Improve error message for type mismatch in generator arguments

Fixes #88653. The code example given there is invalid because the `Generator` trait (unlike the `Fn` traits) does not take the generator arguments in tupled-up form (because there can only be one argument, from my understanding). Hence, the type error in the example in #88653 is correct, because the given generator takes a `bool` argument, whereas the function's return type talks about a generator with a `(bool,)` argument.

The error message is both confusing and wrong, though: It is wrong because it displays the wrong "expected signature", and it is confusing because both the "expected" and "found" notes point at the same span. With my changes, I get the following, more helpful output:
```
error[E0631]: type mismatch in generator arguments
 --> test.rs:5:22
  |
5 | fn foo(bar: bool) -> impl Generator<(bool,)> {
  |                      ^^^^^^^^^^^^^^^^^^^^^^^ expected signature of `fn((bool,)) -> _`
6 |     |bar| {
  |     ----- found signature of `fn(bool) -> _`
```

2 years agoRollup merge of #88887 - fee1-dead:const-deref, r=oli-obk
Yuki Okushi [Fri, 17 Sep 2021 05:09:48 +0000 (14:09 +0900)]
Rollup merge of #88887 - fee1-dead:const-deref, r=oli-obk

Const Deref

Implements `const Deref`/`const DerefMut` for `&mut T`, `&T`, `Cow<'_, B>` and `ManuallyDrop<T>`

2 years agoRollup merge of #88883 - c410-f3r:tests, r=petrochenkov
Yuki Okushi [Fri, 17 Sep 2021 05:09:48 +0000 (14:09 +0900)]
Rollup merge of #88883 - c410-f3r:tests, r=petrochenkov

Move some tests to more reasonable directories - 7

cc #73494
r? ``@petrochenkov``

2 years agoRollup merge of #88751 - bjorn3:move_filesearch, r=oli-obk
Yuki Okushi [Fri, 17 Sep 2021 05:09:47 +0000 (14:09 +0900)]
Rollup merge of #88751 - bjorn3:move_filesearch, r=oli-obk

Couple of changes to FileSearch and SearchPath

* Turn a couple of regular comments into doc comments
* Move `get_tools_search_paths` from `FileSearch` to `Session`
* Use Lrc instead of Option to avoid duplication of a `SearchPath`

2 years agoRollup merge of #88735 - hnj2:patch-1, r=GuillaumeGomez
Yuki Okushi [Fri, 17 Sep 2021 05:09:46 +0000 (14:09 +0900)]
Rollup merge of #88735 - hnj2:patch-1, r=GuillaumeGomez

Don't lint about missing code examples in derived traits

When the `missing_doc_code_examples` lint is performed it also requires that derived Trait implementations have a code example for each member etc., which causes undesirable behavior.

# Examples

With `missing_doc_code_examples` enable we are not able to use the `Clone` derive macro due to the generated code not being documented:
```rust
#[deny(rustdoc::missing_doc_code_examples)]

/// docs
/// ```
/// let s = SomeStruct;
/// ```
#[derive(Clone)]
pub struct SomeStruct;
```
yields:
```
 Documenting testt v0.1.0 (<redacted>)
error: missing code example in this documentation
 --> src/lib.rs:7:10
  |
7 | #[derive(Clone)]
  |          ^^^^^
  |
note: the lint level is defined here
 --> src/lib.rs:1:8
  |
1 | #[deny(rustdoc::missing_doc_code_examples)]
  |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: missing code example in this documentation
 --> src/lib.rs:7:10
  |
7 | #[derive(Clone)]
  |          ^^^^^

error: could not document `testt`

Caused by:
  process didn't exit successfully: `rustdoc ...
```

closes #81775

2 years agoRollup merge of #88339 - piegamesde:master, r=joshtriplett
Yuki Okushi [Fri, 17 Sep 2021 05:09:45 +0000 (14:09 +0900)]
Rollup merge of #88339 - piegamesde:master, r=joshtriplett

Add TcpListener::into_incoming and IntoIncoming

The `incoming` method is really useful, however for some use cases the borrow
this introduces is needlessly restricting. Thus, an owned variant is added.

r? ``@joshtriplett``

2 years agoRollup merge of #87529 - FabianWolff:issue-87496, r=nikomatsakis
Yuki Okushi [Fri, 17 Sep 2021 05:09:44 +0000 (14:09 +0900)]
Rollup merge of #87529 - FabianWolff:issue-87496, r=nikomatsakis

Fix ICE in `improper_ctypes_definitions` lint with all-ZST transparent types

Fixes #87496. There is also another function in the same file that looks fishy, but I haven't been able to produce an ICE there, and in any case, it's not related to #87496:
https://github.com/rust-lang/rust/blob/fd853c00e255559255885aadff9e93a1760c8728/compiler/rustc_lint/src/types.rs#L720-L734

r? ```@JohnTitor```

2 years agoRollup merge of #86382 - JohnTitor:try-desugar, r=estebank
Yuki Okushi [Fri, 17 Sep 2021 05:09:43 +0000 (14:09 +0900)]
Rollup merge of #86382 - JohnTitor:try-desugar, r=estebank

Make diagnostics clearer for `?` operators

Re-submission of #75029, fixes #71309
This also revives the `content` methods removed by #83185.
r? `@estebank`

2 years agoRecover invalid assoc type bounds using `==`
Yuki Okushi [Wed, 28 Jul 2021 20:49:56 +0000 (05:49 +0900)]
Recover invalid assoc type bounds using `==`

2 years agoUse `multipart_suggestion`
Yuki Okushi [Fri, 17 Sep 2021 04:39:26 +0000 (13:39 +0900)]
Use `multipart_suggestion`

2 years agoEmit clearer diagnostics for parens around `for` loop heads
Yuki Okushi [Fri, 18 Jun 2021 01:22:23 +0000 (10:22 +0900)]
Emit clearer diagnostics for parens around `for` loop heads

2 years agoMake diagnostics clearer for `?` operators
Yuki Okushi [Wed, 16 Jun 2021 21:35:42 +0000 (06:35 +0900)]
Make diagnostics clearer for `?` operators

2 years agoAuto merge of #88934 - tmiasko:trace-log, r=davidtwco
bors [Fri, 17 Sep 2021 03:47:23 +0000 (03:47 +0000)]
Auto merge of #88934 - tmiasko:trace-log, r=davidtwco

Avoid unnecessary formatting when trace log level is disabled

2 years agoAuto merge of #88832 - pcwalton:debug-unit-variant-fast-path, r=oli-obk
bors [Fri, 17 Sep 2021 01:00:11 +0000 (01:00 +0000)]
Auto merge of #88832 - pcwalton:debug-unit-variant-fast-path, r=oli-obk

Introduce a fast path that avoids the `debug_tuple` abstraction when deriving Debug for unit-like enum variants.

The intent here is to allow LLVM to remove the switch entirely in favor of an
indexed load from a table of constant strings, which is likely what the
programmer would write in C. Unfortunately, LLVM currently doesn't perform this
optimization due to a bug, but there is [a
patch](https://reviews.llvm.org/D109565) that fixes this issue. I've verified
that, with that patch applied on top of this commit, Debug for unit-like tuple
variants becomes a load, reducing the O(n) code bloat to O(1).

Note that inlining `DebugTuple::finish()` wasn't enough to allow LLVM to
optimize the code properly; I had to avoid the abstraction entirely. Not using
the abstraction is likely better for compile time anyway.

Part of #88793.

r? `@oli-obk`

2 years agoSet the library path in sysroot-crates-are-unstable
Josh Stone [Fri, 17 Sep 2021 00:30:36 +0000 (17:30 -0700)]
Set the library path in sysroot-crates-are-unstable

Most of the `run-make-fulldeps` tests use a make-driven rustc command
that includes `HOST_RPATH_DIR` in the library path, but this particular
test runs from python instead. When the toolchain is built without
`rpath` enabled, we need that library path in the environment so it can
find its own libraries.

2 years agoDon't lint about missing code examples in derived traits
Hans [Tue, 7 Sep 2021 23:09:15 +0000 (01:09 +0200)]
Don't lint about missing code examples in derived traits

Fixes #81775

2 years agoDon't inline OnceCell initialization closures
The8472 [Thu, 16 Sep 2021 22:24:36 +0000 (00:24 +0200)]
Don't inline OnceCell initialization closures

2 years agoAuto merge of #88719 - estebank:point-at-arg-for-obligation, r=nagisa
bors [Thu, 16 Sep 2021 22:17:33 +0000 (22:17 +0000)]
Auto merge of #88719 - estebank:point-at-arg-for-obligation, r=nagisa

Point at argument instead of call for their obligations

When an obligation is introduced by a specific `fn` argument, point at
the argument instead of the `fn` call if the obligation fails to be
fulfilled.

Move the information about pointing at the call argument expression in
an unmet obligation span from the `FulfillmentError` to a new
`ObligationCauseCode`.

When giving an error about an obligation introduced by a function call
that an argument doesn't fulfill, and that argument is a block, add a
span_label pointing at the innermost tail expression.

Current output:

```
error[E0425]: cannot find value `x` in this scope
 --> f10.rs:4:14
  |
4 |         Some(x * 2)
  |              ^ not found in this scope

error[E0277]: expected a `FnOnce<({integer},)>` closure, found `Option<_>`
 --> f10.rs:2:31
  |
2 |       let p = Some(45).and_then({
  |  ______________________--------_^
  | |                      |
  | |                      required by a bound introduced by this call
3 | |         |x| println!("doubling {}", x);
4 | |         Some(x * 2)
  | |         -----------
5 | |     });
  | |_____^ expected an `FnOnce<({integer},)>` closure, found `Option<_>`
  |
  = help: the trait `FnOnce<({integer},)>` is not implemented for `Option<_>`
```

Previous output:

```
error[E0425]: cannot find value `x` in this scope
 --> f10.rs:4:14
  |
4 |         Some(x * 2)
  |              ^ not found in this scope

error[E0277]: expected a `FnOnce<({integer},)>` closure, found `Option<_>`
 --> f10.rs:2:22
  |
2 |     let p = Some(45).and_then({
  |                      ^^^^^^^^ expected an `FnOnce<({integer},)>` closure, found `Option<_>`
  |
  = help: the trait `FnOnce<({integer},)>` is not implemented for `Option<_>`
```

Partially address #27300. Will require rebasing on top of #88546.

2 years agoPropagate coercion cause into `try_coerce`
Aaron Hill [Thu, 16 Sep 2021 21:53:40 +0000 (16:53 -0500)]
Propagate coercion cause into `try_coerce`

Currently, `coerce_inner` discards its `ObligationCause`
when calling `try_coerce`. This interfers with other
diagnostc improvements I'm working on, since we will lose
the original span by the time the actual coercion occurs.

Additionally, we now use the span of the trailing expression
(rather than the span of the entire function) when performing
a coercion in `check_return_expr`. This currently has no visible
effect on any of the unit tests, but will unblock future
diagnostic improvements.

2 years agoAuto merge of #89019 - Manishearth:rollup-5qp8a5s, r=Manishearth
bors [Thu, 16 Sep 2021 19:33:39 +0000 (19:33 +0000)]
Auto merge of #89019 - Manishearth:rollup-5qp8a5s, r=Manishearth

Rollup of 10 pull requests

Successful merges:

 - #88292 (Enable --generate-link-to-definition for rustc's docs)
 - #88729 (Recover from `Foo(a: 1, b: 2)`)
 - #88875 (cleanup(rustc_trait_selection): remove vestigial code from rustc_on_unimplemented)
 - #88892 (Move object safety suggestions to the end of the error)
 - #88928 (Document the closure arguments for `reduce`.)
 - #88976 (Clean up and add doc comments for CStr)
 - #88983 (Allow calling `get_body_with_borrowck_facts` without `-Z polonius`)
 - #88985 (Update clobber_abi list to include k[1-7] regs)
 - #88986 (Update the backtrace crate)
 - #89009 (Fix typo in `break` docs)

Failed merges:

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

2 years agoPassWrapper: these two lines shouldn't have been ifdef'd
Augie Fackler [Thu, 16 Sep 2021 19:04:18 +0000 (15:04 -0400)]
PassWrapper: these two lines shouldn't have been ifdef'd

2 years agoAdd a separate error for `dyn Trait` in `const fn`
Waffle [Thu, 16 Sep 2021 17:57:12 +0000 (20:57 +0300)]
Add a separate error for `dyn Trait` in `const fn`

Previously "trait bounds other than `Sized` on const fn parameters are unstable"
error was used for both trait bounds (<T: Trait>) and trait objects (dyn Trait).
This was pretty confusing.

This patch adds a separeta error for trait objects: "trait objects in const fn
are unstable". The error for trait bounds is otherwise intact.

2 years agodelay error for enabling unstable lib features
Vishad Goyal [Thu, 16 Sep 2021 13:58:03 +0000 (19:28 +0530)]
delay error for enabling unstable lib features

If #![feature] is used outside the nightly channel for only lib
features, the check will be delayed to the stability pass after
parsing. This is done so that appropriate help messages can be shown if
the #![feature] has been used needlessly

2 years agoRollup merge of #89009 - tatami4:master, r=Mark-Simulacrum
Manish Goregaokar [Thu, 16 Sep 2021 17:57:25 +0000 (10:57 -0700)]
Rollup merge of #89009 - tatami4:master, r=Mark-Simulacrum

Fix typo in `break` docs

2 years agoRollup merge of #88986 - hargoniX:master, r=Mark-Simulacrum
Manish Goregaokar [Thu, 16 Sep 2021 17:57:24 +0000 (10:57 -0700)]
Rollup merge of #88986 - hargoniX:master, r=Mark-Simulacrum

Update the backtrace crate

https://github.com/rust-lang/backtrace-rs/pull/437 fixed backtraces in
OpenBSD -> update it here as well so OpenBSD Rust code can produce
proper backtraces.

2 years agoRollup merge of #88985 - Commeownist:patch-1, r=Amanieu
Manish Goregaokar [Thu, 16 Sep 2021 17:57:23 +0000 (10:57 -0700)]
Rollup merge of #88985 - Commeownist:patch-1, r=Amanieu

Update clobber_abi list to include k[1-7] regs

2 years agoRollup merge of #88983 - willcrichton:allow-single-polonius-call, r=ecstatic-morse
Manish Goregaokar [Thu, 16 Sep 2021 17:57:22 +0000 (10:57 -0700)]
Rollup merge of #88983 - willcrichton:allow-single-polonius-call, r=ecstatic-morse

Allow calling `get_body_with_borrowck_facts` without `-Z polonius`

For my [static analysis tool](https://github.com/willcrichton/flowistry), I need to access the set of outlives-constraints. Recently, #86977 merged a way to access these facts via Polonius. However, the merged implementation requires `-Z polonius` to be provided to use this feature. This uses Polonius for borrow checking on the entire crate, which as described [here](https://rust-lang.zulipchat.com/#narrow/stream/186049-t-compiler.2Fwg-polonius/topic/Polonius.20performance.20in.20a.20rustc.20plugin/near/251301631), is very slow.

This PR allows `get_body_with_borrowck_facts` to be called without `-Z polonius`. This is essential for my tool to run in a sensible length of time. This is a temporary patch as the Polonius-related APIs develop -- I can update my code as future changes happen.

Additionally, this PR also makes public two APIs that were previously public but then became private after `rustc_mir` got broken up: `rustc_mir_dataflow::framework::graphviz` and `rustc_mir_transform::MirPass`. I need both of these for my analysis tool. (I can break this change into a separate PR if necessary.)

2 years agoRollup merge of #88976 - notriddle:notriddle/cow-from-cstr-docs, r=Mark-Simulacrum
Manish Goregaokar [Thu, 16 Sep 2021 17:57:21 +0000 (10:57 -0700)]
Rollup merge of #88976 - notriddle:notriddle/cow-from-cstr-docs, r=Mark-Simulacrum

Clean up and add doc comments for CStr

CC #51430

2 years agoRollup merge of #88928 - lefth:master, r=Mark-Simulacrum
Manish Goregaokar [Thu, 16 Sep 2021 17:57:20 +0000 (10:57 -0700)]
Rollup merge of #88928 - lefth:master, r=Mark-Simulacrum

Document the closure arguments for `reduce`.

See issue #88927.

2 years agoRollup merge of #88892 - estebank:trait-objects, r=petrochenkov
Manish Goregaokar [Thu, 16 Sep 2021 17:57:20 +0000 (10:57 -0700)]
Rollup merge of #88892 - estebank:trait-objects, r=petrochenkov

Move object safety suggestions to the end of the error

2 years agoRollup merge of #88875 - notriddle:notriddle/cleanup-unused-trait-selection, r=Mark...
Manish Goregaokar [Thu, 16 Sep 2021 17:57:19 +0000 (10:57 -0700)]
Rollup merge of #88875 - notriddle:notriddle/cleanup-unused-trait-selection, r=Mark-Simulacrum

cleanup(rustc_trait_selection): remove vestigial code from rustc_on_unimplemented

This isn't allowed by the validator, and seems to be unused.
When it was added in ed10a3faae1fd1176b2edf4a61438e0542c103b9,
it was used on `Sized`, and that usage is gone.

2 years agoRollup merge of #88729 - estebank:struct-literal-using-parens, r=oli-obk
Manish Goregaokar [Thu, 16 Sep 2021 17:57:18 +0000 (10:57 -0700)]
Rollup merge of #88729 - estebank:struct-literal-using-parens, r=oli-obk

Recover from `Foo(a: 1, b: 2)`

Detect likely `struct` literal using parentheses as delimiters and emit
targeted suggestion instead of type ascription parse error.

Fix #61326.

2 years agoRollup merge of #88292 - SkiFire13:enable-rustdoc-links, r=jyn514
Manish Goregaokar [Thu, 16 Sep 2021 17:57:17 +0000 (10:57 -0700)]
Rollup merge of #88292 - SkiFire13:enable-rustdoc-links, r=jyn514

Enable --generate-link-to-definition for rustc's docs

cc `@jyn514`

2 years agoAuto merge of #88979 - tmiasko:no-remove-zsts-in-generators, r=oli-obk
bors [Thu, 16 Sep 2021 16:46:02 +0000 (16:46 +0000)]
Auto merge of #88979 - tmiasko:no-remove-zsts-in-generators, r=oli-obk

Disable RemoveZsts in generators to avoid query cycles

Querying layout of a generator requires its optimized MIR. Thus
computing layout during MIR optimization of a generator might create a
query cycle. Disable RemoveZsts in generators to avoid the issue
(similar approach is used in ConstProp transform already).

Fixes #88972.

2 years agofix potential race in AtomicU64 time monotonizer
The8472 [Thu, 16 Sep 2021 16:32:28 +0000 (18:32 +0200)]
fix potential race in AtomicU64 time monotonizer

2 years agoPassWrapper: handle separate Module*SanitizerPass
Augie Fackler [Thu, 16 Sep 2021 15:45:38 +0000 (11:45 -0400)]
PassWrapper: handle separate Module*SanitizerPass

Change ab41eef9aca3 in LLVM split MemorySanitizerPass into
MemorySanitizerPass for functions and ModuleMemorySanitizerPass for
modules. There's a related change for ThreadSanitizerPass, and in here
since we're using a ModulePassManager I only add the module flavor of
the pass on LLVM 14.

r? @nikic cc @nagisa

2 years agofix rebase
Esteban Kuber [Thu, 16 Sep 2021 14:01:37 +0000 (14:01 +0000)]
fix rebase

2 years agoAuto merge of #88219 - jyn514:parallel-io, r=GuillaumeGomez
bors [Thu, 16 Sep 2021 13:47:55 +0000 (13:47 +0000)]
Auto merge of #88219 - jyn514:parallel-io, r=GuillaumeGomez

rustdoc: reduce number of copies when using parallel IO

This is Windows-only for now; I was getting really bad slowdowns from this on linux for some reason.

Helps with https://github.com/rust-lang/rust/issues/82741. Follow-up to https://github.com/rust-lang/rust/pull/60971.

2 years agoPoint at argument when evaluating `Path`'s bounds
Esteban Kuber [Tue, 14 Sep 2021 10:52:36 +0000 (10:52 +0000)]
Point at argument when evaluating `Path`'s bounds

When evaluating an `ExprKind::Call`, we first have to `check_expr` on it's
callee. When this one is a `ExprKind::Path`, we had to evaluate the bounds
introduced for its arguments, but by the time we evaluated them we no
longer had access to the argument spans. Now we special case this so
that we can point at the right place on unsatisfied bounds. This also
allows the E0277 deduplication to kick in correctly, so we now emit
fewer errors.

2 years agoFix rebase
Esteban Kuber [Sun, 12 Sep 2021 20:36:58 +0000 (20:36 +0000)]
Fix rebase

2 years agoRemove unnecessary label
Esteban Kuber [Tue, 7 Sep 2021 14:25:40 +0000 (14:25 +0000)]
Remove unnecessary label

2 years agofix rebase
Esteban Kuber [Tue, 7 Sep 2021 14:05:08 +0000 (14:05 +0000)]
fix rebase

2 years agofix `clone` call
Esteban Kuber [Tue, 7 Sep 2021 13:23:39 +0000 (13:23 +0000)]
fix `clone` call

2 years agoAccount for blocks in arguments
Esteban Kuber [Tue, 7 Sep 2021 11:57:01 +0000 (11:57 +0000)]
Account for blocks in arguments

When giving an error about an obligation introduced by a function call
that an argument doesn't fulfill, and that argument is a block, add a
span_label pointing at the innermost tail expression.