]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoRollup merge of #98805 - ChrisDenton:rel-notes, r=Dylan-DPC
Ralf Jung [Sat, 2 Jul 2022 19:21:19 +0000 (15:21 -0400)]
Rollup merge of #98805 - ChrisDenton:rel-notes, r=Dylan-DPC

Add #95469 to the release notes

#95469 may break programs using async file handles so it should've been noted in compatibility notes (sorry).

2 years agoRollup merge of #98753 - jyn514:dist-rust-dev, r=Mark-Simulacrum
Ralf Jung [Sat, 2 Jul 2022 19:21:18 +0000 (15:21 -0400)]
Rollup merge of #98753 - jyn514:dist-rust-dev, r=Mark-Simulacrum

Fix `x dist rust-dev` on a fresh checkout

Previously, it required you to manually run `x build` first, because it
assumed the LLVM binaries were already present.

2 years agoRollup merge of #98715 - matthiaskrgr:test_97047, r=Mark-Simulacrum
Ralf Jung [Sat, 2 Jul 2022 19:21:17 +0000 (15:21 -0400)]
Rollup merge of #98715 - matthiaskrgr:test_97047, r=Mark-Simulacrum

add ice test for #97047

Fixes #97047

2 years agoRollup merge of #98701 - TaKO8Ki:add-regression-test-for-50439, r=Mark-Simulacrum
Ralf Jung [Sat, 2 Jul 2022 19:21:16 +0000 (15:21 -0400)]
Rollup merge of #98701 - TaKO8Ki:add-regression-test-for-50439, r=Mark-Simulacrum

Add regression test for #50439

closes #50439

2 years agoAuto merge of #97235 - nbdd0121:unwind, r=Amanieu
bors [Sat, 2 Jul 2022 14:06:27 +0000 (14:06 +0000)]
Auto merge of #97235 - nbdd0121:unwind, r=Amanieu

Fix FFI-unwind unsoundness with mixed panic mode

UB maybe introduced when an FFI exception happens in a `C-unwind` foreign function and it propagates through a crate compiled with `-C panic=unwind` into a crate compiled with `-C panic=abort` (#96926).

To prevent this unsoundness from happening, we will disallow a crate compiled with `-C panic=unwind` to be linked into `panic-abort` *if* it contains a call to `C-unwind` foreign function or function pointer. If no such call exists, then we continue to allow such mixed panic mode linking because it's sound (and stable). In fact we still need the ability to do mixed panic mode linking for std, because we only compile std once with `-C panic=unwind` and link it regardless panic strategy.

For libraries that wish to remain compile-once-and-linkable-to-both-panic-runtimes, a `ffi_unwind_calls` lint is added (gated under `c_unwind` feature gate) to flag any FFI unwind calls that will cause the linkable panic runtime be restricted.

In summary:
```rust
#![warn(ffi_unwind_calls)]

mod foo {
    #[no_mangle]
    pub extern "C-unwind" fn foo() {}
}

extern "C-unwind" {
    fn foo();
}

fn main() {
    // Call to Rust function is fine regardless ABI.
    foo::foo();
    // Call to foreign function, will cause the crate to be unlinkable to panic-abort if compiled with `-Cpanic=unwind`.
    unsafe { foo(); }
    //~^ WARNING call to foreign function with FFI-unwind ABI
    let ptr: extern "C-unwind" fn() = foo::foo;
    // Call to function pointer, will cause the crate to be unlinkable to panic-abort if compiled with `-Cpanic=unwind`.
    ptr();
    //~^ WARNING call to function pointer with FFI-unwind ABI
}
```

Fix #96926

`@rustbot` label: T-compiler F-c_unwind

2 years agoAuto merge of #91743 - cjgillot:enable_mir_inlining_inline_all, r=oli-obk
bors [Sat, 2 Jul 2022 11:24:17 +0000 (11:24 +0000)]
Auto merge of #91743 - cjgillot:enable_mir_inlining_inline_all, r=oli-obk

Enable MIR inlining

Continuation of https://github.com/rust-lang/rust/pull/82280 by `@wesleywiser.`

#82280 has shown nice compile time wins could be obtained by enabling MIR inlining.
Most of the issues in https://github.com/rust-lang/rust/issues/81567 are now fixed,
except the interaction with polymorphization which is worked around specifically.

I believe we can proceed with enabling MIR inlining in the near future
(preferably just after beta branching, in case we discover new issues).

Steps before merging:
- [x] figure out the interaction with polymorphization;
- [x] figure out how miri should deal with extern types;
- [x] silence the extra arithmetic overflow warnings;
- [x] remove the codegen fulfilment ICE;
- [x] remove the type normalization ICEs while compiling nalgebra;
- [ ] tweak the inlining threshold.

2 years agoAuto merge of #98802 - Dylan-DPC:rollup-u6mwx27, r=Dylan-DPC
bors [Sat, 2 Jul 2022 08:39:20 +0000 (08:39 +0000)]
Auto merge of #98802 - Dylan-DPC:rollup-u6mwx27, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #98639 (Factor out `hir::Node::Binding`)
 - #98653 (Add regression test for #79494)
 - #98763 (bootstrap: illumos platform flags for split-debuginfo)
 - #98766 (cleanup mir visitor for `rustc::pass_by_value`)
 - #98783 (interpret: make a comment less scary)

Failed merges:

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

2 years agoAdd #95469 to the release notes
Chris Denton [Sat, 2 Jul 2022 07:51:27 +0000 (08:51 +0100)]
Add #95469 to the release notes

2 years agoRollup merge of #98783 - RalfJung:jumpscares, r=fee1-dead
Dylan DPC [Sat, 2 Jul 2022 06:53:42 +0000 (12:23 +0530)]
Rollup merge of #98783 - RalfJung:jumpscares, r=fee1-dead

interpret: make a comment less scary

This slipped past my review: "has no meaning" could be read as "is undefined behavior". That is certainly not what we mean so be more clear.

2 years agoRollup merge of #98766 - lcnr:mir-visit-pass_by_value, r=oli-obk
Dylan DPC [Sat, 2 Jul 2022 06:53:41 +0000 (12:23 +0530)]
Rollup merge of #98766 - lcnr:mir-visit-pass_by_value, r=oli-obk

cleanup mir visitor for `rustc::pass_by_value`

by changing `& $($mutability)?` to `$(& $mutability)?`

I also did some formatting changes because I started doing them for the visit methods I changed and then couldn't get myself to stop xx, I hope that's still fairly easy to review.

2 years agoRollup merge of #98763 - citrus-it:illumos-split-debuginfo, r=Mark-Simulacrum
Dylan DPC [Sat, 2 Jul 2022 06:53:40 +0000 (12:23 +0530)]
Rollup merge of #98763 - citrus-it:illumos-split-debuginfo, r=Mark-Simulacrum

bootstrap: illumos platform flags for split-debuginfo

Bootstrap currently provides `-Zunstable-options` for platforms
when using split debuginfo - this commit adds it for the illumos
target too.

2 years agoRollup merge of #98653 - TaKO8Ki:add-regression-test-for-79494, r=Mark-Simulacrum
Dylan DPC [Sat, 2 Jul 2022 06:53:39 +0000 (12:23 +0530)]
Rollup merge of #98653 - TaKO8Ki:add-regression-test-for-79494, r=Mark-Simulacrum

Add regression test for #79494

closes #79494

2 years agoRollup merge of #98639 - camsteffen:no-node-binding, r=compiler-errors
Dylan DPC [Sat, 2 Jul 2022 06:53:38 +0000 (12:23 +0530)]
Rollup merge of #98639 - camsteffen:no-node-binding, r=compiler-errors

Factor out `hir::Node::Binding`

2 years agoAuto merge of #98791 - cuviper:rogue-binary, r=compiler-errors
bors [Sat, 2 Jul 2022 05:56:23 +0000 (05:56 +0000)]
Auto merge of #98791 - cuviper:rogue-binary, r=compiler-errors

Remove the rogue ./suggest-blanket-impl-local-trait

This executable was added in #97488, presumably just a `git add` mistake.

2 years agoRemove the rogue ./suggest-blanket-impl-local-trait
Josh Stone [Sat, 2 Jul 2022 00:22:22 +0000 (17:22 -0700)]
Remove the rogue ./suggest-blanket-impl-local-trait

2 years agoAuto merge of #98781 - GuillaumeGomez:rollup-798kb8u, r=GuillaumeGomez
bors [Fri, 1 Jul 2022 22:55:22 +0000 (22:55 +0000)]
Auto merge of #98781 - GuillaumeGomez:rollup-798kb8u, r=GuillaumeGomez

Rollup of 5 pull requests

Successful merges:

 - #97249 (`<details>`/`<summary>` UI fixes)
 - #98418 (Allow macOS to build LLVM as shared library)
 - #98460 (Use CSS variables to handle theming)
 - #98497 (Improve some inference diagnostics)
 - #98708 (rustdoc: fix 98690 Panic if invalid path for -Z persist-doctests)

Failed merges:

 - #98761 (more `need_type_info` improvements)

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

2 years agointerpret: make a comment less scary
Ralf Jung [Fri, 1 Jul 2022 21:57:32 +0000 (17:57 -0400)]
interpret: make a comment less scary

2 years agoRollup merge of #98708 - pinkforest:rustdoc-fix-98690, r=GuillaumeGomez
Guillaume Gomez [Fri, 1 Jul 2022 21:39:10 +0000 (23:39 +0200)]
Rollup merge of #98708 - pinkforest:rustdoc-fix-98690, r=GuillaumeGomez

rustdoc: fix 98690 Panic if invalid path for -Z persist-doctests

Closes #98690 for rustdoc panic

I changed this to do eprintln and orderly panic instead of unwrap doing unhandled panic

~/gg/rust/build/x86_64-unknown-linux-gnu/stage2/bin/rustdoc --test -Z unstable-options --persist-doctests /tmp/foobar main.rs
Couldn't create directory for doctest executables: Permission denied (os error 13)

2 years agoRollup merge of #98497 - compiler-errors:span-inference-note, r=lcnr
Guillaume Gomez [Fri, 1 Jul 2022 21:39:09 +0000 (23:39 +0200)]
Rollup merge of #98497 - compiler-errors:span-inference-note, r=lcnr

Improve some inference diagnostics

- Properly point out point location where "type must be known at this point", or else omit the note if it's not associated with a useful span.
- Fix up some type ambiguity diagnostics, errors shouldn't say "cannot infer type for reference `&'a ()`" when the given type has no inference variables.

2 years agoRollup merge of #98460 - GuillaumeGomez:css-simplification, r=jsha
Guillaume Gomez [Fri, 1 Jul 2022 21:39:08 +0000 (23:39 +0200)]
Rollup merge of #98460 - GuillaumeGomez:css-simplification, r=jsha

Use CSS variables to handle theming

This is the start for our simplification of theming. Considering how big the diff quickly becomes, I think it's better to do it in multiple parts.

(The 3 first commits come from https://github.com/rust-lang/rust/pull/98297 so once it's merged, they'll disappear).

Normally they shouldn't be any UI changes. You can check it [here](https://rustdoc.crud.net/imperio/css-simplification/doc/foo/index.html).

cc `@notriddle`
r? `@jsha`

2 years agoRollup merge of #98418 - topjohnwu:macos-dylib, r=jyn514
Guillaume Gomez [Fri, 1 Jul 2022 21:39:07 +0000 (23:39 +0200)]
Rollup merge of #98418 - topjohnwu:macos-dylib, r=jyn514

Allow macOS to build LLVM as shared library

Inspired by how [homebrew](https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/llvm.rb) builds and distributes llvm, here we manually create a symlink with a versioned dylib path to make `llvm-config` work properly. Note, the resulting `rustc` executable and `librustc_driver-<hash>.dylib` still links to the un-versioned `libLLVM.dylib` as expected when distributed in the final output. I have confirmed this by checking `otool -L` on both binaries.

After the change, enabling `llvm.link-shared` and `llvm.thin-lto` will be possible on macOS.

2 years agoRollup merge of #97249 - GuillaumeGomez:details-summary-fixes, r=notriddle
Guillaume Gomez [Fri, 1 Jul 2022 21:39:07 +0000 (23:39 +0200)]
Rollup merge of #97249 - GuillaumeGomez:details-summary-fixes, r=notriddle

`<details>`/`<summary>` UI fixes

With images it's easier to understand:

![Screenshot from 2022-05-21 14-10-42](https://user-images.githubusercontent.com/3050060/169653038-9c58de67-589a-4986-a8ff-dbdddaf136a4.png)
![Screenshot from 2022-05-21 14-08-49](https://user-images.githubusercontent.com/3050060/169653042-56e87258-13fe-4f80-9858-4e15c318c3fb.png)

The headings in `<summary>` should not have bottom border so I removed it as well alongside the other fixes.

r? `@jsha`

2 years agoAuto merge of #93967 - cjgillot:short-struct-span, r=petrochenkov
bors [Fri, 1 Jul 2022 20:14:34 +0000 (20:14 +0000)]
Auto merge of #93967 - cjgillot:short-struct-span, r=petrochenkov

Shorten def_span for more items.

The `def_span` query only returns the signature span for functions.
Struct/enum/union definitions can also have a very long body.
This PR shortens the associated span.

2 years agoMove Sized check before first error is created
Michael Goulet [Fri, 1 Jul 2022 01:30:48 +0000 (01:30 +0000)]
Move Sized check before first error is created

2 years agoDon't point at Self type if we can't find an infer variable in ambiguous trait predicate
Michael Goulet [Sat, 25 Jun 2022 17:42:23 +0000 (10:42 -0700)]
Don't point at Self type if we can't find an infer variable in ambiguous trait predicate

2 years agoShow source of ambiguity in a few more places
Michael Goulet [Sat, 25 Jun 2022 16:28:27 +0000 (09:28 -0700)]
Show source of ambiguity in a few more places

2 years agoOnly label place where type is needed if span is meaningful
Michael Goulet [Sat, 25 Jun 2022 16:18:25 +0000 (09:18 -0700)]
Only label place where type is needed if span is meaningful

2 years agoAuto merge of #98767 - Dylan-DPC:rollup-j1gq5sr, r=Dylan-DPC
bors [Fri, 1 Jul 2022 17:33:42 +0000 (17:33 +0000)]
Auto merge of #98767 - Dylan-DPC:rollup-j1gq5sr, r=Dylan-DPC

Rollup of 6 pull requests

Successful merges:

 - #97488 (Suggest blanket impl to the local traits)
 - #98585 (Make `ThinBox<T>` covariant in `T`)
 - #98644 (fix ICE with -Wrust-2021-incompatible-closure-captures)
 - #98739 (fix grammar in useless doc comment lint)
 - #98741 (Many small deriving cleanups)
 - #98756 (Use const instead of function and make it private)

Failed merges:

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

2 years agoAmend codegen test.
Camille GILLOT [Sun, 29 May 2022 17:44:58 +0000 (19:44 +0200)]
Amend codegen test.

2 years agoBless recursion test.
Camille GILLOT [Wed, 25 May 2022 18:11:07 +0000 (20:11 +0200)]
Bless recursion test.

2 years agoIgnore test with panic=abort.
Camille GILLOT [Tue, 17 May 2022 18:41:58 +0000 (20:41 +0200)]
Ignore test with panic=abort.

2 years agoShorten def_span for more items.
Camille GILLOT [Sun, 13 Feb 2022 15:27:59 +0000 (16:27 +0100)]
Shorten def_span for more items.

2 years agoFactor out hir::Node::Binding
Cameron Steffen [Tue, 28 Jun 2022 18:15:30 +0000 (13:15 -0500)]
Factor out hir::Node::Binding

2 years agoRollup merge of #98756 - TaKO8Ki:use-const-instead-of-function, r=Dylan-DPC
Dylan DPC [Fri, 1 Jul 2022 14:49:21 +0000 (20:19 +0530)]
Rollup merge of #98756 - TaKO8Ki:use-const-instead-of-function, r=Dylan-DPC

Use const instead of function and make it private

2 years agoRollup merge of #98741 - nnethercote:deriving-cleanups, r=Mark-Simulacrum
Dylan DPC [Fri, 1 Jul 2022 14:49:20 +0000 (20:19 +0530)]
Rollup merge of #98741 - nnethercote:deriving-cleanups, r=Mark-Simulacrum

Many small deriving cleanups

These commits remove lots of little unnecessary things, and clarifies other things.

r? `@Mark-Simulacrum`

2 years agoRollup merge of #98739 - euclio:useless-comment-plural, r=Dylan-DPC
Dylan DPC [Fri, 1 Jul 2022 14:49:19 +0000 (20:19 +0530)]
Rollup merge of #98739 - euclio:useless-comment-plural, r=Dylan-DPC

fix grammar in useless doc comment lint

2 years agoRollup merge of #98644 - matthiaskrgr:drp_loc_span_err__2021_inc_clos_cap, r=lcnr
Dylan DPC [Fri, 1 Jul 2022 14:49:18 +0000 (20:19 +0530)]
Rollup merge of #98644 - matthiaskrgr:drp_loc_span_err__2021_inc_clos_cap, r=lcnr

fix ICE with -Wrust-2021-incompatible-closure-captures

Fixes #93117
Fixes #96258

2 years agoRollup merge of #98585 - cuviper:covariant-thinbox, r=thomcc
Dylan DPC [Fri, 1 Jul 2022 14:49:17 +0000 (20:19 +0530)]
Rollup merge of #98585 - cuviper:covariant-thinbox, r=thomcc

Make `ThinBox<T>` covariant in `T`

Just like `Box<T>`, we want `ThinBox<T>` to be covariant in `T`, but the
projection in `WithHeader<<T as Pointee>::Metadata>` was making it
invariant. This is now hidden as `WithOpaqueHeader`, which we type-cast
whenever the real `WithHeader<H>` type is needed.

Fixes the problem noted in <https://github.com/rust-lang/rust/issues/92791#issuecomment-1104636249>.

2 years agoRollup merge of #97488 - vincenzopalazzo:macros/blanket_sugg, r=compiler-errors
Dylan DPC [Fri, 1 Jul 2022 14:49:16 +0000 (20:19 +0530)]
Rollup merge of #97488 - vincenzopalazzo:macros/blanket_sugg, r=compiler-errors

Suggest blanket impl to the local traits

This PR will add additional suggestion regarding the blanket implementation when it is possible, by generation a new help message + suggestion.

Closes https://github.com/rust-lang/rust/issues/96076

Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2 years agoAuto merge of #98402 - cjgillot:undead, r=michaelwoerister
bors [Fri, 1 Jul 2022 14:43:15 +0000 (14:43 +0000)]
Auto merge of #98402 - cjgillot:undead, r=michaelwoerister

Rewrite dead-code pass to avoid fetching HIR.

This allows to get a more uniform handling of spans, and to simplify the grouping of diagnostics for variants and fields.

2 years agocleanup mir visitor for `rustc::pass_by_value`
lcnr [Fri, 1 Jul 2022 14:21:21 +0000 (16:21 +0200)]
cleanup mir visitor for `rustc::pass_by_value`

2 years agobootstrap: illumos platform flags for split-debuginfo
Andy Fiddaman [Fri, 1 Jul 2022 13:21:18 +0000 (13:21 +0000)]
bootstrap: illumos platform flags for split-debuginfo
Bootstrap currently provides `-Zunstable-options` for platforms
when using split debuginfo - this commit adds it for the illumos
target too.

2 years agoAuto merge of #98730 - matthiaskrgr:rollup-2c4d4x5, r=matthiaskrgr
bors [Fri, 1 Jul 2022 11:09:35 +0000 (11:09 +0000)]
Auto merge of #98730 - matthiaskrgr:rollup-2c4d4x5, r=matthiaskrgr

Rollup of 10 pull requests

Successful merges:

 - #97629 ([core] add `Exclusive` to sync)
 - #98503 (fix data race in thread::scope)
 - #98670 (llvm-wrapper: adapt for LLVMConstExtractValue removal)
 - #98671 (Fix source sidebar bugs)
 - #98677 (For diagnostic information of Boolean, remind it as use the type: 'bool')
 - #98684 (add test for 72793)
 - #98688 (interpret: add From<&MplaceTy> for PlaceTy)
 - #98695 (use "or pattern")
 - #98709 (Remove unneeded methods declaration for old web browsers)
 - #98717 (get rid of tidy 'unnecessarily ignored' warnings)

Failed merges:

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

2 years agoAuto merge of #98752 - matthiaskrgr:rollup-uwimznc, r=matthiaskrgr
bors [Fri, 1 Jul 2022 08:19:29 +0000 (08:19 +0000)]
Auto merge of #98752 - matthiaskrgr:rollup-uwimznc, r=matthiaskrgr

Rollup of 9 pull requests

Successful merges:

 - #98610 (fix `emit_inference_failure_err` ICE)
 - #98640 (Let rust-analyzer ship on stable, non-preview)
 - #98686 (add ice test for 46511)
 - #98727 (rustdoc: filter '_ lifetimes from ty::PolyTraitRef)
 - #98729 (clarify that ExactSizeIterator::len returns the remaining length)
 - #98733 (Request to be notified of MIR changes)
 - #98734 (Update RELEASES.md)
 - #98745 (Add a `--build-dir` flag to rustbuild)
 - #98749 (Add macro_rules! rustdoc change to 1.62 relnotes)

Failed merges:

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

2 years agouse const instead of function and make it private
Takayuki Maeda [Fri, 1 Jul 2022 07:55:23 +0000 (16:55 +0900)]
use const instead of function and make it private

2 years agoChange `Ty::Tuple` to `Ty::Unit`.
Nicholas Nethercote [Thu, 30 Jun 2022 00:22:41 +0000 (10:22 +1000)]
Change `Ty::Tuple` to `Ty::Unit`.

Because that's all that is needed in practice.

2 years agoRename `Ty::Literal` as `Ty::Path`.
Nicholas Nethercote [Thu, 30 Jun 2022 00:20:19 +0000 (10:20 +1000)]
Rename `Ty::Literal` as `Ty::Path`.

Because a `Literal` is a type of expression, and is simply the wrong
name for this.

2 years agoRemove lifetime support in deriving code.
Nicholas Nethercote [Thu, 30 Jun 2022 00:16:34 +0000 (10:16 +1000)]
Remove lifetime support in deriving code.

It's unused.

2 years agoSimplify pointer handling.
Nicholas Nethercote [Wed, 29 Jun 2022 23:15:07 +0000 (09:15 +1000)]
Simplify pointer handling.

The existing derive code allows for various possibilities that aren't
needed in practice, which complicates the code. There are only a few
auto-derived traits and new ones are unlikely, so this commit simplifies
things.

- `PtrTy` has been eliminated. The `Raw` variant was never used, and the
  lifetime for the `Borrowed` variant was always `None`. That left just
  the mutability field, which has been inlined as necessary.
- `MethodDef::explicit_self` was a confusing `Option<Option<PtrTy>>`.
  Indicating either `&self` or nothing. It's now a `bool`.
- `borrowed_self` is renamed as `self_ref`.
- `Ty::Ptr` is renamed to `Ty::Ref`.

2 years ago`expand_deriving_clone` tweaks.
Nicholas Nethercote [Tue, 28 Jun 2022 05:23:16 +0000 (15:23 +1000)]
`expand_deriving_clone` tweaks.

Improve a comment, and panic on an impossible code path.

2 years agoRollup merge of #98749 - CAD97:patch-3, r=jyn514
Matthias Krüger [Fri, 1 Jul 2022 04:06:00 +0000 (06:06 +0200)]
Rollup merge of #98749 - CAD97:patch-3, r=jyn514

Add macro_rules! rustdoc change to 1.62 relnotes

#96630 was tagged <kbd>relnotes</kbd> but didn't make it into the notes. Given this is a compatibility issue (https://github.com/rust-lang/rust/issues/97030, https://github.com/rust-lang/rust/issues/98735, https://github.com/rust-lang/rust/issues/98743), it probably *should* be retroactively added.

2 years agoRollup merge of #98745 - thomcc:build-dir-arg, r=jyn514
Matthias Krüger [Fri, 1 Jul 2022 04:05:59 +0000 (06:05 +0200)]
Rollup merge of #98745 - thomcc:build-dir-arg, r=jyn514

Add a `--build-dir` flag to rustbuild

This adds an optional `--build-dir <path>` flag to rustbuild (to both the python and rust code in src/bootstrap). If provided, it overrides build directory from the config file (if any was provided).

My reason for wanting this is that I often will make a change, save, and then go run `x.py check` or `x.py test` (or something). Because I've saved, vscode will start doing its thing in the background, but this will take the file lock, preventing `x.py` from running until vscode finishes whatever it's doing (since the manually invoked x.py won't be able to acquire said file lock). This is annoying, because I'd rather the command I explicitly invoke *not* wait for r-a to complete, as r-a's check is conceptually a background task (and one which can take quite some time to complete).

Anyway, while there are likely other ways this could be handled, if you have the disk space an easy way is to just have vscode be configured to use a different build directory, and then they never have to block each-other.

This can currently be arranged without this patch, by maintaining two `config.toml`s, one of which has a different build dir, and just exists to be passed into the overridden check command in vscode.

Unfortunately, this has the downside of requiring I maintain two `config.toml`s and keep them (at least somewhat) in sync, aside from the build dir. I dislike for several reasons, not the least of which because I know myself well enough to know that these will inevitably get out of sync and confuse me in the future (perhaps this case would be different since I've thought about it enough to write this patch? Who knows, I'd rather not find out).

Either way, it would be much easier for me to have a way for *only* the build directory to differ, which this patch provides by way of a new flag.  I suggested this to `@jyn514` who indicated it sounded reasonable so long as it didn't add too much complexity, which I think I've achieved, but he can be the judge.

Anyway, with this patch I can just use something like `["python3", "x.py", "check", "--build-dir", "build-vscode", "--json-output"]` as the overridden check command to rust-analyzer, and do not need to futz with any additional `config.toml`s. Which is very nice!

I've tested this manually, and can confirm that it works. I'm not sure if it needs automated tests, or where I should add them if so.

r? `@jyn514` (who has had to put up with my complaints about this... many times. <3)

2 years agoRollup merge of #98734 - tmiasko:uninhabited-calls-release-notes, r=Mark-Simulacrum
Matthias Krüger [Fri, 1 Jul 2022 04:05:58 +0000 (06:05 +0200)]
Rollup merge of #98734 - tmiasko:uninhabited-calls-release-notes, r=Mark-Simulacrum

Update RELEASES.md

Clarify that flow sensitive checks now understand that *visibly*
uninhabited call expressions never return.

The change influences checks of reachable and unreachable code alike,
not just dead code like previous wording would imply.

cc ``@Kixunil``

2 years agoRollup merge of #98733 - celinval:patch-1, r=Mark-Simulacrum
Matthias Krüger [Fri, 1 Jul 2022 04:05:57 +0000 (06:05 +0200)]
Rollup merge of #98733 - celinval:patch-1, r=Mark-Simulacrum

Request to be notified of MIR changes

Adding myself (celinval) to be notified of PRs that changes the MIR.

2 years agoRollup merge of #98729 - the8472:exactsize-docs, r=thomcc
Matthias Krüger [Fri, 1 Jul 2022 04:05:56 +0000 (06:05 +0200)]
Rollup merge of #98729 - the8472:exactsize-docs, r=thomcc

clarify that ExactSizeIterator::len returns the remaining length

fixes #98721

2 years agoRollup merge of #98727 - notriddle:notriddle/issue-98697, r=GuillaumeGomez
Matthias Krüger [Fri, 1 Jul 2022 04:05:55 +0000 (06:05 +0200)]
Rollup merge of #98727 - notriddle:notriddle/issue-98697, r=GuillaumeGomez

rustdoc: filter '_ lifetimes from ty::PolyTraitRef

Fixes #98697

2 years agoRollup merge of #98686 - matthiaskrgr:test-46511, r=compiler-errors
Matthias Krüger [Fri, 1 Jul 2022 04:05:54 +0000 (06:05 +0200)]
Rollup merge of #98686 - matthiaskrgr:test-46511, r=compiler-errors

add ice test for 46511

Fixes #46511

r? ``@compiler-errors``

2 years agoRollup merge of #98640 - cuviper:stable-rust-analyzer, r=Mark-Simulacrum
Matthias Krüger [Fri, 1 Jul 2022 04:05:53 +0000 (06:05 +0200)]
Rollup merge of #98640 - cuviper:stable-rust-analyzer, r=Mark-Simulacrum

Let rust-analyzer ship on stable, non-preview

The consensus on rust-lang/rust-analyzer#12432 seems to be that we are ready for `rust-analyzer` to ship as a rustup component on the beta and stable channels. This won't always be the preferred distribution method, e.g. the VS Code extension will probably still independently update to its weekly releases, but it's still useful to have a component that follows the release train with the rest of the Rust toolchain. So this removes the nightly-only gating on the bundled component, and removes the "-preview" suffix as well by the usual renaming mechanism.

cc ``@rust-lang/wg-rls-2`` ``@rust-lang/release``

2 years agoRollup merge of #98610 - lcnr:emit_inference_failure_err-ice, r=estebank
Matthias Krüger [Fri, 1 Jul 2022 04:05:52 +0000 (06:05 +0200)]
Rollup merge of #98610 - lcnr:emit_inference_failure_err-ice, r=estebank

fix `emit_inference_failure_err` ICE

fixes #98598

this fix doesn't make me too happy, but :shrug:

2 years agoFix `x dist rust-dev` on a fresh checkout
Joshua Nelson [Fri, 1 Jul 2022 04:05:45 +0000 (23:05 -0500)]
Fix `x dist rust-dev` on a fresh checkout

Previously, it required you to manually run `x build` first, because it
assumed the LLVM binaries were already present.

2 years agoAdd macro_rules! rustdoc change to 1.62 relnotes
Christopher Durham [Fri, 1 Jul 2022 02:18:43 +0000 (22:18 -0400)]
Add macro_rules! rustdoc change to 1.62 relnotes

2 years agoAuto merge of #98706 - flip1995:clippyup, r=Dylan-DPC
bors [Fri, 1 Jul 2022 01:30:37 +0000 (01:30 +0000)]
Auto merge of #98706 - flip1995:clippyup, r=Dylan-DPC

Update Clippy

r? `@Manishearth`

2 years agoAdd a `--build-dir` flag to rustbuild
Thom Chiovoloni [Thu, 30 Jun 2022 22:50:48 +0000 (15:50 -0700)]
Add a `--build-dir` flag to rustbuild

2 years agoRemove some commented-out code.
Nicholas Nethercote [Tue, 28 Jun 2022 05:09:37 +0000 (15:09 +1000)]
Remove some commented-out code.

This was accidentally left behind in a previous commit.

2 years agoRemove some unnecessary `pub`s.
Nicholas Nethercote [Tue, 28 Jun 2022 02:16:12 +0000 (12:16 +1000)]
Remove some unnecessary `pub`s.

2 years agoRemove `Substructure::self_args`.
Nicholas Nethercote [Tue, 28 Jun 2022 01:56:03 +0000 (11:56 +1000)]
Remove `Substructure::self_args`.

It's unused.

2 years agoRemove `{Method,Trait}Def::is_unsafe`.
Nicholas Nethercote [Tue, 28 Jun 2022 01:44:37 +0000 (11:44 +1000)]
Remove `{Method,Trait}Def::is_unsafe`.

They are always `false`.

2 years agofix grammar in useless doc comment lint
Andy Russell [Thu, 30 Jun 2022 20:17:38 +0000 (16:17 -0400)]
fix grammar in useless doc comment lint

2 years agoRemove `Substructure::method_ident`.
Nicholas Nethercote [Tue, 28 Jun 2022 01:37:44 +0000 (11:37 +1000)]
Remove `Substructure::method_ident`.

It's unused.

2 years agoRemove unnecessary fields from `EnumNonMatchingCollapsed`.
Nicholas Nethercote [Mon, 27 Jun 2022 22:56:54 +0000 (08:56 +1000)]
Remove unnecessary fields from `EnumNonMatchingCollapsed`.

The `&[ast::Variant]` field isn't used.

The `Vec<Ident>` field is only used for its length, but that's always
the same as the length of the `&[Ident]` and so isn't necessary.

2 years agoUse `split_{first,last}` in `cs_fold1`.
Nicholas Nethercote [Tue, 28 Jun 2022 02:58:36 +0000 (12:58 +1000)]
Use `split_{first,last}` in `cs_fold1`.

It makes the code a little nicer to read.

2 years agoSpecialize a few tests depending on opt-level.
Camille GILLOT [Tue, 17 May 2022 14:18:40 +0000 (16:18 +0200)]
Specialize a few tests depending on opt-level.

2 years agoAllow inlining `#[inline]` functions.
Camille GILLOT [Mon, 13 Dec 2021 17:03:22 +0000 (18:03 +0100)]
Allow inlining `#[inline]` functions.

2 years agoTest enabling MIR inliner
Wesley Wiser [Fri, 1 Oct 2021 02:03:49 +0000 (22:03 -0400)]
Test enabling MIR inliner

2 years agoDo not error on the param_env during inlining.
Camille GILLOT [Fri, 6 May 2022 19:37:14 +0000 (21:37 +0200)]
Do not error on the param_env during inlining.

This created unexpected diagnostics while compiling alga:
    cannot satisfy `<Self as Module>::Ring == _`

Turns out that we don't need this diagnostic as we disable inlining when
it would trigger an ICE.

2 years agoSkip inlining if there are normalization issues.
Camille GILLOT [Sat, 30 Apr 2022 16:10:33 +0000 (18:10 +0200)]
Skip inlining if there are normalization issues.

2 years agoRecover when failing to normalize closure signature.
Camille GILLOT [Fri, 4 Feb 2022 22:18:28 +0000 (23:18 +0100)]
Recover when failing to normalize closure signature.

2 years agoDo not ICE when failing to resolve.
Camille GILLOT [Fri, 4 Feb 2022 17:53:06 +0000 (18:53 +0100)]
Do not ICE when failing to resolve.

2 years agoCheck history earlier.
Camille GILLOT [Mon, 13 Dec 2021 12:46:30 +0000 (13:46 +0100)]
Check history earlier.

2 years agoDon't assert polymorphization has taken effect in const eval
Wesley Wiser [Fri, 1 Oct 2021 01:58:49 +0000 (21:58 -0400)]
Don't assert polymorphization has taken effect in const eval

Const eval no longer runs MIR optimizations so unless this is getting
run as part of a MIR optimization like const-prop, there can be unused
type parameters even if polymorphization is enabled.

2 years agorustdoc: fix 98690
pinkforest [Thu, 30 Jun 2022 10:31:02 +0000 (20:31 +1000)]
rustdoc: fix 98690

2 years agoui: improve suggestion test by addig the help message
Vincenzo Palazzo [Wed, 29 Jun 2022 23:31:10 +0000 (23:31 +0000)]
ui: improve suggestion test by addig the help message

Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2 years agoRequest to be notified of MIR changes
Celina G. Val [Thu, 30 Jun 2022 18:18:56 +0000 (11:18 -0700)]
Request to be notified of MIR changes

Adding myself (celinval) to be notified of PRs that changes the MIR.

2 years agoRollup merge of #98717 - RalfJung:make-tidy-less-annoying, r=jyn514
Matthias Krüger [Thu, 30 Jun 2022 17:55:57 +0000 (19:55 +0200)]
Rollup merge of #98717 - RalfJung:make-tidy-less-annoying, r=jyn514

get rid of tidy 'unnecessarily ignored' warnings

I think these warnings are quite pointless: when I say `allow(foo)` in my code, that doesn't necessarily mean that I expect `foo` to happen -- it just means that I am okay with `foo` happening.

For example, having to add and remove `ignore-tidy-linelength` as the longest line in the file keeps growing and shrinking is just annoying and doesn't benefit anyone, IMO. This usually incurs *two* CI roundtrips: first CI tells you that line lengths in your test file are ignored unnecessarily, so you go and remove that attribute; then CI tells you that now your line numbers changed, so you re-bless your tests (often takes >5min if parts of rustc need rebuilding because `./x.py fmt` changed something somewhere). That's just a lot of wasted effort and time and patience.

2 years agoRollup merge of #98709 - GuillaumeGomez:rm-decl-for-old-browsers, r=Dylan-DPC
Matthias Krüger [Thu, 30 Jun 2022 17:55:56 +0000 (19:55 +0200)]
Rollup merge of #98709 - GuillaumeGomez:rm-decl-for-old-browsers, r=Dylan-DPC

Remove unneeded methods declaration for old web browsers

All these methods were not defined for IE mostly. But since we don't support it anymore, no need to keep them around.

cc ```@jsha```
r? ```@notriddle```

2 years agoRollup merge of #98695 - tshepang:or-pattern, r=compiler-errors
Matthias Krüger [Thu, 30 Jun 2022 17:55:55 +0000 (19:55 +0200)]
Rollup merge of #98695 - tshepang:or-pattern, r=compiler-errors

use "or pattern"

2 years agoRollup merge of #98688 - RalfJung:from-mplace, r=oli-obk
Matthias Krüger [Thu, 30 Jun 2022 17:55:54 +0000 (19:55 +0200)]
Rollup merge of #98688 - RalfJung:from-mplace, r=oli-obk

interpret: add From<&MplaceTy> for PlaceTy

We have a similar instance for `&MPlaceTy` to `OpTy`. Also add the same for `&mut`.

This avoids having to write `&(*place).into()`, which we have a few times here and at least twice in Miri (and it comes up again in my current patch).

r? ```@oli-obk```

2 years agoRollup merge of #98684 - matthiaskrgr:ice-test-72793, r=oli-obk
Matthias Krüger [Thu, 30 Jun 2022 17:55:54 +0000 (19:55 +0200)]
Rollup merge of #98684 - matthiaskrgr:ice-test-72793, r=oli-obk

add test for 72793

Fixes #72793

r? ````@oli-obk````

2 years agoRollup merge of #98677 - lyming2007:issue-98492-fix, r=lcnr
Matthias Krüger [Thu, 30 Jun 2022 17:55:53 +0000 (19:55 +0200)]
Rollup merge of #98677 - lyming2007:issue-98492-fix, r=lcnr

For diagnostic information of Boolean, remind it as use the type: 'bool'

Fixes #98492.

It helps programmers coming from other languages
modified:   compiler/rustc_resolve/src/late/diagnostics.rs

2 years agoRollup merge of #98671 - GuillaumeGomez:source-sidebar-fixes, r=notriddle
Matthias Krüger [Thu, 30 Jun 2022 17:55:52 +0000 (19:55 +0200)]
Rollup merge of #98671 - GuillaumeGomez:source-sidebar-fixes, r=notriddle

Fix source sidebar bugs

This PR fixes the following two bugs:

![Screenshot from 2022-06-29 14-39-58](https://user-images.githubusercontent.com/3050060/176449070-3e3762da-2bfe-4acf-8eb0-34f6eb4c94ed.png)
![Screenshot from 2022-06-29 15-05-09](https://user-images.githubusercontent.com/3050060/176449073-b164820b-bd71-4b1a-990c-bba4e5fce196.png)

I added regression tests to prevent them to happen again.

I think we should backport it to beta as well.

You can test it [here](https://rustdoc.crud.net/imperio/source-sidebar-fixes/src/std/lib.rs.html).

cc ```@jsha```
r? ```@notriddle```

2 years agoRollup merge of #98670 - krasimirgg:llvm-15-LLVMConstExtractValue, r=nikic
Matthias Krüger [Thu, 30 Jun 2022 17:55:52 +0000 (19:55 +0200)]
Rollup merge of #98670 - krasimirgg:llvm-15-LLVMConstExtractValue, r=nikic

llvm-wrapper: adapt for LLVMConstExtractValue removal

`LLVMConstExtractValue` was removed recently from LLVM: https://github.com/llvm/llvm-project/commit/5548e807b5777fdda167b6795e0e05432a6163f1.

This adapts llvm-wrapper to use the new alternative where available, following https://rust-lang.zulipchat.com/#narrow/stream/187780-t-compiler.2Fwg-llvm/topic/LLVMConstExtractValue.20removal.

2 years agoRollup merge of #98503 - RalfJung:scope-race, r=m-ou-se
Matthias Krüger [Thu, 30 Jun 2022 17:55:51 +0000 (19:55 +0200)]
Rollup merge of #98503 - RalfJung:scope-race, r=m-ou-se

fix data race in thread::scope

Puts the `ScopeData` into an `Arc` so it sticks around as long as we need it.
This means one extra `Arc::clone` per spawned scoped thread, which I hope is fine.

Fixes https://github.com/rust-lang/rust/issues/98498
r? `````@m-ou-se`````

2 years agoRollup merge of #97629 - guswynn:exclusive_struct, r=m-ou-se
Matthias Krüger [Thu, 30 Jun 2022 17:55:50 +0000 (19:55 +0200)]
Rollup merge of #97629 - guswynn:exclusive_struct, r=m-ou-se

[core] add `Exclusive` to sync

(discussed here: https://rust-lang.zulipchat.com/#narrow/stream/219381-t-libs/topic/Adding.20.60SyncWrapper.60.20to.20std)

`Exclusive` is a wrapper that exclusively allows mutable access to the inner value if you have exclusive access to the wrapper. It acts like a compile time mutex, and hold an unconditional `Sync` implementation.

## Justification for inclusion into std
- This wrapper unblocks actual problems:
  - The example that I hit was a vector of `futures::future::BoxFuture`'s causing a central struct in a script to be non-`Sync`. To work around it, you either write really difficult code, or wrap the futures in a needless mutex.
- Easy to maintain: this struct is as simple as a wrapper can get, and its `Sync` implementation has very clear reasoning
- Fills a gap: `&/&mut` are to `RwLock` as `Exclusive` is to `Mutex`

## Public Api
```rust
// core::sync
#[derive(Default)]
struct Exclusive<T: ?Sized> { ... }

impl<T: ?Sized> Sync for Exclusive {}

impl<T> Exclusive<T> {
    pub const fn new(t: T) -> Self;
    pub const fn into_inner(self) -> T;
}

impl<T: ?Sized> Exclusive<T> {
    pub const fn get_mut(&mut self) -> &mut T;
    pub const fn get_pin_mut(Pin<&mut self>) -> Pin<&mut T>;
    pub const fn from_mut(&mut T) -> &mut Exclusive<T>;
    pub const fn from_pin_mut(Pin<&mut T>) -> Pin<&mut Exclusive<T>>;
}

impl<T: Future> Future for Exclusive { ... }

impl<T> From<T> for Exclusive<T> { ... }
impl<T: ?Sized> Debug for Exclusive { ... }
```

## Naming
This is a big bikeshed, but I felt that `Exclusive` captured its general purpose quite well.

## Stability and location
As this is so simple, it can be in `core`. I feel that it can be stabilized quite soon after it is merged, if the libs teams feels its reasonable to add. Also, I don't really know how unstable feature work in std/core's codebases, so I might need help fixing them

## Tips for review
The docs probably are the thing that needs to be reviewed! I tried my best, but I'm sure people have more experience than me writing docs for `Core`

### Implementation:
The API is mostly pulled from https://docs.rs/sync_wrapper/latest/sync_wrapper/struct.SyncWrapper.html (which is apache 2.0 licenesed), and the implementation is trivial:
- its an unsafe justification for pinning
- its an unsafe justification for the `Sync` impl (mostly reasoned about by ````@danielhenrymantilla```` here: https://github.com/Actyx/sync_wrapper/pull/2)
- and forwarding impls, starting with derivable ones and `Future`

2 years agoclarify that ExactSizeIterator::len returns the remaining length
The 8472 [Thu, 30 Jun 2022 17:45:36 +0000 (19:45 +0200)]
clarify that ExactSizeIterator::len returns the remaining length

2 years agorustdoc: filter '_ lifetimes from ty::PolyTraitRef
Michael Howell [Thu, 30 Jun 2022 17:35:50 +0000 (10:35 -0700)]
rustdoc: filter '_ lifetimes from ty::PolyTraitRef

Fixes #98697

2 years agoFlip RustAnalyzer to stable=true
Josh Stone [Thu, 30 Jun 2022 17:07:48 +0000 (10:07 -0700)]
Flip RustAnalyzer to stable=true

2 years agoFor diagnostic information of Boolean, remind it as use the type: 'bool'
Yiming Lei [Wed, 29 Jun 2022 16:09:34 +0000 (09:09 -0700)]
For diagnostic information of Boolean, remind it as use the type: 'bool'
It helps programmers coming from other languages
modified:   compiler/rustc_resolve/src/late/diagnostics.rs

modified:   src/test/ui/lint/recommend-literal.rs
modified:   src/test/ui/lint/recommend-literal.stderr

modified:   compiler/rustc_resolve/src/late/diagnostics.rs
modified:   src/test/ui/lint/recommend-literal.rs
modified:   src/test/ui/lint/recommend-literal.stderr

modified:   compiler/rustc_resolve/src/late/diagnostics.rs
modified:   src/test/ui/lint/recommend-literal.rs
modified:   src/test/ui/lint/recommend-literal.stderr

2 years agoget rid of some tidy 'unnecessarily ignored' warnings
Ralf Jung [Thu, 30 Jun 2022 15:23:51 +0000 (11:23 -0400)]
get rid of some tidy 'unnecessarily ignored' warnings

2 years agoadd ice test for #97047
Matthias Krüger [Thu, 30 Jun 2022 14:42:39 +0000 (16:42 +0200)]
add ice test for #97047

Fixes #97047

2 years agoAdd test to ensure that scroll position is kept when opening/closing source sidebar
Guillaume Gomez [Wed, 29 Jun 2022 21:21:46 +0000 (23:21 +0200)]
Add test to ensure that scroll position is kept when opening/closing source sidebar