Commit Graph

171571 Commits

Author SHA1 Message Date
Ralf Jung
65944ce522 interpret: make a comment less scary 2022-07-01 17:57:32 -04:00
Guillaume Gomez
00d68a7890
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)
2022-07-01 23:39:10 +02:00
Guillaume Gomez
b0935b1ddf
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.
2022-07-01 23:39:09 +02:00
Guillaume Gomez
bda659e873
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`
2022-07-01 23:39:08 +02:00
Guillaume Gomez
01aa10c2ff
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.
2022-07-01 23:39:07 +02:00
Guillaume Gomez
194764fdc0
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`
2022-07-01 23:39:07 +02:00
bors
46b8c23f3e 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.
2022-07-01 20:14:34 +00:00
Michael Howell
1f621fba2d rustdoc cleanup: remove unused function 2022-07-01 13:03:05 -07:00
Michael Howell
2852443f48 rustdoc: use <details> tag for the source code sidebar
This fixes the extremely poor accessibility of the old system, making it
possible to navigate the sidebar by keyboard, and also implicitly gives the
sidebar items the correct ARIA roles.
2022-07-01 12:01:36 -07:00
Michael Goulet
6711313f76 Move Sized check before first error is created 2022-07-01 17:38:34 +00:00
Michael Goulet
12ab6bfafd Don't point at Self type if we can't find an infer variable in ambiguous trait predicate 2022-07-01 17:38:34 +00:00
Michael Goulet
ca0105ba4e Show source of ambiguity in a few more places 2022-07-01 17:38:34 +00:00
Michael Goulet
f44ae98cee Only label place where type is needed if span is meaningful 2022-07-01 17:38:34 +00:00
bors
5018181c79 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
2022-07-01 17:33:42 +00:00
Camille GILLOT
cbbf06b0cd Amend codegen test. 2022-07-01 17:45:13 +02:00
Camille GILLOT
a3e1a2b7ce Bless recursion test. 2022-07-01 17:45:13 +02:00
Camille GILLOT
2f35392383 Ignore test with panic=abort. 2022-07-01 17:45:13 +02:00
Camille GILLOT
42e4eee893 Shorten def_span for more items. 2022-07-01 17:39:19 +02:00
Cameron Steffen
ec82bc1996 Factor out hir::Node::Binding 2022-07-01 10:04:19 -05:00
Dylan DPC
6404620f18
Rollup merge of #98756 - TaKO8Ki:use-const-instead-of-function, r=Dylan-DPC
Use const instead of function and make it private
2022-07-01 20:19:21 +05:30
Dylan DPC
c0cf363ca1
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`
2022-07-01 20:19:20 +05:30
Dylan DPC
528202fec2
Rollup merge of #98739 - euclio:useless-comment-plural, r=Dylan-DPC
fix grammar in useless doc comment lint
2022-07-01 20:19:19 +05:30
Dylan DPC
90b296d770
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
2022-07-01 20:19:18 +05:30
Dylan DPC
9dd3288557
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>.
2022-07-01 20:19:17 +05:30
Dylan DPC
e2ed8d7ed1
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>
2022-07-01 20:19:16 +05:30
bors
5b9775fe17 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.
2022-07-01 14:43:15 +00:00
lcnr
cf9c0a5935 cleanup mir visitor for rustc::pass_by_value 2022-07-01 16:21:21 +02:00
Pietro Albini
6b2d3d5f3c
update cfg(bootstrap)s 2022-07-01 15:48:23 +02:00
Andy Fiddaman
5122bb5572 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.
2022-07-01 13:21:18 +00:00
bors
ca1e68b322 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
2022-07-01 11:09:35 +00:00
bors
7e2733bb1d 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
2022-07-01 08:19:29 +00:00
Takayuki Maeda
f791ac6a79 use const instead of function and make it private 2022-07-01 16:55:23 +09:00
Nicholas Nethercote
85e8d94e05 Change Ty::Tuple to Ty::Unit.
Because that's all that is needed in practice.
2022-07-01 15:19:49 +10:00
Nicholas Nethercote
00307a5b6f Rename Ty::Literal as Ty::Path.
Because a `Literal` is a type of expression, and is simply the wrong
name for this.
2022-07-01 15:19:46 +10:00
Nicholas Nethercote
18fef6bbd7 Remove lifetime support in deriving code.
It's unused.
2022-07-01 15:16:17 +10:00
Nicholas Nethercote
b94246693a 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`.
2022-07-01 15:16:17 +10:00
Nicholas Nethercote
78ec19ffe6 expand_deriving_clone tweaks.
Improve a comment, and panic on an impossible code path.
2022-07-01 15:16:15 +10:00
Matthias Krüger
18d4228456
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.
2022-07-01 06:06:00 +02:00
Matthias Krüger
335e7d3e33
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)
2022-07-01 06:05:59 +02:00
Matthias Krüger
c4acd06a57
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``
2022-07-01 06:05:58 +02:00
Matthias Krüger
80dd48b73f
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.
2022-07-01 06:05:57 +02:00
Matthias Krüger
734f21c9e2
Rollup merge of #98729 - the8472:exactsize-docs, r=thomcc
clarify that ExactSizeIterator::len returns the remaining length

fixes #98721
2022-07-01 06:05:56 +02:00
Matthias Krüger
e59693a046
Rollup merge of #98727 - notriddle:notriddle/issue-98697, r=GuillaumeGomez
rustdoc: filter '_ lifetimes from ty::PolyTraitRef

Fixes #98697
2022-07-01 06:05:55 +02:00
Matthias Krüger
0420231989
Rollup merge of #98686 - matthiaskrgr:test-46511, r=compiler-errors
add ice test for 46511

Fixes #46511

r? ``@compiler-errors``
2022-07-01 06:05:54 +02:00
Matthias Krüger
41e79910aa
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``
2022-07-01 06:05:53 +02:00
Matthias Krüger
0d5636ce88
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 🤷
2022-07-01 06:05:52 +02:00
Joshua Nelson
cec6933d0d 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.
2022-06-30 23:05:45 -05:00
Christopher Durham
4ea18ccf7e Add macro_rules! rustdoc change to 1.62 relnotes 2022-06-30 23:48:11 -04:00
bors
acdcdfb61b Auto merge of #98706 - flip1995:clippyup, r=Dylan-DPC
Update Clippy

r? `@Manishearth`
2022-07-01 01:30:37 +00:00
Thom Chiovoloni
79f8dc0b89
Add a --build-dir flag to rustbuild 2022-06-30 15:50:48 -07:00