]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoAuto merge of #96302 - Serial-ATA:more-diagnostic-items, r=manishearth
bors [Sun, 8 May 2022 19:08:34 +0000 (19:08 +0000)]
Auto merge of #96302 - Serial-ATA:more-diagnostic-items, r=manishearth

Add more diagnostic items

This just adds a handful diagnostic items I noticed were missing.

Would it be worth doing this for all of the remaining types? I'm willing to do it if it'd be helpful.

2 years agoAuto merge of #93675 - name1e5s:fix/strip_prefix_panic, r=Mark-Simulacrum
bors [Sun, 8 May 2022 16:51:00 +0000 (16:51 +0000)]
Auto merge of #93675 - name1e5s:fix/strip_prefix_panic, r=Mark-Simulacrum

fix panic in Path::strip_prefix

close #93586

2 years agofix panic in Path::strip_prefix
name1e5s [Sat, 19 Mar 2022 14:05:56 +0000 (22:05 +0800)]
fix panic in Path::strip_prefix

2 years agoAuto merge of #96770 - flip1995:fix-trait-type-in-bounds, r=cjgillot
bors [Sun, 8 May 2022 14:10:12 +0000 (14:10 +0000)]
Auto merge of #96770 - flip1995:fix-trait-type-in-bounds, r=cjgillot

Track if a where bound comes from a impl Trait desugar

With https://github.com/rust-lang/rust/pull/93803 `impl Trait` function arguments get desugared to hidden where bounds. However, Clippy needs to know if a bound was originally a `impl Trait` or an actual bound. This adds a field to the `WhereBoundPredicate` struct to keep track of this information during AST->HIR lowering.

r? `@cjgillot`

cc `@estebank` (as the reviewer of #93803)

2 years agoAuto merge of #96689 - gimbles:campfire, r=Mark-Simulacrum
bors [Sun, 8 May 2022 11:14:47 +0000 (11:14 +0000)]
Auto merge of #96689 - gimbles:campfire, r=Mark-Simulacrum

Move check-bootstrap from a makefile rule to test::Bootstrap

Fixes #96688

2 years agoAuto merge of #96659 - thatzopoulos:issue-90679-fix, r=Mark-Simulacrum
bors [Sun, 8 May 2022 08:45:20 +0000 (08:45 +0000)]
Auto merge of #96659 - thatzopoulos:issue-90679-fix, r=Mark-Simulacrum

Improve error for missing cmake

This PR updates the error message for a missing `cmake` to be more in line with the error message for a missing installation of `ninja`.
The original issue, (#90679), suggests that both `ninja` and `cmake` are only needed for building LLVM, so I have included the suggestion from `ninja` to set `download-ci-llvm = true` if the user would rather download LLVM. If `cmake` actually is used in other areas, I can remove that part of the message.

Fixes: #90679
2 years agoAuto merge of #96457 - yungkneez:fix-bootstrap, r=Mark-Simulacrum
bors [Sun, 8 May 2022 06:22:21 +0000 (06:22 +0000)]
Auto merge of #96457 - yungkneez:fix-bootstrap, r=Mark-Simulacrum

Initialize rust-analyzer submodule on bootstrap

Fixes #96456

2 years agoAuto merge of #96155 - jackh726:param-heuristics-followup, r=estebank
bors [Sun, 8 May 2022 04:05:36 +0000 (04:05 +0000)]
Auto merge of #96155 - jackh726:param-heuristics-followup, r=estebank

Followups for method call error change

Each commit is self-contained. Fixes most of the followup reviews from that PR.

r? `@estebank`

2 years agoAuto merge of #94206 - PrestonFrom:significant_drop, r=flip1995
bors [Sun, 8 May 2022 00:57:08 +0000 (00:57 +0000)]
Auto merge of #94206 - PrestonFrom:significant_drop, r=flip1995

Create clippy lint against unexpectedly late drop for temporaries in match scrutinee expressions

A new clippy lint for issue 93883 (https://github.com/rust-lang/rust/issues/93883). Relies on a new trait in `marker` (called `SignificantDrop` to enable linting), which is why this PR is for the rust-lang repo and not the clippy repo.

changelog: new lint [`significant_drop_in_scrutinee`]

2 years agoAuto merge of #96824 - matthiaskrgr:rollup-silw3ki, r=matthiaskrgr
bors [Sat, 7 May 2022 22:41:39 +0000 (22:41 +0000)]
Auto merge of #96824 - matthiaskrgr:rollup-silw3ki, r=matthiaskrgr

Rollup of 10 pull requests

Successful merges:

 - #96336 (Link to correct `as_mut` in docs for `pointer::as_ref`)
 - #96586 (Add aliases for std::fs::canonicalize)
 - #96667 (Add regression test)
 - #96671 (Remove hard links from `env::current_exe` security example)
 - #96726 (Add regression and bug tests)
 - #96756 (Enable compiler-docs by default for `compiler`, `codegen`, and `tools` profiles)
 - #96757 (Don't constantly rebuild clippy on `x test src/tools/clippy`.)
 - #96769 (Remove `adx_target_feature` feature from active features list)
 - #96777 (Make the test `check-pass` not to produce a JSON file)
 - #96822 (Enforce quote rule for JS source code)

Failed merges:

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

2 years agoupdated error message for missing cmake
Thomas Hatzopoulos [Mon, 2 May 2022 01:49:45 +0000 (20:49 -0500)]
updated error message for missing cmake

2 years agoRollup merge of #96822 - GuillaumeGomez:js-quote-rule, r=notriddle
Matthias Krüger [Sat, 7 May 2022 20:44:44 +0000 (22:44 +0200)]
Rollup merge of #96822 - GuillaumeGomez:js-quote-rule, r=notriddle

Enforce quote rule for JS source code

We mostly used double quotes but still had a weird mix. This eslint rule will now enforce it.

r? `@notriddle`

2 years agoRollup merge of #96777 - JohnTitor:do-not-run-pass-save-analysis, r=Mark-Simulacrum
Matthias Krüger [Sat, 7 May 2022 20:44:43 +0000 (22:44 +0200)]
Rollup merge of #96777 - JohnTitor:do-not-run-pass-save-analysis, r=Mark-Simulacrum

Make the test `check-pass` not to produce a JSON file

`run-pass` produces a JSON file when enabling save analysis.
The original ICE happened on `cargo check`, moreover **without** the `generic_const_exprs` feature, so `check-pass` should be enough.

2 years agoRollup merge of #96769 - Undin:remove-adx_target_feature-from-active, r=joshtriplett
Matthias Krüger [Sat, 7 May 2022 20:44:42 +0000 (22:44 +0200)]
Rollup merge of #96769 - Undin:remove-adx_target_feature-from-active, r=joshtriplett

Remove `adx_target_feature` feature from active features list

The feature was stabilized in https://github.com/rust-lang/rust/pull/93745

2 years agoRollup merge of #96757 - jyn514:fewer-clippy-rebuilds, r=Mark-Simulacrum
Matthias Krüger [Sat, 7 May 2022 20:44:42 +0000 (22:44 +0200)]
Rollup merge of #96757 - jyn514:fewer-clippy-rebuilds, r=Mark-Simulacrum

Don't constantly rebuild clippy on `x test src/tools/clippy`.

This happened because the `SYSROOT` variable was set for `x test`, but not `x build`.
Set it consistently for both to avoid unnecessary rebuilds.

This is a very small step towards https://github.com/rust-lang/rust/issues/76495.

2 years agoRollup merge of #96756 - jyn514:compiler-docs-default, r=Mark-Simulacrum
Matthias Krüger [Sat, 7 May 2022 20:44:41 +0000 (22:44 +0200)]
Rollup merge of #96756 - jyn514:compiler-docs-default, r=Mark-Simulacrum

Enable compiler-docs by default for `compiler`, `codegen`, and `tools` profiles

I had this overridden locally for a while and realized just now it should probably just be a default.

2 years agoRollup merge of #96726 - oli-obk:no_cross_inference, r=Mark-Simulacrum
Matthias Krüger [Sat, 7 May 2022 20:44:40 +0000 (22:44 +0200)]
Rollup merge of #96726 - oli-obk:no_cross_inference, r=Mark-Simulacrum

Add regression and bug tests

this tracks the behaviour from https://github.com/rust-lang/rust/issues/96572 in our test suite

2 years agoRollup merge of #96671 - mgeisler:current-exe-docstring, r=Mark-Simulacrum
Matthias Krüger [Sat, 7 May 2022 20:44:39 +0000 (22:44 +0200)]
Rollup merge of #96671 - mgeisler:current-exe-docstring, r=Mark-Simulacrum

Remove hard links from `env::current_exe` security example

The security example shows that `env::current_exe` will return the path used when the program was started. This is not really surprising considering how hard links work: after `ln foo bar`, the two files are _equivalent_. It is _not_ the case that `bar` is a “link” to `foo`, nor is `foo` a link to `bar`. They are simply two names for the same underlying data.

The security vulnerability linked to seems to be different: there an attacker would start a SUID binary from a directory under the control of the attacker. The binary would respawn itself by executing the program found at `/proc/self/exe` (which the attacker can control). This is a real problem. In my opinion, the example given here doesn’t really show the same problem, it just shows a misunderstanding of what hard links are.

I looked through the history a bit and found that the example was introduced in https://github.com/rust-lang/rust/pull/33526. That PR actually has two commits, and the first (https://github.com/rust-lang/rust/commit/8478d48dad949b3b1374569a5391089a49094eeb) explains the race condition at the root of the linked security vulnerability. The second commit proceeds to replace the explanation with the example we have today.

This commit reverts most of the second commit from https://github.com/rust-lang/rust/pull/33526.

2 years agoRollup merge of #96667 - oli-obk:collect_hidden_types, r=Mark-Simulacrum
Matthias Krüger [Sat, 7 May 2022 20:44:38 +0000 (22:44 +0200)]
Rollup merge of #96667 - oli-obk:collect_hidden_types, r=Mark-Simulacrum

Add regression test

fixes #69785

This issue seems to have been fixed in the meantime.

2 years agoRollup merge of #96586 - ear7h:master, r=joshtriplett
Matthias Krüger [Sat, 7 May 2022 20:44:37 +0000 (22:44 +0200)]
Rollup merge of #96586 - ear7h:master, r=joshtriplett

Add aliases for std::fs::canonicalize

The aliases are `realpath` and `GetFinalPathNameByHandle` which are explicitly mentioned in `canonicalize`'s documentation.

2 years agoRollup merge of #96336 - Nilstrieb:link-to-correct-as_mut-in-ptr-as_ref, r=JohnTitor
Matthias Krüger [Sat, 7 May 2022 20:44:36 +0000 (22:44 +0200)]
Rollup merge of #96336 - Nilstrieb:link-to-correct-as_mut-in-ptr-as_ref, r=JohnTitor

Link to correct `as_mut` in docs for `pointer::as_ref`

It previously linked to the unstable const-mut-cast method instead of
the `mut` counterpart for `as_ref`.

Closes #96327

2 years agoAuto merge of #96670 - Urgau:bootstrap-check-cfg-features, r=Mark-Simulacrum
bors [Sat, 7 May 2022 20:17:33 +0000 (20:17 +0000)]
Auto merge of #96670 - Urgau:bootstrap-check-cfg-features, r=Mark-Simulacrum

Enable cfg checking of cargo features for everything but std

This PR enable `cfg` checking of cargo features for everything but std, it also adds a `FIXME` to myself.

> Note: `std`, `alloc` and `core` imports some dependencies by #[path] (like
> backtrace, core_simd, std_float, ...), those dependencies have their own features
> but cargo isn't involved in the #[path] and so cannot pass the complete list of
> features, so for that reason we don't enable checking of features for std.

r? `@Mark-Simulacrum`

2 years agoEnforce quote rule for JS source code
Guillaume Gomez [Sat, 7 May 2022 18:18:23 +0000 (20:18 +0200)]
Enforce quote rule for JS source code

2 years agoAuto merge of #96657 - cuviper:time64, r=joshtriplett
bors [Sat, 7 May 2022 17:53:59 +0000 (17:53 +0000)]
Auto merge of #96657 - cuviper:time64, r=joshtriplett

Use 64-bit time on 32-bit linux-gnu

The standard library suffered the [Year 2038 problem][Y2038] in two main places on targets with 32-bit `time_t`:

- In `std::time::SystemTime`, we stored a `timespec` that has `time_t` seconds. This is now changed to directly store 64-bit seconds and nanoseconds, and on 32-bit linux-gnu we try to use `__clock_gettime64` (glibc 2.34+) to get the larger timestamp.

- In `std::fs::Metadata`, we store a `stat64`, which has 64-bit `off_t` but still 32-bit `time_t`, and unfortunately that is baked in the API by the (deprecated) `MetadataExt::as_raw_stat()`. However, we can use `statx` for 64-bit `statx_timestamp` to store in addition to the `stat64`, as we already do to support creation time, and the rest of the `MetadataExt` methods can return those full values. Note that some filesystems may still be limited in their actual timestamp support, but that's not something Rust can change.

There remain a few places that need `timespec` for system call timeouts -- I leave that to future work.

[Y2038]: https://en.wikipedia.org/wiki/Year_2038_problem

2 years agoTrack if a where bound comes from a impl Trait desugar
flip1995 [Thu, 5 May 2022 14:50:11 +0000 (15:50 +0100)]
Track if a where bound comes from a impl Trait desugar

With #93803 `impl Trait` function arguments get desugared to hidden
where bounds. However, Clippy needs to know if a bound was originally a
impl Trait or an actual bound. This adds a field to the
`WhereBoundPredicate` struct to keep track of this information during
HIR lowering.

2 years agoAuto merge of #96816 - GuillaumeGomez:rollup-oumn95i, r=GuillaumeGomez
bors [Sat, 7 May 2022 13:31:04 +0000 (13:31 +0000)]
Auto merge of #96816 - GuillaumeGomez:rollup-oumn95i, r=GuillaumeGomez

Rollup of 7 pull requests

Successful merges:

 - #96581 (make Size and Align debug-printing a bit more compact)
 - #96636 (Fix jump to def regression)
 - #96760 (diagnostics: port more diagnostics to derive + add support for `Vec` fields)
 - #96788 (Improve validator around field projections and checked bin ops)
 - #96805 (Change eslint rules from configuration comments to configuration file)
 - #96807 (update Miri)
 - #96811 (Fix a minor typo in the description of Formatter)

Failed merges:

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

2 years agoRollup merge of #96811 - createyourpersonalaccount:doc-typofix, r=JohnTitor
Guillaume Gomez [Sat, 7 May 2022 13:23:50 +0000 (15:23 +0200)]
Rollup merge of #96811 - createyourpersonalaccount:doc-typofix, r=JohnTitor

Fix a minor typo in the description of Formatter

2 years agoRollup merge of #96807 - RalfJung:miri, r=RalfJung
Guillaume Gomez [Sat, 7 May 2022 13:23:49 +0000 (15:23 +0200)]
Rollup merge of #96807 - RalfJung:miri, r=RalfJung

update Miri

Fixes https://github.com/rust-lang/rust/issues/96773
r? ``@ghost``

2 years agoRollup merge of #96805 - Folyd:eslint, r=GuillaumeGomez
Guillaume Gomez [Sat, 7 May 2022 13:23:48 +0000 (15:23 +0200)]
Rollup merge of #96805 - Folyd:eslint, r=GuillaumeGomez

Change eslint rules from configuration comments to configuration file

Repeatedly declaring eslint rules in source files is an annoying thing, we should move those rules into the eslint configuration file.

r? ``@GuillaumeGomez``

2 years agoRollup merge of #96788 - JakobDegen:checked-binop, r=oli-obk
Guillaume Gomez [Sat, 7 May 2022 13:23:47 +0000 (15:23 +0200)]
Rollup merge of #96788 - JakobDegen:checked-binop, r=oli-obk

Improve validator around field projections and checked bin ops

The two commits are unrelated. In both cases, these rules were already documented in MIR docs.

2 years agoRollup merge of #96760 - davidtwco:diagnostic-translation-vec, r=oli-obk
Guillaume Gomez [Sat, 7 May 2022 13:23:46 +0000 (15:23 +0200)]
Rollup merge of #96760 - davidtwco:diagnostic-translation-vec, r=oli-obk

diagnostics: port more diagnostics to derive + add support for `Vec` fields

- Port "unconstrained opaque type" diagnostic to using the derive.
- Allow `Vec` fields in diagnostic derive - enables support for diagnostics that have multiple primary spans, or have subdiagnostics repeated at multiple locations. `Vec<..>` fields in the diagnostic derive become loops in the generated code.
- Add `create_{err,warning}` - there wasn't a way to create a diagnostic from a struct and not emit it straight away.
- Port "explicit generic args w/ impl trait" diagnostic to using the derive.

r? `````@oli-obk`````
cc `````@pvdrz`````

2 years agoRollup merge of #96636 - GuillaumeGomez:fix-jump-to-def-regression, r=notriddle
Guillaume Gomez [Sat, 7 May 2022 13:23:45 +0000 (15:23 +0200)]
Rollup merge of #96636 - GuillaumeGomez:fix-jump-to-def-regression, r=notriddle

Fix jump to def regression

https://github.com/rust-lang/rust/pull/93803 introduced a regression in the "jump to def" feature. This fixes it.

Nice side-effect: it adds a new regression test. :)

I also used this opportunity to add documentation about this unstable feature in the rustdoc book.

cc ``@cjgillot``
r? ``@notriddle``

2 years agoRollup merge of #96581 - RalfJung:debug-size-align, r=oli-obk
Guillaume Gomez [Sat, 7 May 2022 13:23:44 +0000 (15:23 +0200)]
Rollup merge of #96581 - RalfJung:debug-size-align, r=oli-obk

make Size and Align debug-printing a bit more compact

In particular in `{:#?}`-mode, these take up a lot of space, so I think this is the better alternative (even though it is a bit longer in `{:?}` mode, I think it is still more readable).

We could make it even smaller by deviating further from what the actual code looks like, e.g. via something like `Size(4 bytes)`. Not sure what people would think about that?

Cc `````@oli-obk`````

2 years agoFix a minor typo in the description of Formatter
Nikolaos Chatzikonstantinou [Sat, 7 May 2022 10:32:54 +0000 (19:32 +0900)]
Fix a minor typo in the description of Formatter

2 years agoAuto merge of #96780 - Kobzol:ci-llvm-upgrade-osx-windows, r=Mark-Simulacrum
bors [Sat, 7 May 2022 09:11:12 +0000 (09:11 +0000)]
Auto merge of #96780 - Kobzol:ci-llvm-upgrade-osx-windows, r=Mark-Simulacrum

Update LLVM version used to build OS X and Windows artifacts to 14.0.2

Let's see what breaks.

r? `@Mark-Simulacrum`

2 years agoupdate Miri
Ralf Jung [Sat, 7 May 2022 08:14:16 +0000 (10:14 +0200)]
update Miri

2 years agoAuto merge of #96094 - Elliot-Roberts:fix_doctests, r=compiler-errors
bors [Sat, 7 May 2022 06:30:29 +0000 (06:30 +0000)]
Auto merge of #96094 - Elliot-Roberts:fix_doctests, r=compiler-errors

Begin fixing all the broken doctests in `compiler/`

Begins to fix #95994.
All of them pass now but 24 of them I've marked with `ignore HELP (<explanation>)` (asking for help) as I'm unsure how to get them to work / if we should leave them as they are.
There are also a few that I marked `ignore` that could maybe be made to work but seem less important.
Each `ignore` has a rough "reason" for ignoring after it parentheses, with

- `(pseudo-rust)` meaning "mostly rust-like but contains foreign syntax"
- `(illustrative)` a somewhat catchall for either a fragment of rust that doesn't stand on its own (like a lone type), or abbreviated rust with ellipses and undeclared types that would get too cluttered if made compile-worthy.
- `(not-rust)` stuff that isn't rust but benefits from the syntax highlighting, like MIR.
- `(internal)` uses `rustc_*` code which would be difficult to make work with the testing setup.

Those reason notes are a bit inconsistently applied and messy though. If that's important I can go through them again and try a more principled approach. When I run `rg '```ignore \(' .` on the repo, there look to be lots of different conventions other people have used for this sort of thing. I could try unifying them all if that would be helpful.

I'm not sure if there was a better existing way to do this but I wrote my own script to help me run all the doctests and wade through the output. If that would be useful to anyone else, I put it here: https://github.com/Elliot-Roberts/rust_doctest_fixing_tool

2 years agoAuto merge of #96804 - compiler-errors:rollup-1mc6aw3, r=compiler-errors
bors [Sat, 7 May 2022 04:15:52 +0000 (04:15 +0000)]
Auto merge of #96804 - compiler-errors:rollup-1mc6aw3, r=compiler-errors

Rollup of 8 pull requests

Successful merges:

 - #96660 ([bootstrap] Give a better error when trying to run a path with no registered step)
 - #96701 (update `jemallocator` example to use 2018 edition import syntax)
 - #96746 (Fix an ICE on #96738)
 - #96758 (bootstrap: bsd platform flags for split debuginfo)
 - #96778 (Remove closures on `expect_local` to apply `#[track_caller]`)
 - #96781 (Fix an incorrect link in The Unstable Book)
 - #96783 (Link to correct issue in issue-95034 known-bug)
 - #96801 (Add regression test for #96319)

Failed merges:

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

2 years agoRollup merge of #96801 - Aaron1011:coinductive-cycle-test, r=compiler-errors
Michael Goulet [Sat, 7 May 2022 03:49:37 +0000 (20:49 -0700)]
Rollup merge of #96801 - Aaron1011:coinductive-cycle-test, r=compiler-errors

Add regression test for #96319

2 years agoRollup merge of #96783 - aliemjay:typo-issue-95034, r=compiler-errors
Michael Goulet [Sat, 7 May 2022 03:49:36 +0000 (20:49 -0700)]
Rollup merge of #96783 - aliemjay:typo-issue-95034, r=compiler-errors

Link to correct issue in issue-95034 known-bug

fix a typo is issue number: 94034 -> 95034

2 years agoRollup merge of #96781 - koic:fix_an_incorrect_link_in_the_unstable_book, r=ehuss
Michael Goulet [Sat, 7 May 2022 03:49:35 +0000 (20:49 -0700)]
Rollup merge of #96781 - koic:fix_an_incorrect_link_in_the_unstable_book, r=ehuss

Fix an incorrect link in The Unstable Book

https://github.com/rust-lang/rust/blob/master/src/librustc_session/lint/builtin.rs returns page not found.

The following is the background of the move.
First https://github.com/rust-lang/rust/pull/74862 moves from src/librustc_session/lint/builtin.rs to compiler/rustc_session/src/lint/builtin.rs.
Then https://github.com/rust-lang/rust/commit/23018a5 moves from compiler/rustc_session/src/lint/builtin.rs to compiler/rustc_lint_defs/src/builtin.rs.

So, the current correct link is https://github.com/rust-lang/rust/blob/master/compiler/rustc_lint_defs/src/builtin.rs.

This PR fixes a broken link on the following page:
https://doc.rust-lang.org/beta/unstable-book/language-features/plugin.html

2 years agoRollup merge of #96778 - JohnTitor:expect-local-track-caller-take-2, r=petrochenkov
Michael Goulet [Sat, 7 May 2022 03:49:35 +0000 (20:49 -0700)]
Rollup merge of #96778 - JohnTitor:expect-local-track-caller-take-2, r=petrochenkov

Remove closures on `expect_local` to apply `#[track_caller]`

Pointed out in https://github.com/rust-lang/rust/pull/96747#discussion_r866576196
Didn't change `expect_non_local` as I'm not sure if it's also the case.
r? ``@petrochenkov``

2 years agoRollup merge of #96758 - davidtwco:split-debuginfo-bootstrap-bsd, r=Mark-Simulacrum
Michael Goulet [Sat, 7 May 2022 03:49:34 +0000 (20:49 -0700)]
Rollup merge of #96758 - davidtwco:split-debuginfo-bootstrap-bsd, r=Mark-Simulacrum

bootstrap: bsd platform flags for split debuginfo

Addresses https://github.com/rust-lang/rust/pull/96597#issuecomment-1118905025.

Bootstrap currently provides `-Zunstable-options` for OpenBSD when using split debuginfo - this commit provides it for all BSD targets.

We should probably work out a better way of handling the stability of the split debuginfo flag - all options for the flag are unstable but one of them is the default for each platform already.

cc `@m-ou-se`
r? `@Mark-Simulacrum`

2 years agoRollup merge of #96746 - JohnTitor:issue-96738, r=petrochenkov
Michael Goulet [Sat, 7 May 2022 03:49:32 +0000 (20:49 -0700)]
Rollup merge of #96746 - JohnTitor:issue-96738, r=petrochenkov

Fix an ICE on #96738

In the block we don't know if the method actually exists thus `expect_local` panics.
Fixes #96738
Fixes #96583

2 years agoRollup merge of #96701 - kraktus:alloc_example_2018_edition, r=Mark-Simulacrum
Michael Goulet [Sat, 7 May 2022 03:49:31 +0000 (20:49 -0700)]
Rollup merge of #96701 - kraktus:alloc_example_2018_edition, r=Mark-Simulacrum

update `jemallocator` example to use 2018 edition import syntax

2 years agoRollup merge of #96660 - jyn514:better-missing-path-error, r=Mark-Simulacrum
Michael Goulet [Sat, 7 May 2022 03:49:30 +0000 (20:49 -0700)]
Rollup merge of #96660 - jyn514:better-missing-path-error, r=Mark-Simulacrum

[bootstrap] Give a better error when trying to run a path with no registered step

Before:
```
thread 'main' panicked at 'error: no rules matched invalid', src/bootstrap/builder.rs:287:17
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
```

After:
```
error: no `check` rules matched 'invalid'
help: run `x.py check --help --verbose` to show a list of available paths
note: if you are adding a new Step to bootstrap itself, make sure you register it with `describe!`
```

2 years agoLint for significant drops who may have surprising lifetimes #1
Preston From [Fri, 18 Feb 2022 06:02:22 +0000 (00:02 -0600)]
Lint for significant drops who may have surprising lifetimes #1

author Preston From <prestonfrom@gmail.com> 1645164142 -0600
committer Preston From <prestonfrom@gmail.com> 1650005351 -0600

2 years agoMark locks in std lib with clippy::has_significant_drop
Preston From [Fri, 15 Apr 2022 07:01:36 +0000 (01:01 -0600)]
Mark locks in std lib with clippy::has_significant_drop

2 years agoChange eslint rules from configuration comments to configuration files
Folyd [Sat, 7 May 2022 03:47:30 +0000 (11:47 +0800)]
Change eslint rules from configuration comments to configuration files

2 years agoMove check-bootstrap from a makefile rule to test::Bootstrap
gimbles [Sat, 7 May 2022 03:37:07 +0000 (09:07 +0530)]
Move check-bootstrap from a makefile rule to test::Bootstrap

2 years agoResolve vars before emitting coerce suggestions too
Jack Huey [Sun, 17 Apr 2022 19:27:03 +0000 (15:27 -0400)]
Resolve vars before emitting coerce suggestions too

2 years agoResolve vars in note_type_err
Jack Huey [Sun, 17 Apr 2022 19:00:32 +0000 (15:00 -0400)]
Resolve vars in note_type_err

2 years agoAdd regression test for #96319
Aaron Hill [Sat, 7 May 2022 02:28:22 +0000 (22:28 -0400)]
Add regression test for #96319

2 years agoAuto merge of #96531 - kckeiks:remove-item-like-visitor-from-rustc-typeck, r=cjgillot
bors [Sat, 7 May 2022 01:59:11 +0000 (01:59 +0000)]
Auto merge of #96531 - kckeiks:remove-item-like-visitor-from-rustc-typeck, r=cjgillot

Remove ItemLikeVisitor impls from rustc_typeck

Issue #95004
cc `@cjgillot`

2 years agoAuto merge of #96458 - Aaron1011:no-cycle-caching, r=jackh726,cjgillot
bors [Fri, 6 May 2022 22:41:16 +0000 (22:41 +0000)]
Auto merge of #96458 - Aaron1011:no-cycle-caching, r=jackh726,cjgillot

Don't cache results of coinductive cycle

2 years agoPoint at closure args too
Jack Huey [Sat, 16 Apr 2022 19:38:32 +0000 (15:38 -0400)]
Point at closure args too

2 years agoRemove previously deleted test files
Jack Huey [Sat, 16 Apr 2022 16:56:22 +0000 (12:56 -0400)]
Remove previously deleted test files

2 years agoCheck that field projections have the correct type
Jakob Degen [Fri, 6 May 2022 20:09:59 +0000 (16:09 -0400)]
Check that field projections have the correct type

2 years agoAuto merge of #96785 - GuillaumeGomez:rollup-rgiwa57, r=GuillaumeGomez
bors [Fri, 6 May 2022 20:14:01 +0000 (20:14 +0000)]
Auto merge of #96785 - GuillaumeGomez:rollup-rgiwa57, r=GuillaumeGomez

Rollup of 10 pull requests

Successful merges:

 - #96557 (Allow inline consts to reference generic params)
 - #96590 (rustdoc: when running a function-signature search, tweak the tab bar)
 - #96650 (Collect function instance used in `global_asm!` sym operand)
 - #96733 (turn `append_place_to_string` from recursion into iteration)
 - #96748 (Fixes reexports in search)
 - #96752 (Put the incompatible_closure_captures lint messages in alphabetical order)
 - #96754 (rustdoc: ensure HTML/JS side implementors don't have dups)
 - #96772 (Suggest fully qualified path with appropriate params)
 - #96776 (Fix two minor issues in hir.rs)
 - #96782 (a small `mirror_expr` cleanup)

Failed merges:

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

2 years agoAdd rustdoc documentation about unstable feature "jump to def"
Guillaume Gomez [Mon, 2 May 2022 13:11:15 +0000 (15:11 +0200)]
Add rustdoc documentation about unstable feature "jump to def"

2 years agoAdd regression test for jump-to-def
Guillaume Gomez [Mon, 2 May 2022 13:07:11 +0000 (15:07 +0200)]
Add regression test for jump-to-def

2 years agoRemove unneeded SpanMapVisitor::visit_generics function
Guillaume Gomez [Fri, 6 May 2022 19:54:31 +0000 (21:54 +0200)]
Remove unneeded SpanMapVisitor::visit_generics function

2 years agoExpand validator to be more precise on checked binary ops
Jakob Degen [Fri, 6 May 2022 01:15:20 +0000 (21:15 -0400)]
Expand validator to be more precise on checked binary ops

2 years agoShare more unix SystemTime code
Josh Stone [Fri, 6 May 2022 18:45:59 +0000 (11:45 -0700)]
Share more unix SystemTime code

2 years agoRollup merge of #96782 - lcnr:mirror-expr, r=compiler-errors
Guillaume Gomez [Fri, 6 May 2022 18:05:45 +0000 (20:05 +0200)]
Rollup merge of #96782 - lcnr:mirror-expr, r=compiler-errors

a small `mirror_expr` cleanup

2 years agoRollup merge of #96776 - liuw:hir, r=oli-obk
Guillaume Gomez [Fri, 6 May 2022 18:05:45 +0000 (20:05 +0200)]
Rollup merge of #96776 - liuw:hir, r=oli-obk

Fix two minor issues in hir.rs

I found these two places in hir.rs which could use a bit of improvements while going through the code.

No functional change.

2 years agoRollup merge of #96772 - TaKO8Ki:suggest-fully-qualified-path-with-appropriate-params...
Guillaume Gomez [Fri, 6 May 2022 18:05:44 +0000 (20:05 +0200)]
Rollup merge of #96772 - TaKO8Ki:suggest-fully-qualified-path-with-appropriate-params, r=compiler-errors

Suggest fully qualified path with appropriate params

closes #96291

2 years agoRollup merge of #96754 - notriddle:notriddle/impl-dups, r=GuillaumeGomez
Guillaume Gomez [Fri, 6 May 2022 18:05:43 +0000 (20:05 +0200)]
Rollup merge of #96754 - notriddle:notriddle/impl-dups, r=GuillaumeGomez

rustdoc: ensure HTML/JS side implementors don't have dups

Fixes #94641

Rendered:

- https://notriddle.com/notriddle-rustdoc-test/impl-dups/std/iter/trait.Iterator.html
- https://notriddle.com/notriddle-rustdoc-test/impl-dups/core/iter/trait.Iterator.html

2 years agoRollup merge of #96752 - scottmcm:error-sorting, r=compiler-errors
Guillaume Gomez [Fri, 6 May 2022 18:05:42 +0000 (20:05 +0200)]
Rollup merge of #96752 - scottmcm:error-sorting, r=compiler-errors

Put the incompatible_closure_captures lint messages in alphabetical order

Looks like they were in hash order before, which was causing me trouble in #94598, so this PR sorts the errors by trait name.

2 years agoRollup merge of #96748 - GuillaumeGomez:reexports-in-search, r=notriddle
Guillaume Gomez [Fri, 6 May 2022 18:05:41 +0000 (20:05 +0200)]
Rollup merge of #96748 - GuillaumeGomez:reexports-in-search, r=notriddle

Fixes reexports in search

Fixes #96681.

At some point we stopped reexporting items in search so this PR fixes it.

It also adds a regression test.

r? ```@notriddle```

2 years agoRollup merge of #96733 - SparrowLii:place_to_string, r=davidtwco
Guillaume Gomez [Fri, 6 May 2022 18:05:40 +0000 (20:05 +0200)]
Rollup merge of #96733 - SparrowLii:place_to_string, r=davidtwco

turn `append_place_to_string` from recursion into iteration

This PR fixes the FIXME in the impl of `append_place_to_string` which turns `append_place_to_string` from recursion into iteration, meanwhile simplifying the code relatively.

2 years agoRollup merge of #96650 - tmiasko:global-asm-sym-fn, r=Amanieu
Guillaume Gomez [Fri, 6 May 2022 18:05:39 +0000 (20:05 +0200)]
Rollup merge of #96650 - tmiasko:global-asm-sym-fn, r=Amanieu

Collect function instance used in `global_asm!` sym operand

The constants used in SymFn operands have FnDef type,
so the type of the constant identifies the function.

Fixes #96623.

2 years agoRollup merge of #96590 - notriddle:notriddle/tab-bar-fn-search, r=GuillaumeGomez...
Guillaume Gomez [Fri, 6 May 2022 18:05:38 +0000 (20:05 +0200)]
Rollup merge of #96590 - notriddle:notriddle/tab-bar-fn-search, r=GuillaumeGomez,jsha

rustdoc: when running a function-signature search, tweak the tab bar

# Before

![In Names (7) / In Parameters (0) / In Return types (0)](https://user-images.githubusercontent.com/1593513/166122875-ffdeafe6-8d4d-4e61-84a6-f5986b50ac35.png)

# After

![In Function Signature (7)](https://user-images.githubusercontent.com/1593513/166122883-9a3d7515-3235-4ee3-8c4b-5401d109e099.png)

2 years agoRollup merge of #96557 - nbdd0121:const, r=oli-obk
Guillaume Gomez [Fri, 6 May 2022 18:05:37 +0000 (20:05 +0200)]
Rollup merge of #96557 - nbdd0121:const, r=oli-obk

Allow inline consts to reference generic params

Tracking issue: #76001

The RFC says that inline consts cannot reference to generic parameters (for now), same as array length expressions. And expresses that it's desirable for it to reference in-scope generics, when array length expressions gain that feature as well.

However it is possible to implement this for inline consts before doing this for all anon consts, because inline consts are only used as values and they won't be used in the type system. So we can have:
```rust
fn foo<T>() {
    let x = [4i32; std::mem::size_of::<T>()];   // NOT ALLOWED (for now)
    let x = const { std::mem::size_of::<T>() }; // ALLOWED with this PR!
    let x = [4i32; const { std::mem::size_of::<T>() }];   // NOT ALLOWED (for now)
}
```

This would make inline consts super useful for compile-time checks and assertions:
```rust
fn assert_zst<T>() {
    const { assert!(std::mem::size_of::<T>() == 0) };
}
```

This would create an error during monomorphization when `assert_zst` is instantiated with non-ZST `T`s. A error during mono might sound scary, but this is exactly what a "desugared" inline const would do:
```rust
fn assert_zst<T>() {
    struct F<T>(T);
    impl<T> F<T> {
        const V: () = assert!(std::mem::size_of::<T>() == 0);
    }
    let _ = F::<T>::V;
}
```

It should also be noted that the current inline const implementation can already reference the type params via type inference, so this resolver-level restriction is not any useful either:
```rust
fn foo<T>() -> usize {
    let (_, size): (PhantomData<T>, usize) = const {
        const fn my_size_of<T>() -> (PhantomData<T>, usize) {
            (PhantomData, std::mem::size_of::<T>())
        }
        my_size_of()
    };
    size
}
```

```@rustbot``` label: F-inline_const

2 years agoAuto merge of #95454 - randomicon00:fix95444, r=wesleywiser
bors [Fri, 6 May 2022 17:52:47 +0000 (17:52 +0000)]
Auto merge of #95454 - randomicon00:fix95444, r=wesleywiser

Fixing #95444 by only displaying passes that take more than 5 millise…

As discussed in #95444, I have added the code to test and only display prints that are greater than 5 milliseconds.

r? `@jyn514`

2 years agoLink to correct issue in issue-95034 test
Ali MJ Al-Nasrawy [Fri, 6 May 2022 17:35:06 +0000 (20:35 +0300)]
Link to correct issue in issue-95034 test

2 years agoFix an incorrect link in The Unstable Book
Koichi ITO [Fri, 6 May 2022 16:21:40 +0000 (01:21 +0900)]
Fix an incorrect link in The Unstable Book

https://github.com/rust-lang/rust/blob/master/src/librustc_session/lint/builtin.rs
returns page not found.

The following is the background of the move.
First https://github.com/rust-lang/rust/pull/74862 moves from src/librustc_session/lint/builtin.rs
to compiler/rustc_session/src/lint/builtin.rs
Then https://github.com/rust-lang/rust/commit/23018a5 moves from compiler/rustc_session/src/lint/builtin.rs
to compiler/rustc_lint_defs/src/builtin.rs

So, the current correct link is https://github.com/rust-lang/rust/blob/master/compiler/rustc_lint_defs/src/builtin.rs

This PR fixes a broken link on the following page:
https://doc.rust-lang.org/beta/unstable-book/language-features/plugin.html

2 years ago`mirror_expr` cleanup
lcnr [Fri, 6 May 2022 17:00:37 +0000 (19:00 +0200)]
`mirror_expr` cleanup

2 years agoUpdate LLVM version used to build OS X and Windows artifacts to 14.0.2
Jakub Beránek [Fri, 6 May 2022 16:25:27 +0000 (18:25 +0200)]
Update LLVM version used to build OS X and Windows artifacts to 14.0.2

2 years agoRemove closures on `expect_local` to apply `#[track_caller]`
Yuki Okushi [Fri, 6 May 2022 16:11:32 +0000 (01:11 +0900)]
Remove closures on `expect_local` to apply `#[track_caller]`

2 years agoremove all usages of hir().def_kind
Miguel Guarniz [Fri, 29 Apr 2022 20:45:48 +0000 (16:45 -0400)]
remove all usages of hir().def_kind

Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2 years agouse def_span and def_kind queries instead of calling tcx.hir() methods
Miguel Guarniz [Fri, 29 Apr 2022 17:11:22 +0000 (13:11 -0400)]
use def_span and def_kind queries instead of calling tcx.hir() methods

Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2 years agopass ItemId to check_item_type instead of Item
Miguel Guarniz [Fri, 29 Apr 2022 17:09:03 +0000 (13:09 -0400)]
pass ItemId to check_item_type instead of Item

Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2 years agoremove ImplWfCheck
Miguel Guarniz [Fri, 29 Apr 2022 16:26:15 +0000 (12:26 -0400)]
remove ImplWfCheck

Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2 years agoremove CheckItemTypesVisitor
Miguel Guarniz [Fri, 29 Apr 2022 16:24:39 +0000 (12:24 -0400)]
remove CheckItemTypesVisitor

Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2 years agouse hir_module_items in check_mod_item_types query
Miguel Guarniz [Fri, 29 Apr 2022 16:22:40 +0000 (12:22 -0400)]
use hir_module_items in check_mod_item_types query

Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2 years agouse hir_module_items instead of visit_all_item_likes in check_mod_impl_wf query
Miguel Guarniz [Fri, 29 Apr 2022 15:57:01 +0000 (11:57 -0400)]
use hir_module_items instead of visit_all_item_likes in check_mod_impl_wf query

Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2 years agoremove UnsafetyChecker
Miguel Guarniz [Thu, 28 Apr 2022 17:34:49 +0000 (13:34 -0400)]
remove UnsafetyChecker

Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2 years agoremove ItemLikeVisitor impl for InherentOverlapChecker
Miguel Guarniz [Thu, 28 Apr 2022 17:03:17 +0000 (13:03 -0400)]
remove ItemLikeVisitor impl for InherentOverlapChecker

Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2 years agoremove ItemLikeVisitor impl for InherentCollect
Miguel Guarniz [Thu, 28 Apr 2022 15:00:12 +0000 (11:00 -0400)]
remove ItemLikeVisitor impl for InherentCollect

Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2 years agoMake the test `check-pass` not to produce a JSON file
Yuki Okushi [Fri, 6 May 2022 15:57:23 +0000 (00:57 +0900)]
Make the test `check-pass` not to produce a JSON file

`run-pass` produces a JSON file when enabling save analysis.

2 years agoremove OutlivesTest
Miguel Guarniz [Thu, 28 Apr 2022 14:47:13 +0000 (10:47 -0400)]
remove OutlivesTest

Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2 years agoremove VarianceTest
Miguel Guarniz [Thu, 28 Apr 2022 02:03:57 +0000 (22:03 -0400)]
remove VarianceTest

Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2 years agouse DefKind::Fn instead of DefKind::AsscFn for foreign items
Miguel Guarniz [Thu, 28 Apr 2022 01:52:51 +0000 (21:52 -0400)]
use DefKind::Fn instead of DefKind::AsscFn for foreign items

Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2 years agoremove ItemLikeVisitor impl for TermsContext
Miguel Guarniz [Thu, 28 Apr 2022 00:14:53 +0000 (20:14 -0400)]
remove ItemLikeVisitor impl for TermsContext

Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2 years agoremove ItemLikeVisitor impl for ContraintContext
Miguel Guarniz [Wed, 27 Apr 2022 21:22:58 +0000 (17:22 -0400)]
remove ItemLikeVisitor impl for ContraintContext

Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2 years agoUse statx's 64-bit times on 32-bit linux-gnu
Josh Stone [Thu, 10 Mar 2022 01:05:16 +0000 (17:05 -0800)]
Use statx's 64-bit times on 32-bit linux-gnu

2 years agoUse __clock_gettime64 on 32-bit linux-gnu
Josh Stone [Wed, 9 Mar 2022 20:41:47 +0000 (12:41 -0800)]
Use __clock_gettime64 on 32-bit linux-gnu

2 years agounix: always use 64-bit Timespec
Josh Stone [Wed, 9 Mar 2022 20:25:46 +0000 (12:25 -0800)]
unix: always use 64-bit Timespec

2 years agoAlso suggest calling constructors for external DefIds
Yuki Okushi [Fri, 6 May 2022 15:43:50 +0000 (00:43 +0900)]
Also suggest calling constructors for external DefIds