]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoAdd a test with both passing and erroneous cases.
Camille GILLOT [Sat, 14 May 2022 12:07:46 +0000 (14:07 +0200)]
Add a test with both passing and erroneous cases.

2 years agoForbid nested opaque types to reference HRTB from opaque types.
Camille GILLOT [Sat, 14 May 2022 09:25:53 +0000 (11:25 +0200)]
Forbid nested opaque types to reference HRTB from opaque types.

2 years agoAuto merge of #97035 - JohnTitor:rollup-00ko07z, r=JohnTitor
bors [Sat, 14 May 2022 05:53:39 +0000 (05:53 +0000)]
Auto merge of #97035 - JohnTitor:rollup-00ko07z, r=JohnTitor

Rollup of 6 pull requests

Successful merges:

 - #95365 (Use default alloc_error_handler for hermit)
 - #96986 ([save-analysis] Reference the variant not enum at struct-literal cons…)
 - #96998 (rustdoc: remove weird, unused variable from source-files.js)
 - #97005 (Two small improvements of rustc_expand)
 - #97018 (Ensure that test fail if a JS error occurs)
 - #97031 (Drop tracking: handle invalid assignments better)

Failed merges:

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

2 years agoRollup merge of #97031 - eholk:drop-tracking-type-error, r=compiler-errors
Yuki Okushi [Sat, 14 May 2022 04:42:55 +0000 (13:42 +0900)]
Rollup merge of #97031 - eholk:drop-tracking-type-error, r=compiler-errors

Drop tracking: handle invalid assignments better

Previously this test case was crashing with an index out of bounds error deep in the call to `needs_drop`. We avoid this by detecting clearly invalid assignees in the `mutate` callback and ignoring these.

2 years agoRollup merge of #97018 - GuillaumeGomez:fail-on-js-error, r=notriddle
Yuki Okushi [Sat, 14 May 2022 04:42:54 +0000 (13:42 +0900)]
Rollup merge of #97018 - GuillaumeGomez:fail-on-js-error, r=notriddle

Ensure that test fail if a JS error occurs

Fixes #96902.

r? ``@notriddle``

2 years agoRollup merge of #97005 - est31:master, r=petrochenkov
Yuki Okushi [Sat, 14 May 2022 04:42:53 +0000 (13:42 +0900)]
Rollup merge of #97005 - est31:master, r=petrochenkov

Two small improvements of rustc_expand

I found them while doing #96150

r? ``@petrochenkov``

2 years agoRollup merge of #96998 - notriddle:notriddle/var-N, r=jsha
Yuki Okushi [Sat, 14 May 2022 04:42:52 +0000 (13:42 +0900)]
Rollup merge of #96998 - notriddle:notriddle/var-N, r=jsha

rustdoc: remove weird, unused variable from source-files.js

2 years agoRollup merge of #96986 - kdashg:save-an-enum-vars, r=oli-obk
Yuki Okushi [Sat, 14 May 2022 04:42:50 +0000 (13:42 +0900)]
Rollup merge of #96986 - kdashg:save-an-enum-vars, r=oli-obk

[save-analysis] Reference the variant not enum at struct-literal cons…

…truction.

Closes #96985

2 years agoRollup merge of #95365 - mkroening:hermit-alloc-error-handler, r=joshtriplett
Yuki Okushi [Sat, 14 May 2022 04:42:49 +0000 (13:42 +0900)]
Rollup merge of #95365 - mkroening:hermit-alloc-error-handler, r=joshtriplett

Use default alloc_error_handler for hermit

Hermit now properly separates kernel from userspace.
Applications for hermit can now use Rust's default `alloc_error_handler` instead of calling the kernel's `__rg_oom`.

CC: ``@stlankes``
2 years agoAuto merge of #95602 - scottmcm:faster-array-intoiter-fold, r=the8472
bors [Sat, 14 May 2022 03:12:53 +0000 (03:12 +0000)]
Auto merge of #95602 - scottmcm:faster-array-intoiter-fold, r=the8472

Fix `array::IntoIter::fold` to use the optimized `Range::fold`

It was using `Iterator::by_ref` in the implementation, which ended up pessimizing it enough that, for example, it didn't vectorize when we tried it in the <https://rust-lang.zulipchat.com/#narrow/stream/257879-project-portable-simd/topic/Reducing.20sum.20into.20wider.20types> conversation.

Demonstration that the codegen test doesn't pass on the current nightly: <https://rust.godbolt.org/z/Taxev5eMn>

2 years agoFix nit
Eric Holk [Sat, 14 May 2022 02:32:53 +0000 (19:32 -0700)]
Fix nit

2 years agoDrop tracking: handle invalid assignments better
Eric Holk [Fri, 13 May 2022 23:25:22 +0000 (16:25 -0700)]
Drop tracking: handle invalid assignments better

Previously this test case was crashing with an index out of bounds error
deep in the call to `needs_drop`. We avoid this by detecting clearly
invalid assignees in the `mutate` callback and ignoring these.

2 years agoAuto merge of #97013 - matthiaskrgr:rollup-c1pc6pc, r=matthiaskrgr
bors [Fri, 13 May 2022 20:26:04 +0000 (20:26 +0000)]
Auto merge of #97013 - matthiaskrgr:rollup-c1pc6pc, r=matthiaskrgr

Rollup of 5 pull requests

Successful merges:

 - #96154 (Expand core::hint::unreachable_unchecked() docs)
 - #96615 (Add a regression test for #54779)
 - #96982 (fix clippy expect_fun_call)
 - #97003 (Remove some unnecessary `rustc_allow_const_fn_unstable` attributes.)
 - #97011 (Add regression test for #28935)

Failed merges:

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

2 years agoAuto merge of #95356 - coolreader18:exitstatus-exit-method, r=<try>
bors [Fri, 13 May 2022 18:29:13 +0000 (18:29 +0000)]
Auto merge of #95356 - coolreader18:exitstatus-exit-method, r=<try>

ExitCode::exit_process() method

cc `@yaahc` / #93840

(eeek, hit ctrl-enter before I meant to and right after realizing the branch name was wrong. oh, well)

I feel like it makes sense to have the `exit(ExitCode)` function as a method or at least associated function on ExitCode, but maybe that would hurt discoverability? Probably not as much if it's at the top of the `process::exit()` documentation or something, but idk. Also very unsure about the name, I'd like something that communicates that you are exiting with *this* ExitCode, but with a method name being postfix it doesn't seem to flow. `code.exit_process_with()` ? `.exit_process_with_self()` ? Blech. Maybe it doesn't matter, since ideally just `code.exit()` or something would be clear simply by the name and single parameter but :shrug:

Also I'd like to touch up the `ExitCode` docs (which I did a bit here), but that would probably be good in a separate PR, right? Since I think the beta deadline is coming up.

2 years agoGuarantee less in docs
Noa [Thu, 12 May 2022 04:29:51 +0000 (23:29 -0500)]
Guarantee less in docs

2 years agoAdd ExitCode::exit_process example
Noa [Wed, 11 May 2022 02:56:20 +0000 (21:56 -0500)]
Add ExitCode::exit_process example

2 years agoEmit an error if there is a JS failure on rustdoc pages
Guillaume Gomez [Fri, 13 May 2022 15:05:17 +0000 (17:05 +0200)]
Emit an error if there is a JS failure on rustdoc pages

2 years agoUpdate browser-ui-test version
Guillaume Gomez [Fri, 13 May 2022 15:03:33 +0000 (17:03 +0200)]
Update browser-ui-test version

2 years agoRollup merge of #97011 - JohnTitor:issue-28935, r=compiler-errors
Matthias Krüger [Fri, 13 May 2022 14:03:26 +0000 (16:03 +0200)]
Rollup merge of #97011 - JohnTitor:issue-28935, r=compiler-errors

Add regression test for #28935

Closes #28935, one of the ancient issues can be closed :)
r? `@compiler-errors`

2 years agoRollup merge of #97003 - nnethercote:rm-const_fn-attrs, r=fee1-dead
Matthias Krüger [Fri, 13 May 2022 14:03:25 +0000 (16:03 +0200)]
Rollup merge of #97003 - nnethercote:rm-const_fn-attrs, r=fee1-dead

Remove some unnecessary `rustc_allow_const_fn_unstable` attributes.

r? `@fee1-dead`

2 years agoRollup merge of #96982 - klensy:no-expect, r=Dylan-DPC
Matthias Krüger [Fri, 13 May 2022 14:03:24 +0000 (16:03 +0200)]
Rollup merge of #96982 - klensy:no-expect, r=Dylan-DPC

fix clippy expect_fun_call

2 years agoRollup merge of #96615 - JohnTitor:test-54779, r=compiler-errors
Matthias Krüger [Fri, 13 May 2022 14:03:23 +0000 (16:03 +0200)]
Rollup merge of #96615 - JohnTitor:test-54779, r=compiler-errors

Add a regression test for #54779

Closes #54779
r? `@jackh726`

2 years agoRollup merge of #96154 - lukaslueg:unreachablehint, r=scottmcm
Matthias Krüger [Fri, 13 May 2022 14:03:22 +0000 (16:03 +0200)]
Rollup merge of #96154 - lukaslueg:unreachablehint, r=scottmcm

Expand core::hint::unreachable_unchecked() docs

Rework the docs for `unreachable_unchecked`, encouraging deliberate use, and providing a better example for action at a distance.

Fixes #95865

2 years agoAdd regression test for #28935
Yuki Okushi [Fri, 13 May 2022 13:04:47 +0000 (22:04 +0900)]
Add regression test for #28935

2 years agoAuto merge of #96899 - oli-obk:closure_wf_check_bounds, r=nikomatsakis
bors [Fri, 13 May 2022 11:18:01 +0000 (11:18 +0000)]
Auto merge of #96899 - oli-obk:closure_wf_check_bounds, r=nikomatsakis

Check that closures satisfy their where bounds

fixes https://github.com/rust-lang/rust/issues/53092
fixes https://github.com/rust-lang/rust/issues/90409

based on https://github.com/rust-lang/rust/pull/96736

2 years agoFor non-defining opaque type usage errors, don't try to also prove all trait bounds
Oli Scherer [Tue, 10 May 2022 14:32:12 +0000 (14:32 +0000)]
For non-defining opaque type usage errors, don't try to also prove all trait bounds

2 years agoCheck that closures satisfy their where bounds
Oli Scherer [Tue, 10 May 2022 14:19:19 +0000 (14:19 +0000)]
Check that closures satisfy their where bounds

2 years agoAuto merge of #96930 - ayrtonm:mips32-tmp-file, r=petrochenkov
bors [Fri, 13 May 2022 08:48:31 +0000 (08:48 +0000)]
Auto merge of #96930 - ayrtonm:mips32-tmp-file, r=petrochenkov

Fix e_flags for 32-bit MIPS targets in generated object file

In #95604 the compiler started generating a temporary symbols.o which is added to the linker invocation. This object file has an `e_flags` which is invalid for 32-bit MIPS targets. Even though symbols.o doesn't contain code, linking these targets with [lld fails](https://github.com/llvm/llvm-project/blob/main/lld/ELF/Arch/MipsArchTree.cpp#L76-L79) with
```
rust-lld: error: foo-cgu.0.rcgu.o: ABI 'o32' is incompatible with target ABI 'n64'
```
because it omits the ABI bits (`EF_MIPS_ABI_O32`) so lld assumes it's using the N64 ABI. This breaks linking on nightly for the out-of-tree [mipsel-sony-psx target](https://github.com/ayrtonm/psx-sdk-rs/issues/9), the builtin mipsel-sony-psp target (cc `@overdrivenpotato)` and probably any other 32-bit MIPS target using lld.

This PR sets the ABI in `e_flags` to O32 since that's the only ABI for 32-bit MIPS that LLVM supports. It also sets other `e_flags` bits based on the target to avoid similar issues with the object file arch and PIC. I had to bump the object crate version since some of these constants were [added recently](https://github.com/gimli-rs/object/pull/433). I'm not sure if this PR needs a test, but I can confirm that it fixes the linking issue on both targets I mentioned.

2 years agoSlap #[inline] on all the ByRefSized methods, per the8472's suggestion
Scott McMurray [Fri, 13 May 2022 07:43:15 +0000 (00:43 -0700)]
Slap #[inline] on all the ByRefSized methods, per the8472's suggestion

2 years agoUse pluralize in one instance
est31 [Fri, 13 May 2022 06:48:35 +0000 (08:48 +0200)]
Use pluralize in one instance

2 years agoImprove name and documentation of generic_extension
est31 [Fri, 13 May 2022 06:42:39 +0000 (08:42 +0200)]
Improve name and documentation of generic_extension

This function doesn't *create* a (rules based) macro, it *expands* it.
Thus, the documentation was wrong.

2 years agoAuto merge of #96965 - oli-obk:flaky_inliner_ice, r=cjgillot
bors [Fri, 13 May 2022 06:20:56 +0000 (06:20 +0000)]
Auto merge of #96965 - oli-obk:flaky_inliner_ice, r=cjgillot

Gracefully handle normalization failures in the prospective inliner cycle detector

Preliminary work for adding the regression test in #96950 to our test suite (it was flaky on glacier).

If this PR solves the flakiness on glacier, we can then merge #96950

2 years agoRemove some unnecessary `rustc_allow_const_fn_unstable` attributes.
Nicholas Nethercote [Fri, 13 May 2022 06:01:18 +0000 (16:01 +1000)]
Remove some unnecessary `rustc_allow_const_fn_unstable` attributes.

2 years agoAuto merge of #97000 - matthiaskrgr:rollup-qh3lhu8, r=matthiaskrgr
bors [Fri, 13 May 2022 03:40:37 +0000 (03:40 +0000)]
Auto merge of #97000 - matthiaskrgr:rollup-qh3lhu8, r=matthiaskrgr

Rollup of 5 pull requests

Successful merges:

 - #96932 (Clarify what values `BorrowedHandle`, `OwnedHandle` etc. can hold.)
 - #96948 (Add test of matches macro for trailing commas)
 - #96988 (Fix platform support links.)
 - #96989 (Be more precise than DefPathData::Misc.)
 - #96993 (rustdoc: fix GUI crash when searching for magic JS property values)

Failed merges:

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

2 years agoRollup merge of #96993 - notriddle:notriddle/prototype, r=GuillaumeGomez
Matthias Krüger [Fri, 13 May 2022 03:33:14 +0000 (05:33 +0200)]
Rollup merge of #96993 - notriddle:notriddle/prototype, r=GuillaumeGomez

rustdoc: fix GUI crash when searching for magic JS property values

2 years agoRollup merge of #96989 - cjgillot:defpath-use, r=davidtwco
Matthias Krüger [Fri, 13 May 2022 03:33:13 +0000 (05:33 +0200)]
Rollup merge of #96989 - cjgillot:defpath-use, r=davidtwco

Be more precise than DefPathData::Misc.

This variant was used for two unrelated things. Let's make this cleaner.

2 years agoRollup merge of #96988 - ehuss:fix-platform-links, r=JohnTitor
Matthias Krüger [Fri, 13 May 2022 03:33:12 +0000 (05:33 +0200)]
Rollup merge of #96988 - ehuss:fix-platform-links, r=JohnTitor

Fix platform support links.

Hermitkernel was removed in #95299.  nvptx was added in #95896 without being added to the SUMMARY.

2 years agoRollup merge of #96948 - ludfo774:macro-trailing-comma-test, r=joshtriplett
Matthias Krüger [Fri, 13 May 2022 03:33:11 +0000 (05:33 +0200)]
Rollup merge of #96948 - ludfo774:macro-trailing-comma-test, r=joshtriplett

Add test of matches macro for trailing commas

Almost all macros are tested for trailing commas.
The macro matches! was however not tested.
This PR adds that test case.
Related to #46238

2 years agoRollup merge of #96932 - sunfishcode:sunfishcode/document-borrowed-handle, r=joshtriplett
Matthias Krüger [Fri, 13 May 2022 03:33:10 +0000 (05:33 +0200)]
Rollup merge of #96932 - sunfishcode:sunfishcode/document-borrowed-handle, r=joshtriplett

Clarify what values `BorrowedHandle`, `OwnedHandle` etc. can hold.

Reword the documentation to clarify that when `BorrowedHandle`, `OwnedHandle`, or `HandleOrNull` hold the value `-1`, it always means the current process handle, and not `INVALID_HANDLE_VALUE`.

`-1` should only mean `INVALID_HANDLE_VALUE` after a call to a function documented to return that to report errors, which should lead I/O functions to produce errors rather than succeeding and producing `OwnedHandle` or `BorrowedHandle` values. So if a consumer of an `OwnedHandle` or `BorrowedHandle` ever sees them holding a `-1`, it should always mean the current process handle.

2 years agoAuto merge of #96493 - chbaker0:issue-96342-fix, r=Mark-Simulacrum
bors [Fri, 13 May 2022 01:25:28 +0000 (01:25 +0000)]
Auto merge of #96493 - chbaker0:issue-96342-fix, r=Mark-Simulacrum

Add compiletest and bootstrap "--skip" option forwarded to libtest

With this PR,  "x.py test --skip SKIP ..." will run the specified test suite, but forward "--skip SKIP" to the test tool. libtest already supports this option. The PR also adds it to compiletest which itself just forwards it to libtest.

Adds the functionality requested in https://github.com/rust-lang/rust/issues/96342. This is useful to work around tests broken upstream.

https://github.com/rust-lang/rust/issues/96362#issuecomment-1108609893 is the specific test issue my project is trying to work around.

2 years agorustdoc: remove weird, unused variable from source-files.js
Michael Howell [Fri, 13 May 2022 00:34:16 +0000 (17:34 -0700)]
rustdoc: remove weird, unused variable from source-files.js

2 years ago[save-analysis] Reference the variant not enum at struct-literal construction.
Kelsey Gilbert [Tue, 10 May 2022 23:15:48 +0000 (16:15 -0700)]
[save-analysis] Reference the variant not enum at struct-literal construction.

Closes #96985

2 years agoAuto merge of #96966 - nikic:llvm-update-2, r=cuviper
bors [Thu, 12 May 2022 22:29:50 +0000 (22:29 +0000)]
Auto merge of #96966 - nikic:llvm-update-2, r=cuviper

Update LLVM submodule

Merge upstream release/14.x branch.

Fixes #96672.

2 years agorustdoc: fix GUI crash when searching for magic JS property values
Michael Howell [Thu, 12 May 2022 21:15:31 +0000 (14:15 -0700)]
rustdoc: fix GUI crash when searching for magic JS property values

2 years agoAuto merge of #96984 - ehuss:update-cargo, r=ehuss
bors [Thu, 12 May 2022 19:49:13 +0000 (19:49 +0000)]
Auto merge of #96984 - ehuss:update-cargo, r=ehuss

Update cargo

20 commits in a44758ac805600edbb6ba51e7e6fb81a6077c0cd..3f052d8eed98c6a24f8b332fb2e6e6249d12d8c1
2022-05-04 02:29:34 +0000 to 2022-05-12 15:19:04 +0000
- pre-stabilization documentation for workspace inheritance (rust-lang/cargo#10659)
- test: Make curr_dir work in/out of workspace (rust-lang/cargo#10658)
- Fix no_cross_doctests race condition. (rust-lang/cargo#10660)
- Fix typo (rust-lang/cargo#10657)
- feat(install): Support `foo@version` like cargo-add (rust-lang/cargo#10650)
- fix typos found by the `typos-cli` crate (rust-lang/cargo#10649)
- feat(yank): Support foo@version like cargo-add (rust-lang/cargo#10597)
- add `cargo-features` to unstable docs for workspace inheritance (rust-lang/cargo#10648)
- Use the traits added to the Rust 2021 Edition prelude (rust-lang/cargo#10646)
- Pass `--target` to `rustdoc` for `cargo test` if specified with host target. (rust-lang/cargo#10594)
- Fix use of .. in dep-info-basedir (rust-lang/cargo#10281)
- fix some typos (rust-lang/cargo#10639)
- Move snapshot tests into testsuite (rust-lang/cargo#10638)
- Improve support of condition compilation checking (rust-lang/cargo#10566)
- When documenting private items in a binary, ignore warnings about links to private items (rust-lang/cargo#10142)
- Extend pkgid syntax with ``@`` support (rust-lang/cargo#10582)
- move one `snapshot/add` test into `testsuite/cargo_add/` (rust-lang/cargo#10631)
- Add caveat for covering features (rust-lang/cargo#10605)
- Improve CARGO_ENCODED_RUSTFLAGS and CARGO_ENCODED_RUSTDOCFLAGS variables docs (rust-lang/cargo#10633)
- reorganize `snapshot` tests to better work in contexts that sort by extension (rust-lang/cargo#10629)

2 years agoBless mir-opt tests.
Camille GILLOT [Thu, 12 May 2022 19:37:57 +0000 (21:37 +0200)]
Bless mir-opt tests.

2 years agoBless tests.
Camille GILLOT [Thu, 12 May 2022 18:29:11 +0000 (20:29 +0200)]
Bless tests.

2 years agoCorrect comment.
Camille GILLOT [Thu, 12 May 2022 18:13:54 +0000 (20:13 +0200)]
Correct comment.

2 years agoReplace DefPathData::Misc by two appropriately-named variants.
Camille GILLOT [Thu, 12 May 2022 18:12:35 +0000 (20:12 +0200)]
Replace DefPathData::Misc by two appropriately-named variants.

2 years agoFix platform support links.
Eric Huss [Thu, 12 May 2022 18:07:32 +0000 (11:07 -0700)]
Fix platform support links.

2 years agoUpdate cargo
Eric Huss [Thu, 12 May 2022 17:12:50 +0000 (10:12 -0700)]
Update cargo

2 years agofix clippy expect_fun_call
klensy [Thu, 12 May 2022 16:26:52 +0000 (19:26 +0300)]
fix clippy expect_fun_call

2 years agoAuto merge of #96974 - matthiaskrgr:rollup-jd4otnc, r=matthiaskrgr
bors [Thu, 12 May 2022 15:07:35 +0000 (15:07 +0000)]
Auto merge of #96974 - matthiaskrgr:rollup-jd4otnc, r=matthiaskrgr

Rollup of 5 pull requests

Successful merges:

 - #95896 (Note the contacts for the nvptx64 target(s))
 - #96860 (openbsd: convert futex timeout managment to Timespec usage)
 - #96939 (Fix settings page CSS)
 - #96941 (update graphviz links)
 - #96968 (Add tests for #96806)

Failed merges:

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

2 years agoRollup merge of #96968 - cjgillot:codegen-fulfill-nice, r=oli-obk
Matthias Krüger [Thu, 12 May 2022 14:41:06 +0000 (16:41 +0200)]
Rollup merge of #96968 - cjgillot:codegen-fulfill-nice, r=oli-obk

Add tests for #96806

I messed up the rebase in https://github.com/rust-lang/rust/pull/96806.

I took the opportunity to add an extra mir-opt test from https://github.com/rust-lang/rust/pull/91743.

r? `@oli-obk`

2 years agoRollup merge of #96941 - nannany:master, r=lcnr,JohnTitor
Matthias Krüger [Thu, 12 May 2022 14:41:05 +0000 (16:41 +0200)]
Rollup merge of #96941 - nannany:master, r=lcnr,JohnTitor

update graphviz links

Update graphviz links.

2 years agoRollup merge of #96939 - GuillaumeGomez:settings-css, r=notriddle
Matthias Krüger [Thu, 12 May 2022 14:41:04 +0000 (16:41 +0200)]
Rollup merge of #96939 - GuillaumeGomez:settings-css, r=notriddle

Fix settings page CSS

In https://github.com/rust-lang/rust/pull/96741, I moved the CSS loading outside of `settings.js`. The result was that on the settings page, there isn't the settings CSS anymore:

![Screenshot from 2022-05-11 11-09-24](https://user-images.githubusercontent.com/3050060/167817969-6750931b-3e6e-4178-b5a9-ee3851e983be.png)

I also used this opportunity to remove unused CSS rules (we don't have `<select>` elements anymore in the settings).

cc `@jsha`
r? `@notriddle`

2 years agoRollup merge of #96860 - semarie:openbsd-futex-time64, r=cuviper
Matthias Krüger [Thu, 12 May 2022 14:41:03 +0000 (16:41 +0200)]
Rollup merge of #96860 - semarie:openbsd-futex-time64, r=cuviper

openbsd: convert futex timeout managment to Timespec usage

unbreak openbsd build after #96657

r? cuviper

please note I made `Timespec::zero()` public to be able to use it. OpenBSD is using relative timeout for `futex(2)` and I don't find simple way to use `Timespec` this way.

2 years agoRollup merge of #95896 - nagisa:nvptx-contacts, r=Mark-Simulacrum
Matthias Krüger [Thu, 12 May 2022 14:41:01 +0000 (16:41 +0200)]
Rollup merge of #95896 - nagisa:nvptx-contacts, r=Mark-Simulacrum

Note the contacts for the nvptx64 target(s)

cc `@RDambrosio016` `@kjetilkjeka`

2 years agoAuto merge of #95562 - lcnr:attr-no-encode, r=davidtwco
bors [Thu, 12 May 2022 12:48:30 +0000 (12:48 +0000)]
Auto merge of #95562 - lcnr:attr-no-encode, r=davidtwco

don't encode only locally used attrs

Part of https://github.com/rust-lang/compiler-team/issues/505.

We now filter builtin attributes before encoding them in the crate metadata in case they should only be used in the local crate. To prevent accidental misuse `get_attrs` now requires the caller to state which attribute they are interested in. For places where that isn't trivially possible, I've added a method `fn get_attrs_unchecked` which I intend to remove in a followup PR.

After this pull request landed, we can then slowly move all attributes to only be used in the local crate while being certain that we don't accidentally try to access them from extern crates.

cc https://github.com/rust-lang/rust/pull/94963#issuecomment-1082924289

2 years agoAdd mir-opt test.
Camille GILLOT [Thu, 12 May 2022 10:46:28 +0000 (12:46 +0200)]
Add mir-opt test.

2 years agoAuto merge of #96853 - davidtwco:diagnostic-translation-unit-and-more-porting, r...
bors [Thu, 12 May 2022 10:22:07 +0000 (10:22 +0000)]
Auto merge of #96853 - davidtwco:diagnostic-translation-unit-and-more-porting, r=oli-obk

diagnostics: port more diagnostics to derive + support for `()` fields

- Extend diagnostic derive so that spanless subdiagnostics (e.g. some uses of `help`/`note`) can be applied via attributes to fields of type `()` (currently spanless subdiagnostics are applied via attributes on the diagnostic struct itself). A consequence of this is that `Option<()>` fields can be used to represent optional spanless subdiagnostics, which are sometimes useful (e.g. for a `help` that should only show on nightly builds).
- Simplify the "explicit generic args with impl trait" diagnostic struct (from #96760) using support for `Option<()>` spanless subdiagnostics.
- Change `DiagnosticBuilder::set_arg`, used to provide context for Fluent messages, so that it takes anything that implements `IntoDiagnosticArg`, rather than `DiagnosticArgValue` - this improves the ergonomics of manual implementations of `SessionDiagnostic` which are translatable.
- Port "the type parameter `T` must be explicitly specified", "manual implementations of `X` are experimental", "could not resolve substs on overridden impl" diagnostics to diagnostic structs.
- When testing macros from `rustc_macros` in `ui-fulldeps` tests, sometimes paths from the compiler source tree can be shown in error messages - these need to be normalized in `compiletest`.

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

2 years agoUse IndexSet for deterministic order
Oli Scherer [Thu, 12 May 2022 10:03:41 +0000 (10:03 +0000)]
Use IndexSet for deterministic order

2 years agoAdd tests.
Camille GILLOT [Mon, 9 May 2022 16:43:16 +0000 (18:43 +0200)]
Add tests.

2 years agoupdate graphviz links
minami.yoshihiko [Wed, 11 May 2022 11:21:10 +0000 (20:21 +0900)]
update graphviz links

add subdomain

2 years agoGracefully handle normalization failures in the prospective inliner cycle detector
Oli Scherer [Thu, 12 May 2022 08:22:36 +0000 (08:22 +0000)]
Gracefully handle normalization failures in the prospective inliner cycle detector

2 years agoUpdate LLVM submodule
Nikita Popov [Thu, 12 May 2022 08:17:27 +0000 (10:17 +0200)]
Update LLVM submodule

2 years agoAuto merge of #96940 - TaKO8Ki:stop-suggesting-wrong-fully-qualified-path, r=estebank
bors [Thu, 12 May 2022 07:44:31 +0000 (07:44 +0000)]
Auto merge of #96940 - TaKO8Ki:stop-suggesting-wrong-fully-qualified-path, r=estebank

Stop suggesting non-existing fully qualified paths

This patch fixes a part of #96295.

r? `@estebank`

2 years agotypeck: port "no resolve overridden impl substs"
David Wood [Sat, 7 May 2022 07:14:48 +0000 (08:14 +0100)]
typeck: port "no resolve overridden impl substs"

Port "could not resolve substs on overridden impl" diagnostic to use the
diagnostic derive.

Signed-off-by: David Wood <david.wood@huawei.com>
2 years agotypeck: port "manual implementations"
David Wood [Sat, 7 May 2022 06:50:01 +0000 (07:50 +0100)]
typeck: port "manual implementations"

Port the "manual implementations of `X` are experimental" diagnostic to
use the diagnostic derive.

Signed-off-by: David Wood <david.wood@huawei.com>
2 years agotypeck: port "missing type params"
David Wood [Sat, 7 May 2022 06:32:01 +0000 (07:32 +0100)]
typeck: port "missing type params"

Port the "the type parameter `T` must be explicitly specified"
diagnostic to using a diagnostic struct.

Signed-off-by: David Wood <david.wood@huawei.com>
2 years agoerrors: `set_arg` takes `IntoDiagnosticArg`
David Wood [Sat, 7 May 2022 06:26:03 +0000 (07:26 +0100)]
errors: `set_arg` takes `IntoDiagnosticArg`

Manual implementors of translatable diagnostics will need to call
`set_arg`, not just the derive, so make this function a bit more
ergonomic by taking `IntoDiagnosticArg` rather than
`DiagnosticArgValue`.

Signed-off-by: David Wood <david.wood@huawei.com>
2 years agocompiletest: normalize paths from repository root
David Wood [Mon, 9 May 2022 03:18:35 +0000 (04:18 +0100)]
compiletest: normalize paths from repository root

When testing macros from `rustc_macros` in `ui-fulldeps` tests,
sometimes paths from the compiler source tree can be shown in error
messages - these need to be normalized.

Signed-off-by: David Wood <david.wood@huawei.com>
2 years agotypeck: simplify error type using `()` field
David Wood [Sat, 7 May 2022 05:05:01 +0000 (06:05 +0100)]
typeck: simplify error type using `()` field

Using new support for spanless subdiagnostics from `()` fields in the
diagnostic derive, simplify the "explicit generic args with impl trait"
diagnostic's struct.

Signed-off-by: David Wood <david.wood@huawei.com>
2 years agomacros: spanless subdiagnostics from `()` fields
David Wood [Sat, 7 May 2022 05:02:11 +0000 (06:02 +0100)]
macros: spanless subdiagnostics from `()` fields

Type attributes could previously be used to support spanless
subdiagnostics but these couldn't easily be made optional in the same
way that spanned subdiagnostics could by using a field attribute on a
field with an `Option<Span>` type. Spanless subdiagnostics can now be
specified on fields with `()` type or `Option<()>` type.

Signed-off-by: David Wood <david.wood@huawei.com>
2 years agoAuto merge of #96889 - Aaron1011:place-ref-remove, r=compiler-errors
bors [Thu, 12 May 2022 05:03:48 +0000 (05:03 +0000)]
Auto merge of #96889 - Aaron1011:place-ref-remove, r=compiler-errors

Remove `PartialOrd`/`Ord` impl for `PlaceRef`

This is a new attempt at #93315. It removes one usage
of the `Ord` impl for `DefId`, which should make it easier
to eventually remove that impl.

2 years agoFix comment syntax.
Dan Gohman [Thu, 12 May 2022 04:11:49 +0000 (21:11 -0700)]
Fix comment syntax.

2 years agoRelax the wording about the meaning of -1.
Dan Gohman [Thu, 12 May 2022 03:50:07 +0000 (20:50 -0700)]
Relax the wording about the meaning of -1.

2 years agoAuto merge of #95837 - scottmcm:ptr-offset-from-unsigned, r=oli-obk
bors [Thu, 12 May 2022 02:49:00 +0000 (02:49 +0000)]
Auto merge of #95837 - scottmcm:ptr-offset-from-unsigned, r=oli-obk

Add `sub_ptr` on pointers (the `usize` version of `offset_from`)

We have `add`/`sub` which are the `usize` versions of `offset`, this adds the `usize` equivalent of `offset_from`.  Like how `.add(d)` replaced a whole bunch of `.offset(d as isize)`, you can see from the changes here that it's fairly common that code actually knows the order between the pointers and *wants* a `usize`, not an `isize`.

As a bonus, this can do `sub nuw`+`udiv exact`, rather than `sub`+`sdiv exact`, which can be optimized slightly better because it doesn't have to worry about negatives.  That's why the slice iterators weren't using `offset_from`, though I haven't updated that code in this PR because slices are so perf-critical that I'll do it as its own change.

This is an intrinsic, like `offset_from`, so that it can eventually be allowed in CTFE.  It also allows checking the extra safety condition -- see the test confirming that CTFE catches it if you pass the pointers in the wrong order.

2 years agoApply CR suggestions; add real tracking issue
Scott McMurray [Sun, 10 Apr 2022 23:02:52 +0000 (16:02 -0700)]
Apply CR suggestions; add real tracking issue

2 years agoAdd a debug check for ordering, and check for isize overflow in CTFE
Scott McMurray [Sat, 9 Apr 2022 23:29:39 +0000 (16:29 -0700)]
Add a debug check for ordering, and check for isize overflow in CTFE

2 years agoRename `unsigned_offset_from` to `sub_ptr`
Scott McMurray [Sat, 9 Apr 2022 21:14:35 +0000 (14:14 -0700)]
Rename `unsigned_offset_from` to `sub_ptr`

2 years agoAdd `unsigned_offset_from` on pointers
Scott McMurray [Sat, 9 Apr 2022 08:27:47 +0000 (01:27 -0700)]
Add `unsigned_offset_from` on pointers

Like we have `add`/`sub` which are the `usize` version of `offset`, this adds the `usize` equivalent of `offset_from`.  Like how `.add(d)` replaced a whole bunch of `.offset(d as isize)`, you can see from the changes here that it's fairly common that code actually knows the order between the pointers and *wants* a `usize`, not an `isize`.

As a bonus, this can do `sub nuw`+`udiv exact`, rather than `sub`+`sdiv exact`, which can be optimized slightly better because it doesn't have to worry about negatives.  That's why the slice iterators weren't using `offset_from`, though I haven't updated that code in this PR because slices are so perf-critical that I'll do it as its own change.

This is an intrinsic, like `offset_from`, so that it can eventually be allowed in CTFE.  It also allows checking the extra safety condition -- see the test confirming that CTFE catches it if you pass the pointers in the wrong order.

2 years agoAuto merge of #96150 - est31:unused_macro_rules, r=petrochenkov
bors [Thu, 12 May 2022 00:08:08 +0000 (00:08 +0000)]
Auto merge of #96150 - est31:unused_macro_rules, r=petrochenkov

Implement a lint to warn about unused macro rules

This implements a new lint to warn about unused macro rules (arms/matchers), similar to the `unused_macros` lint added by #41907 that warns about entire macros.

```rust
macro_rules! unused_empty {
    (hello) => { println!("Hello, world!") };
    () => { println!("empty") }; //~ ERROR: 1st rule of macro `unused_empty` is never used
}

fn main() {
    unused_empty!(hello);
}
```

Builds upon #96149 and #96156.

Fixes #73576

2 years agoAuto merge of #96806 - cjgillot:codegen-fulfill-nice, r=oli-obk
bors [Wed, 11 May 2022 21:39:02 +0000 (21:39 +0000)]
Auto merge of #96806 - cjgillot:codegen-fulfill-nice, r=oli-obk

Gracefully fail to resolve associated items instead of `delay_span_bug`.

`codegen_fulfill_obligation` is used during instance resolution for trait items.

In case of insufficient normalization issues during MIR inlining, it caused ICEs.
It's better to gracefully refuse to resolve the associated item, and let the caller decide what to do with this.

Split from https://github.com/rust-lang/rust/pull/91743
Closes #69121
Closes #73021
Closes #88599
Closes #93008
Closes #93248
Closes #94680
Closes #96170
r? `@oli-obk`

2 years agoRemove `PartialOrd`/`Ord` impl for `PlaceRef`
Aaron Hill [Tue, 10 May 2022 02:48:43 +0000 (22:48 -0400)]
Remove `PartialOrd`/`Ord` impl for `PlaceRef`

This is a new attempt at #93315. It removes one usage
of the `Ord` impl for `DefId`, which should make it easier
to eventually remove that impl.

2 years agoAuto merge of #96220 - RalfJung:scalar-no-padding, r=oli-obk
bors [Wed, 11 May 2022 18:34:14 +0000 (18:34 +0000)]
Auto merge of #96220 - RalfJung:scalar-no-padding, r=oli-obk

tighten sanity checks around Scalar and ScalarPair

While investigating https://github.com/rust-lang/rust/issues/96185 I noticed codegen has tighter sanity checks here than Miri does, so I added some more assertions. Strangely, some of them fail, so I also needed to add a HACK... that is probably worth looking into.

This does not fix that issue, but it changes the ICE messages, making it quite clear that we have a scalar whose size is not the same as that of the surrounding layout.

r? `@oli-obk`

2 years agoBless clippy.
Camille GILLOT [Wed, 11 May 2022 16:51:14 +0000 (18:51 +0200)]
Bless clippy.

2 years agoAdd test of matches macro for trailing commas
ludfo774 [Wed, 11 May 2022 14:42:16 +0000 (16:42 +0200)]
Add test of matches macro for trailing commas

2 years agoAuto merge of #96942 - Dylan-DPC:rollup-p8bcly2, r=Dylan-DPC
bors [Wed, 11 May 2022 13:47:38 +0000 (13:47 +0000)]
Auto merge of #96942 - Dylan-DPC:rollup-p8bcly2, r=Dylan-DPC

Rollup of 4 pull requests

Successful merges:

 - #91518 (Add readable rustdoc display for RISC-V target)
 - #95281 (Fix inaccurate function name in `rustc_const_eval` docs)
 - #96898 (logging: add env var to control verbose scope entry/exit logging)
 - #96936 (:arrow_up: rust-analyzer)

Failed merges:

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

2 years agoHandleOrNull can hold null, and HandleOrInvalid can hold INVALID_HANDLE_VALUE.
Dan Gohman [Wed, 11 May 2022 13:36:54 +0000 (06:36 -0700)]
HandleOrNull can hold null, and HandleOrInvalid can hold INVALID_HANDLE_VALUE.

2 years agoRollup merge of #96936 - lnicola:rust-analyzer-2022-05-11, r=lnicola
Dylan DPC [Wed, 11 May 2022 11:49:30 +0000 (13:49 +0200)]
Rollup merge of #96936 - lnicola:rust-analyzer-2022-05-11, r=lnicola

:arrow_up: rust-analyzer

r? `@ghost`

2 years agoRollup merge of #96898 - RalfJung:interpret-pop-debug, r=oli-obk
Dylan DPC [Wed, 11 May 2022 11:49:29 +0000 (13:49 +0200)]
Rollup merge of #96898 - RalfJung:interpret-pop-debug, r=oli-obk

logging: add env var to control verbose scope entry/exit logging

~~This got removed in https://github.com/rust-lang/rust/pull/75143, and I find this makes long traces a lot harder to read, so I propose we add this back.~~

Example trace:
```
│ │ ├─0ms  INFO rustc_const_eval::interpret::step return
│ │ ├─0ms  INFO rustc_const_eval::interpret::eval_context popping stack frame (returning from function)
│ │┌┘rustc_const_eval::interpret::eval_context::frame std::ptr::mut_ptr::<impl *mut u8>::guaranteed_eq
│ ├┘rustc_const_eval::interpret::eval_context::frame std::ptr::mut_ptr::<impl *mut u8>::is_null
│ ├─1ms  INFO rustc_const_eval::interpret::step // executing bb2
│ ├─1ms  INFO rustc_const_eval::interpret::step StorageDead(_4)
│ ├─1ms  INFO rustc_const_eval::interpret::step StorageDead(_2)
│ ├─1ms  INFO rustc_const_eval::interpret::step return
│ ├─1ms  INFO rustc_const_eval::interpret::eval_context popping stack frame (returning from function)
│┌┘rustc_const_eval::interpret::eval_context::frame std::ptr::mut_ptr::<impl *mut u8>::is_null
├┘rustc_const_eval::interpret::eval_context::frame std::sys_common::thread_local_dtor::register_dtor_fallback::run_dtors
├─178ms  INFO rustc_const_eval::interpret::step // executing bb2
├─178ms  INFO rustc_const_eval::interpret::step StorageDead(_5)

```

r? `@oli-obk`

2 years agoRollup merge of #95281 - pierwill:fix-85513, r=Dylan-DPC
Dylan DPC [Wed, 11 May 2022 11:49:28 +0000 (13:49 +0200)]
Rollup merge of #95281 - pierwill:fix-85513, r=Dylan-DPC

Fix inaccurate function name in `rustc_const_eval` docs

Looks to me like this fixes #85513. I had trouble making a intra-docs link to `eval_place_to_op` work, though...

2 years agoRollup merge of #91518 - luojia65:rustdoc-riscv-arch, r=GuillaumeGomez
Dylan DPC [Wed, 11 May 2022 11:49:27 +0000 (13:49 +0200)]
Rollup merge of #91518 - luojia65:rustdoc-riscv-arch, r=GuillaumeGomez

Add readable rustdoc display for RISC-V target

This pull request adds a human readable rustdoc display for RISC-V architecture. Target configuration marked as `#[cfg(target_arch = "riscv32")]` or `#[cfg(target_arch = "riscv64")]` are pretty formatted like `RISC-V RV32` and `RISC-V RV64` in Rust docs.

Before:

![图片](https://user-images.githubusercontent.com/40385009/152681944-58d758ae-ac4f-412b-b70c-1e673a2a071e.png)

After:

![图片](https://user-images.githubusercontent.com/40385009/152681923-91d5fe75-c3b2-4ac2-865c-54eac0aefe8d.png)

2 years agoavoid computing Scalar size/align in debug builds
Ralf Jung [Wed, 11 May 2022 11:32:19 +0000 (13:32 +0200)]
avoid computing Scalar size/align in debug builds

2 years agoAuto merge of #96924 - petrochenkov:nonon, r=nnethercote
bors [Wed, 11 May 2022 11:06:49 +0000 (11:06 +0000)]
Auto merge of #96924 - petrochenkov:nonon, r=nnethercote

ast: Introduce some traits to get AST node properties generically

And use them to avoid constructing some artificial `Nonterminal` tokens during expansion
r? `@nnethercote` `@Aaron1011`

2 years agostop suggesting non-existing fully qualified paths
Takayuki Maeda [Wed, 11 May 2022 10:18:02 +0000 (19:18 +0900)]
stop suggesting non-existing fully qualified paths

2 years agoast: Introduce some traits to get AST node properties generically
Vadim Petrochenkov [Sun, 1 May 2022 17:58:24 +0000 (20:58 +0300)]
ast: Introduce some traits to get AST node properties generically

And use them to avoid constructing some artificial `Nonterminal` tokens during expansion

2 years agoEnsure that the settings CSS is loaded on the settings page
Guillaume Gomez [Wed, 11 May 2022 09:29:21 +0000 (11:29 +0200)]
Ensure that the settings CSS is loaded on the settings page

2 years agoRemove unused CSS settings rules
Guillaume Gomez [Wed, 11 May 2022 09:27:13 +0000 (11:27 +0200)]
Remove unused CSS settings rules