]> git.lizzy.rs Git - rust.git/log
rust.git
21 months agoCleanup some error code explanations
nils [Mon, 3 Oct 2022 06:06:07 +0000 (08:06 +0200)]
Cleanup some error code explanations

E0045: Use a stable non-C ABI instead
E0092: Use an atomic intrinsic that actually exists
E0161: Don't use box_syntax
E0579: Format ranges in the rustfmt style
E0622: Use the rustfmt style
E0743: Remove feature gate as it's not needed

21 months agoAuto merge of #102503 - cuviper:x86-stack-probes, r=nagisa
bors [Mon, 3 Oct 2022 02:09:05 +0000 (02:09 +0000)]
Auto merge of #102503 - cuviper:x86-stack-probes, r=nagisa

Enable inline stack probes on X86 with LLVM 16

The known problems with x86 inline-asm stack probes have been solved on LLVM main (16), so this flips the switch. Anyone using bleeding-edge LLVM with rustc can start testing this, as I have done locally. We'll get more direct rust-ci when LLVM 16 branches and we start our upgrade, and we can always patch or disable it then if we find new problems.

The previous attempt was #77885, reverted in #84708.

21 months agoAuto merge of #102305 - flba-eb:remove_exclude_list, r=Mark-Simulacrum
bors [Sun, 2 Oct 2022 23:47:48 +0000 (23:47 +0000)]
Auto merge of #102305 - flba-eb:remove_exclude_list, r=Mark-Simulacrum

Get rid of exclude-list for Windows-only tests

Main purpose of this change is to get rid of a quite long (and growing) list of excluded targets, while this test should only be useful on Windows (as far as I understand it). The `// only-windows` header seams to implement exactly what we need here.

I don't know why there are some whitespace changes, but `x.py fmt` and `.git/hooks/pre-push` are happy.

21 months agoAuto merge of #100557 - dawnofmidnight:tarball-commit-info, r=Mark-Simulacrum
bors [Sun, 2 Oct 2022 20:55:17 +0000 (20:55 +0000)]
Auto merge of #100557 - dawnofmidnight:tarball-commit-info, r=Mark-Simulacrum

fix: use git-commit-info for version information

Fixes #33286.
Fixes #86587.

This PR changes the current `git-commit-hash` file that `./x.py` dist puts in the `rustc-{version}-src.tar.{x,g}z` to contain the hash, the short hash, and the commit date from which the tarball was created, assuming git was available when it was. It uses this for reading the version so that rustc has all the appropriate metadata.

# Testing

Testing this is kind of a pain. I did it with something like
```sh
./x.py dist # ensure that `ignore-git` is `false` in config.toml
cp ./build/dist/rustc-1.65.0-dev-src.tar.gz ../rustc-1.65.0-dev-src.tar.gz
cd .. && tar -xzf rustc-1.65.0-dev-src && cd rustc-1.65.0-dev-src
./x.py build
```

Then, the output of  `rustc -vV` with the stage1 compiler should have the `commit-hash` and `commit-date` fields filled, rather than be `unknown`. To be completely sure, you can use `rustc --sysroot` with the stdlib that the original `./x.py dist` made, which will require that the metadata matches.

21 months agoAuto merge of #102530 - cuviper:upgrade-i586-gnu, r=pietroalbini
bors [Sun, 2 Oct 2022 18:14:32 +0000 (18:14 +0000)]
Auto merge of #102530 - cuviper:upgrade-i586-gnu, r=pietroalbini

Upgrade dist-i586-gnu-i586-i686-musl to ubuntu:22.04

The system GCC 5 in ubuntu:16.04 will be too old to compile LLVM 16, so
we need an upgrade. To avoid raising the minimum glibc requirements for
`i586-unknown-linux-gnu`, this target is converted to a crosstool-ng
toolchain, *relaxing* it to the same Linux 3.2 / glibc 2.17 minimum we
use elsewhere. The musl targets still use Ubuntu's system toolchain, but
this doesn't have the same compatibility concerns.

21 months agoAuto merge of #102586 - Dylan-DPC:rollup-g107h6z, r=Dylan-DPC
bors [Sun, 2 Oct 2022 15:31:06 +0000 (15:31 +0000)]
Auto merge of #102586 - Dylan-DPC:rollup-g107h6z, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #100451 (Do not panic when a test function returns Result::Err.)
 - #102098 (Use fetch_update in sync::Weak::upgrade)
 - #102538 (Give `def_span` the same SyntaxContext as `span_with_body`.)
 - #102556 (Make `feature(const_btree_len)` implied by `feature(const_btree_new)`)
 - #102566 (Add a known-bug test for #102498)

Failed merges:

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

21 months agoRollup merge of #102566 - compiler-errors:test-102498, r=Mark-Simulacrum
Dylan DPC [Sun, 2 Oct 2022 15:12:22 +0000 (20:42 +0530)]
Rollup merge of #102566 - compiler-errors:test-102498, r=Mark-Simulacrum

Add a known-bug test for #102498

Self-explanatory

21 months agoRollup merge of #102556 - WaffleLapkin:implied_by_btree_new, r=Mark-Simulacrum
Dylan DPC [Sun, 2 Oct 2022 15:12:22 +0000 (20:42 +0530)]
Rollup merge of #102556 - WaffleLapkin:implied_by_btree_new, r=Mark-Simulacrum

Make `feature(const_btree_len)` implied by `feature(const_btree_new)`

...this should fix code that used the old feature that was changed in #102197

cc ```@davidtwco``` it seems like tidy doesn't check `implied_by`, should it?

21 months agoRollup merge of #102538 - cjgillot:def-span-ctxt, r=fee1-dead
Dylan DPC [Sun, 2 Oct 2022 15:12:21 +0000 (20:42 +0530)]
Rollup merge of #102538 - cjgillot:def-span-ctxt, r=fee1-dead

Give `def_span` the same SyntaxContext as `span_with_body`.

https://github.com/rust-lang/rust/issues/102217

I'm not sure how to add a test, since the erroneous span was crafted using a proc macro.
The debug assertion in `def_span` will ensure we have the correct behaviour.

21 months agoRollup merge of #102098 - xfix:weak-upgrade-fetch-update, r=Mark-Simulacrum
Dylan DPC [Sun, 2 Oct 2022 15:12:21 +0000 (20:42 +0530)]
Rollup merge of #102098 - xfix:weak-upgrade-fetch-update, r=Mark-Simulacrum

Use fetch_update in sync::Weak::upgrade

Using `fetch_update` makes it more clear that it's CAS loop then manually implementing one.

21 months agoRollup merge of #100451 - hovinen:no-panic-on-result-err-in-test, r=Mark-Simulacrum
Dylan DPC [Sun, 2 Oct 2022 15:12:20 +0000 (20:42 +0530)]
Rollup merge of #100451 - hovinen:no-panic-on-result-err-in-test, r=Mark-Simulacrum

Do not panic when a test function returns Result::Err.

Rust's test library allows test functions to return a `Result`, so that the test is deemed to have failed if the function returns a `Result::Err` variant. Currently, this works by having `Result` implement the `Termination` trait and asserting in assert_test_result that `Termination::report()` indicates successful completion. This turns a `Result::Err` into a panic, which is caught and unwound in the test library.

This approach is problematic in certain environments where one wishes to save on both binary size and compute resources when running tests by:

 * Compiling all code with `--panic=abort` to avoid having to generate unwinding tables, and
 * Running most tests in-process to avoid the overhead of spawning new processes.

This change removes the intermediate panic step and passes a `Result::Err` directly through to the test runner.

To do this, it modifies `assert_test_result` to return a `Result<(), String>` where the `Err` variant holds what was previously the panic message. It changes the types in the `TestFn` enum to return `Result<(), String>`.

This tries to minimise the changes to benchmark tests, so it calls `unwrap()` on the `Result` returned by `assert_test_result`, effectively keeping the same behaviour as before.

Some questions for reviewers:

 * Does the change to the return types in the enum `TestFn` constitute a breaking change for the library API? Namely, the enum definition is public but the test library indicates that "Currently, not much of this is meant for users" and most of the library API appears to be marked unstable.
 * Is there a way to test this change, i.e., to test that no panic occurs if a test returns `Result::Err`?
 * Is there a shorter, more idiomatic way to fold `Result<Result<T,E>,E>` into a `Result<T,E>` than the `fold_err` function I added?

21 months agoAuto merge of #98354 - camsteffen:is-some-and-by-value, r=m-ou-se
bors [Sun, 2 Oct 2022 12:48:15 +0000 (12:48 +0000)]
Auto merge of #98354 - camsteffen:is-some-and-by-value, r=m-ou-se

Change `is_some_and` to take by value

Consistent with other function-accepting `Option` methods.

Tracking issue: #93050

r? `@m-ou-se`

21 months agoAuto merge of #102548 - nikic:inline-cell-replace, r=scottmcm
bors [Sun, 2 Oct 2022 09:53:07 +0000 (09:53 +0000)]
Auto merge of #102548 - nikic:inline-cell-replace, r=scottmcm

Mark Cell::replace() as #[inline]

Giving this a try based on https://github.com/rust-lang/rust/issues/102539#issuecomment-1264398807.

21 months agoAuto merge of #102535 - scottmcm:optimize-split-at-partition-point, r=thomcc
bors [Sun, 2 Oct 2022 07:11:15 +0000 (07:11 +0000)]
Auto merge of #102535 - scottmcm:optimize-split-at-partition-point, r=thomcc

Tell LLVM that `partition_point` returns a valid fencepost

This was already done for a successful `binary_search`, but this way `partition_point` can get similar optimizations.

Demonstration that nightly can't do this optimization today, and leaves in the panicking path: <https://play.rust-lang.org/?version=nightly&mode=release&edition=2021&gist=e1074cd2faf5f68e49cffd728ded243a>

r? `@thomcc`

21 months agoAdd a known-bug test for #102498
Michael Goulet [Sun, 2 Oct 2022 06:05:45 +0000 (06:05 +0000)]
Add a known-bug test for #102498

21 months agoAuto merge of #102424 - sunfishcode:sunfishcode/hidden-main, r=nagisa
bors [Sun, 2 Oct 2022 04:12:09 +0000 (04:12 +0000)]
Auto merge of #102424 - sunfishcode:sunfishcode/hidden-main, r=nagisa

Declare `main` as visibility hidden on targets that default to hidden.

On targets with `default_hidden_visibility` set, which is currrently just WebAssembly, declare the generated `main` function with visibility hidden. This makes it consistent with clang's WebAssembly target, where `main` is just a user function that gets the same visibility as any other user function, which is hidden on WebAssembly unless explicitly overridden.

This will help simplify use cases which in the future may want to automatically wasm-export all visibility-"default" symbols. `main` isn't intended to be wasm-exported, and marking it hidden prevents it from being wasm-exported in that scenario.

21 months agoAuto merge of #102558 - matthiaskrgr:rollup-0odec1c, r=matthiaskrgr
bors [Sun, 2 Oct 2022 01:29:36 +0000 (01:29 +0000)]
Auto merge of #102558 - matthiaskrgr:rollup-0odec1c, r=matthiaskrgr

Rollup of 6 pull requests

Successful merges:

 - #102195 (Improve the COPYRIGHT file)
 - #102313 (Update docs so that deprecated method points to relevant method)
 - #102353 (Allow passing rustix_use_libc cfg using RUSTFLAGS)
 - #102405 (Remove a FIXME whose code got moved away in #62883.)
 - #102525 (rustdoc: remove orphaned link on array bracket)
 - #102557 (fix issue with x.py setup running into explicit panic)

Failed merges:

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

21 months agoRollup merge of #102557 - Joshument:master, r=jyn514
Matthias Krüger [Sun, 2 Oct 2022 01:16:40 +0000 (03:16 +0200)]
Rollup merge of #102557 - Joshument:master, r=jyn514

fix issue with x.py setup running into explicit panic

Fixes problem with [Issue #102555](https://github.com/rust-lang/rust/issues/102555) causing `x.py` setup to fail. Simply requires `rustfmt` be downloaded a little later.

21 months agoRollup merge of #102525 - notriddle:notriddle/array-link, r=GuillaumeGomez,jsha
Matthias Krüger [Sun, 2 Oct 2022 01:16:39 +0000 (03:16 +0200)]
Rollup merge of #102525 - notriddle:notriddle/array-link, r=GuillaumeGomez,jsha

rustdoc: remove orphaned link on array bracket

This is #98069, but for arrays instead.

For non-generics, this retains links to the array page, but instead of trying to link it all, it only links the length part, which distinguishes arrays from slices.

For generics, the entire thing becomes a link, just like slices.

| Type | Before | After |
|--|--|--|
| u32 | <code>pub fn alpha() -&gt; &amp;'static <a class="primitive" href="http://doc.rust-lang.org/nightly/core/primitive.array.html">[</a><a class="primitive" href="http://doc.rust-lang.org/nightly/core/primitive.u32.html">u32</a><a class="primitive" href="http://doc.rust-lang.org/nightly/core/primitive.array.html">; 1]</a></code> | <code>pub fn alpha() -&gt; &amp;'static [<a class="primitive" href="http://doc.rust-lang.org/nightly/core/primitive.u32.html">u32</a>; <a class="primitive" href="http://doc.rust-lang.org/nightly/core/primitive.array.html">1</a>]</code>
| generic | <code>pub fn beta&lt;T&gt;() -&gt; &amp;'static <a class="primitive" href="http://doc.rust-lang.org/nightly/core/primitive.array.html">[</a>T<a class="primitive" href="http://doc.rust-lang.org/nightly/core/primitive.array.html">; 1]</a></code> | <code>pub fn beta&lt;T&gt;() -&gt; &amp;'static <a class="primitive" href="http://doc.rust-lang.org/nightly/core/primitive.array.html">[T; 1]</a></code>

21 months agoRollup merge of #102405 - hkBst:patch-3, r=Mark-Simulacrum
Matthias Krüger [Sun, 2 Oct 2022 01:16:39 +0000 (03:16 +0200)]
Rollup merge of #102405 - hkBst:patch-3, r=Mark-Simulacrum

Remove a FIXME whose code got moved away in #62883.

Remove a FIXME whose code got moved away in https://github.com/rust-lang/rust/pull/62883.

21 months agoRollup merge of #102353 - bjorn3:allow_rustix_use_libc, r=Mark-Simulacrum
Matthias Krüger [Sun, 2 Oct 2022 01:16:38 +0000 (03:16 +0200)]
Rollup merge of #102353 - bjorn3:allow_rustix_use_libc, r=Mark-Simulacrum

Allow passing rustix_use_libc cfg using RUSTFLAGS

Before this would error with

```
error: unexpected `rustix_use_libc` as condition name
  |
  = note: `-D unexpected-cfgs` implied by `-D warnings`
  = help: was set with `--cfg` but isn't in the `--check-cfg` expected names
```

I'm setting rustix_use_libc when testing bootstrapping rustc with cg_clif as I'm disabling inline asm here.

21 months agoRollup merge of #102313 - anirudh24seven:update_sleep_ms_doc, r=Mark-Simulacrum
Matthias Krüger [Sun, 2 Oct 2022 01:16:38 +0000 (03:16 +0200)]
Rollup merge of #102313 - anirudh24seven:update_sleep_ms_doc, r=Mark-Simulacrum

Update docs so that deprecated method points to relevant method

The docs for the deprecated 'park_timeout_ms' method suggests that the user 'use park_timeout' method instead (at https://doc.rust-lang.org/std/thread/index.html).

Making a similar change so that the docs for the deprecated `sleep_ms` method suggest that the user `use sleep` method instead.

21 months agoRollup merge of #102195 - wesleywiser:copyright2, r=Mark-Simulacrum,joshtriplett
Matthias Krüger [Sun, 2 Oct 2022 01:16:37 +0000 (03:16 +0200)]
Rollup merge of #102195 - wesleywiser:copyright2, r=Mark-Simulacrum,joshtriplett

Improve the COPYRIGHT file

This is a cutdown version of #96784 which doesn't include the apfloat changes. At this point, the other 3 commits in this PR don't seem to be controversial and I'd like to go ahead and get those merged which will leave #96784 with only the more complex apfloat related change.

r? `@Mark-Simulacrum` since you are the reviewer on that PR

cc `@joshtriplett` since you also had feedback in that PR

21 months agofix issue with x.py setup running into explicit panic
Joshument [Sat, 1 Oct 2022 22:51:10 +0000 (18:51 -0400)]
fix issue with x.py setup running into explicit panic

21 months agoMake `feature(const_btree_len)` implied by `feature(const_btree_new)`
Maybe Waffle [Sat, 1 Oct 2022 22:40:04 +0000 (22:40 +0000)]
Make `feature(const_btree_len)` implied by `feature(const_btree_new)`

21 months agoAuto merge of #102193 - ferrocene:pa-remote-test-server-improvements, r=Mark-Simulacrum
bors [Sat, 1 Oct 2022 22:39:59 +0000 (22:39 +0000)]
Auto merge of #102193 - ferrocene:pa-remote-test-server-improvements, r=Mark-Simulacrum

Change argument handling in `remote-test-server` and add new flags

This PR updates `remote-test-server` to add two new flags:

* `--sequential` disables parallel test execution, accepting one connection at the time instead. We need this for Ferrocene as one of our emulators occasionally deadlocks when running multiple tests in parallel.
* `--bind <ip:port>` allows customizing the IP and port `remote-test-server` binds to, rather than using the default value.

While I was changing the flags, and [after chatting on what to do on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/326414-t-infra.2Fbootstrap/topic/remote-test-server.20flags),  I took this opportunity to cleanup argument handling in `remote-test-server`, which is a breaking change:

* The `verbose` argument has been renamed to the `--verbose` flag.
* The `remote` argument has been removed in favor of the `--bind 0.0.0.0:12345` flag. The only thing the argument did was to change the bound IP to 0.0.0.0, which can easily be replicated with `--bind` and also is not secure as our "remote" default.

I'm also open to keep the old arguments with deprecation warnings.

r? `@Mark-Simulacrum`

21 months agomake tidy accept multi-line `rustc_const_unstable` attributes
Maybe Waffle [Sat, 1 Oct 2022 22:26:48 +0000 (22:26 +0000)]
make tidy accept multi-line `rustc_const_unstable` attributes

21 months agofix: use git-commit-info for version information
dawnofmidnight [Wed, 24 Aug 2022 16:36:08 +0000 (12:36 -0400)]
fix: use git-commit-info for version information

This PR adds support for fetching version information from the
`git-commit-info` file when building the compiler from a source tarball.

21 months agoAuto merge of #102236 - cjgillot:compute_lint_levels_by_def, r=oli-obk
bors [Sat, 1 Oct 2022 19:54:55 +0000 (19:54 +0000)]
Auto merge of #102236 - cjgillot:compute_lint_levels_by_def, r=oli-obk

Compute lint levels by definition

Second attempt to https://github.com/rust-lang/rust/pull/101620.

I think that I have removed the perf regression.

21 months agoAuto merge of #102545 - matthiaskrgr:rollup-13i3tc3, r=matthiaskrgr
bors [Sat, 1 Oct 2022 17:11:19 +0000 (17:11 +0000)]
Auto merge of #102545 - matthiaskrgr:rollup-13i3tc3, r=matthiaskrgr

Rollup of 3 pull requests

Successful merges:

 - #101675 (Improve `File::set_times` error handling)
 - #102500 (Remove `expr_parentheses_needed` from `ParseSess`)
 - #102533 (rustdoc: remove unused CSS selector `a.source`)

Failed merges:

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

21 months agoChange feature name to is_some_and
Cameron Steffen [Thu, 23 Jun 2022 18:17:42 +0000 (13:17 -0500)]
Change feature name to is_some_and

21 months agoChange is_some_and to take by value
Cameron Steffen [Tue, 21 Jun 2022 19:27:53 +0000 (14:27 -0500)]
Change is_some_and to take by value

21 months agoMark Cell::replace() as #[inline]
Nikita Popov [Sat, 1 Oct 2022 15:30:54 +0000 (17:30 +0200)]
Mark Cell::replace() as #[inline]

21 months agoRollup merge of #102533 - notriddle:notriddle/a-source, r=Dylan-DPC
Matthias Krüger [Sat, 1 Oct 2022 14:45:05 +0000 (16:45 +0200)]
Rollup merge of #102533 - notriddle:notriddle/a-source, r=Dylan-DPC

rustdoc: remove unused CSS selector `a.source`

The link with this class attribute was removed in https://github.com/rust-lang/rust/commit/4d16de01d0beb84dc4a351022ea5cb587b4ab557#diff-3fe025bd3bd6b48044d0bd8d8c3122de5ecdb1dcd72a9dbe3c24430883595012L1281-R1324

21 months agoRollup merge of #102500 - compiler-errors:parse-sess-cleanup, r=cjgillot
Matthias Krüger [Sat, 1 Oct 2022 14:45:05 +0000 (16:45 +0200)]
Rollup merge of #102500 - compiler-errors:parse-sess-cleanup, r=cjgillot

Remove `expr_parentheses_needed` from `ParseSess`

Not sure why this method needed to exist on `ParseSess`, but we can achieve the same behavior by just inlining it everywhere.

21 months agoRollup merge of #101675 - beetrees:set-times-no-panic, r=joshtriplett
Matthias Krüger [Sat, 1 Oct 2022 14:45:04 +0000 (16:45 +0200)]
Rollup merge of #101675 - beetrees:set-times-no-panic, r=joshtriplett

Improve `File::set_times` error handling

Makes `File::set_times` return an error if the `SystemTime` cannot fit into the required type instead of panicking in `FileTimes::set_{accessed,modified}`. Also makes `File::set_times` return an error on Windows if either of the passed times are `0xFFFF_FFFF_FFFF_FFFF`, as [the documentation for `SetFileTime`](https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-setfiletime) states that this will prevent operations on the file handle from updating the corresponding file time instead of setting the corresponding file time to that value.

Tracking issue: #98245

21 months agoAdd sanity Drop impl.
Camille GILLOT [Sat, 1 Oct 2022 07:49:52 +0000 (09:49 +0200)]
Add sanity Drop impl.

21 months agoAdd FIXME.
Camille GILLOT [Sat, 1 Oct 2022 07:46:39 +0000 (09:46 +0200)]
Add FIXME.

21 months agoUse a SortedMap instead of a VecMap.
Camille GILLOT [Fri, 30 Sep 2022 17:48:55 +0000 (19:48 +0200)]
Use a SortedMap instead of a VecMap.

21 months agoReplace retain with assertion.
Camille GILLOT [Fri, 30 Sep 2022 17:15:57 +0000 (19:15 +0200)]
Replace retain with assertion.

21 months agoAdd fast path without visiting.
Camille GILLOT [Fri, 30 Sep 2022 06:22:50 +0000 (08:22 +0200)]
Add fast path without visiting.

21 months agoSimplify LintLevelsProvider.
Camille GILLOT [Thu, 29 Sep 2022 20:03:54 +0000 (22:03 +0200)]
Simplify LintLevelsProvider.

21 months agoCompute by owner instead of HirId.
Camille GILLOT [Thu, 29 Sep 2022 19:07:06 +0000 (21:07 +0200)]
Compute by owner instead of HirId.

21 months agoDo not fetch HIR node when iterating to find lint.
Camille GILLOT [Thu, 15 Sep 2022 16:39:53 +0000 (18:39 +0200)]
Do not fetch HIR node when iterating to find lint.

21 months agoCorrect Key impl for HirId.
Camille GILLOT [Sat, 10 Sep 2022 09:55:10 +0000 (11:55 +0200)]
Correct Key impl for HirId.

21 months agoAdd FIXME.
Camille GILLOT [Sat, 10 Sep 2022 08:16:27 +0000 (10:16 +0200)]
Add FIXME.

21 months agoComment LintLevelSets.
Camille GILLOT [Sat, 10 Sep 2022 08:14:51 +0000 (10:14 +0200)]
Comment LintLevelSets.

21 months agoMove lint level computation to rustc_middle::lint.
Camille GILLOT [Sat, 24 Sep 2022 14:11:18 +0000 (16:11 +0200)]
Move lint level computation to rustc_middle::lint.

21 months agoReduce visibilities and remove dead code.
Camille GILLOT [Sat, 1 Oct 2022 07:44:21 +0000 (09:44 +0200)]
Reduce visibilities and remove dead code.

21 months agoMove code to rustc_lint.
Camille GILLOT [Sat, 1 Oct 2022 07:41:32 +0000 (09:41 +0200)]
Move code to rustc_lint.

21 months agoAuto merge of #102519 - Alexendoo:format-args-macro-str, r=m-ou-se
bors [Sat, 1 Oct 2022 14:15:29 +0000 (14:15 +0000)]
Auto merge of #102519 - Alexendoo:format-args-macro-str, r=m-ou-se

Fix `format_args` capture for macro expanded format strings

Since #100996 `format_args` capture for macro expanded strings aren't prevented when the span of the expansion points to a string literal, e.g.

```rust
// not a terribly realistic example, but also happens for proc_macros that set
// the span of the output to an input str literal, such as indoc
macro_rules! x {
    ($e:expr) => { $e }
}

fn main() {
    let a = 1;
    println!(x!("{a}"));
}
```

The tests didn't catch it as the span of `concat!()` points to the macro invocation

r? `@m-ou-se`

21 months agoRemove unused tool_name.
Camille GILLOT [Sat, 10 Sep 2022 07:58:35 +0000 (09:58 +0200)]
Remove unused tool_name.

21 months agoCompute `lint_levels` by definition
Deadbeef [Fri, 22 Jul 2022 16:48:36 +0000 (16:48 +0000)]
Compute `lint_levels` by definition

21 months agoAllow query system to recover a HirId.
Camille GILLOT [Fri, 9 Sep 2022 10:05:01 +0000 (12:05 +0200)]
Allow query system to recover a HirId.

21 months agoAuto merge of #101986 - WaffleLapkin:move_lint_note_to_the_bottom, r=estebank
bors [Sat, 1 Oct 2022 10:44:25 +0000 (10:44 +0000)]
Auto merge of #101986 - WaffleLapkin:move_lint_note_to_the_bottom, r=estebank

Move lint level source explanation to the bottom

So, uhhhhh

r? `@estebank`

## User-facing change

"note: `#[warn(...)]` on by default" and such are moved to the bottom of the diagnostic:
```diff
-   = note: `#[warn(unsupported_calling_conventions)]` on by default
   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
   = note: for more information, see issue #87678 <https://github.com/rust-lang/rust/issues/87678>
+   = note: `#[warn(unsupported_calling_conventions)]` on by default
```

Why warning is enabled is the least important thing, so it shouldn't be the first note the user reads, IMO.

## Developer-facing change

`struct_span_lint` and similar methods have a different signature.

Before: `..., impl for<'a> FnOnce(LintDiagnosticBuilder<'a, ()>)`
After: `..., impl Into<DiagnosticMessage>, impl for<'a, 'b> FnOnce(&'b mut DiagnosticBuilder<'a, ()>) -> &'b mut DiagnosticBuilder<'a, ()>`

The reason for this is that `struct_span_lint` needs to edit the diagnostic _after_ `decorate` closure is called. This also makes lint code a little bit nicer in my opinion.

Another option is to use `impl for<'a> FnOnce(LintDiagnosticBuilder<'a, ()>) -> DiagnosticBuilder<'a, ()>` altough I don't _really_ see reasons to do `let lint = lint.build(message)` everywhere.

## Subtle problem

By moving the message outside of the closure (that may not be called if the lint is disabled) `format!(...)` is executed earlier, possibly formatting `Ty` which may call a query that trims paths that crashes the compiler if there were no warnings...

I don't think it's that big of a deal, considering that we move from `format!(...)` to `fluent` (which is lazy by-default) anyway, however this required adding a workaround which is unfortunate.

## P.S.

I'm sorry, I do not how to make this PR smaller/easier to review. Changes to the lint API affect SO MUCH 😢

21 months agoRemove `LintDiagnosticBuilder`
Maybe Waffle [Sun, 18 Sep 2022 17:19:13 +0000 (21:19 +0400)]
Remove `LintDiagnosticBuilder`

21 months ago`ui-fulldeps`: adopt to the new rustc lint API
Maybe Waffle [Thu, 22 Sep 2022 14:25:05 +0000 (18:25 +0400)]
`ui-fulldeps`: adopt to the new rustc lint API

21 months agobless rustdoc-ui
Maybe Waffle [Fri, 23 Sep 2022 18:34:34 +0000 (22:34 +0400)]
bless rustdoc-ui

21 months agobless a miri test
Maybe Waffle [Fri, 23 Sep 2022 09:41:15 +0000 (13:41 +0400)]
bless a miri test

21 months agobless clippy
Maybe Waffle [Thu, 22 Sep 2022 16:04:22 +0000 (20:04 +0400)]
bless clippy

21 months agobless ui tests
Maybe Waffle [Sun, 18 Sep 2022 15:55:36 +0000 (19:55 +0400)]
bless ui tests

21 months agoMove lint level source explanation to the bottom
Maybe Waffle [Sun, 18 Sep 2022 15:47:21 +0000 (19:47 +0400)]
Move lint level source explanation to the bottom

21 months agorustdoc: adopt to the new lint API
Maybe Waffle [Fri, 16 Sep 2022 15:07:20 +0000 (19:07 +0400)]
rustdoc: adopt to the new lint API

21 months agoclippy: adopt to the new lint API
Maybe Waffle [Fri, 16 Sep 2022 15:07:01 +0000 (19:07 +0400)]
clippy: adopt to the new lint API

21 months agoRefactor rustc lint API
Maybe Waffle [Fri, 16 Sep 2022 07:01:02 +0000 (11:01 +0400)]
Refactor rustc lint API

21 months agoGive `def_span` the same SyntaxContext as `span_with_body`.
Camille GILLOT [Sat, 1 Oct 2022 09:25:25 +0000 (11:25 +0200)]
Give `def_span` the same SyntaxContext as `span_with_body`.

21 months agoAuto merge of #102237 - GuillaumeGomez:sidebar-links-color, r=notriddle
bors [Sat, 1 Oct 2022 08:14:25 +0000 (08:14 +0000)]
Auto merge of #102237 - GuillaumeGomez:sidebar-links-color, r=notriddle

Migrate sidebar links color to CSS variables and unify themes with ayu

Part of https://github.com/rust-lang/rust/pull/98460.

This PR does two things:
 1. Migrate more theme CSS rules toward CSS variables.
 2. Remove `a.current` specific colors depending on the kind of the item behind the link. The `ayu` theme was already doing it this way and I think it makes much more sense like this.

You can test it [here](https://rustdoc.crud.net/imperio/sidebar-links-color/lib2/struct.Foo.html) by hovering other module's items in the sidebar (or check the selector `a.current`).

cc `@jsha`
r? `@notriddle`

21 months agoTell LLVM that `partition_point` returns a valid fencepost
Scott McMurray [Sat, 1 Oct 2022 06:39:15 +0000 (23:39 -0700)]
Tell LLVM that `partition_point` returns a valid fencepost

This was already done for a successful `binary_search`, but this way `partition_point` can get similar optimizations.

21 months agorustdoc: remove unused CSS selector `a.source`
Michael Howell [Sat, 1 Oct 2022 05:17:04 +0000 (22:17 -0700)]
rustdoc: remove unused CSS selector `a.source`

The link with this class attribute was removed in
4d16de01d0beb84dc4a351022ea5cb587b4ab557.

21 months agoAuto merge of #102526 - matthiaskrgr:rollup-9o6p98c, r=matthiaskrgr
bors [Sat, 1 Oct 2022 03:56:21 +0000 (03:56 +0000)]
Auto merge of #102526 - matthiaskrgr:rollup-9o6p98c, r=matthiaskrgr

Rollup of 7 pull requests

Successful merges:

 - #102361 (Fix ICE in const_trait check code)
 - #102373 (Flush delayed bugs before codegen)
 - #102483 (create def ids for impl traits during ast lowering)
 - #102490 (Generate synthetic region from `impl` even in closure body within an associated fn)
 - #102492 (Don't lower assoc bindings just to deny them)
 - #102493 (Group together more size assertions.)
 - #102521 (rustdoc: add missing margin to no-docblock methods)

Failed merges:

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

21 months ago`SetFileTime` doesn't allow setting the file time to `0xFFFF_FFFF_FFFF_FFFF`
beetrees [Sat, 10 Sep 2022 10:33:23 +0000 (11:33 +0100)]
`SetFileTime` doesn't allow setting the file time to `0xFFFF_FFFF_FFFF_FFFF`

21 months agoError instead of panicking when setting file times if the passed `SystemTime` doesn...
beetrees [Sat, 10 Sep 2022 10:29:01 +0000 (11:29 +0100)]
Error instead of panicking when setting file times if the passed `SystemTime` doesn't fit into the required type

21 months agoAuto merge of #101969 - reez12g:issue-101306, r=reez12g
bors [Sat, 1 Oct 2022 01:03:35 +0000 (01:03 +0000)]
Auto merge of #101969 - reez12g:issue-101306, r=reez12g

Make fmt downloaded on every invocation of bootstrap

Fixes https://github.com/rust-lang/rust/issues/101306

21 months agoUpgrade dist-i586-gnu-i586-i686-musl to ubuntu:22.04
Josh Stone [Sat, 1 Oct 2022 00:32:12 +0000 (17:32 -0700)]
Upgrade dist-i586-gnu-i586-i686-musl to ubuntu:22.04

The system GCC 5 in ubuntu:16.04 will be too old to compile LLVM 16, so
we need an upgrade. To avoid raising the minimum glibc requirements for
`i586-unknown-linux-gnu`, this target is converted to a crosstool-ng
toolchain, *relaxing* it to the same Linux 3.2 / glibc 2.17 minimum we
use elsewhere. The musl targets still use Ubuntu's system toolchain, but
this doesn't have the same compatibility concerns.

21 months agoAdd a comment to downloading fmt statement
Rento Ezoe [Fri, 30 Sep 2022 23:06:24 +0000 (08:06 +0900)]
Add a comment to downloading fmt statement

Co-authored-by: Joshua Nelson <github@jyn.dev>
21 months agoAllow `hidden` in src/test/codegen/abi-main-signature-32bit-c-int.rs
Dan Gohman [Fri, 30 Sep 2022 21:55:26 +0000 (14:55 -0700)]
Allow `hidden` in src/test/codegen/abi-main-signature-32bit-c-int.rs

21 months agoRollup merge of #102521 - notriddle:notriddle/impl-items-section, r=GuillaumeGomez
Matthias Krüger [Fri, 30 Sep 2022 21:38:27 +0000 (23:38 +0200)]
Rollup merge of #102521 - notriddle:notriddle/impl-items-section, r=GuillaumeGomez

rustdoc: add missing margin to no-docblock methods

Fixes another regression caused by 8846c0853d8687fda0e5f23f6687b03b243980ee, this time fixing the appearance of methods that have no docblock (we didn't notice this one because libstd docs *always* have docblocks).

See how it looks at https://doc.rust-lang.org/nightly/nightly-rustc/rustdoc/clean/types/enum.Type.html#implementations

<details>

# Before

![image](https://user-images.githubusercontent.com/1593513/193318777-2bc082fb-6579-4bd8-a0e3-d23a32b4820f.png)

# After

![image](https://user-images.githubusercontent.com/1593513/193318968-b6ccacad-940b-4ed3-a0ae-dcf2079c2bae.png)

</details>

See how it looks at https://doc.rust-lang.org/nightly/nightly-rustc/rustdoc/clean/types/trait.AttributesExt.html

<details>

# Before

![image](https://user-images.githubusercontent.com/1593513/193319636-7ff9c99e-0208-462c-99de-7672e92ce4d6.png)

# After

![image](https://user-images.githubusercontent.com/1593513/193322675-403bd165-7394-43e2-8ab4-d1f364666093.png)

</details>

21 months agoRollup merge of #102493 - nnethercote:improve-size-assertions-some-more, r=lqd
Matthias Krüger [Fri, 30 Sep 2022 21:38:27 +0000 (23:38 +0200)]
Rollup merge of #102493 - nnethercote:improve-size-assertions-some-more, r=lqd

Group together more size assertions.

Also add a few more assertions for some relevant token-related types.

And fix an erroneous comment in `rustc_errors`.

r? `@lqd`

21 months agoRollup merge of #102492 - compiler-errors:simplify-deny-assoc-bindings, r=cjgillot
Matthias Krüger [Fri, 30 Sep 2022 21:38:26 +0000 (23:38 +0200)]
Rollup merge of #102492 - compiler-errors:simplify-deny-assoc-bindings, r=cjgillot

Don't lower assoc bindings just to deny them

Some clean-up: https://github.com/rust-lang/rust/pull/102338#discussion_r981590931

21 months agoRollup merge of #102490 - compiler-errors:closure-body-impl-lifetime, r=cjgillot
Matthias Krüger [Fri, 30 Sep 2022 21:38:26 +0000 (23:38 +0200)]
Rollup merge of #102490 - compiler-errors:closure-body-impl-lifetime, r=cjgillot

Generate synthetic region from `impl` even in closure body within an associated fn

Fixes #102209

21 months agoRollup merge of #102483 - spastorino:create-defs-on-lowering, r=cjgillot
Matthias Krüger [Fri, 30 Sep 2022 21:38:25 +0000 (23:38 +0200)]
Rollup merge of #102483 - spastorino:create-defs-on-lowering, r=cjgillot

create def ids for impl traits during ast lowering

r? `@cjgillot`

21 months agoRollup merge of #102373 - Nilstrieb:cannot-get-layout-of-branch-error, r=cjgillot
Matthias Krüger [Fri, 30 Sep 2022 21:38:25 +0000 (23:38 +0200)]
Rollup merge of #102373 - Nilstrieb:cannot-get-layout-of-branch-error, r=cjgillot

Flush delayed bugs before codegen

Sometimes it can happen that invalid code like a TyKind::Error makes its way through the compiler without triggering any errors (this is always a bug in rustc but bugs do happen sometimes :)). These ICEs will manifest in the backend like as cg_llvm not being able to get the layout of `[type error]`, which makes it hard to debug. By flushing before codegen, we display all the delayed bugs, making it easier to trace it to the root of the problem.

I tried this on #102366 and it showed tons of of delayed bugs and no error in cg_llvm, so it seems to be working.

21 months agoRollup merge of #102361 - fee1-dead-contrib:fix-102156, r=eholk
Matthias Krüger [Fri, 30 Sep 2022 21:38:24 +0000 (23:38 +0200)]
Rollup merge of #102361 - fee1-dead-contrib:fix-102156, r=eholk

Fix ICE in const_trait check code

This fixes #102156.

21 months agorustdoc: remove orphaned link on array bracket
Michael Howell [Fri, 30 Sep 2022 21:19:19 +0000 (14:19 -0700)]
rustdoc: remove orphaned link on array bracket

This is 682889fb06591c4245422b73b005c5d8ae2d0cad, but for arrays instead.

For non-generics, this retains links to the array page, but instead of
trying to link it all, it only links the length part, which distinguishes
arrays from slices.

For generics, the entire thing becomes a link, just like slices.

21 months agoGroup together more size assertions.
Nicholas Nethercote [Thu, 29 Sep 2022 23:23:55 +0000 (09:23 +1000)]
Group together more size assertions.

Also add a few more assertions for some relevant token-related types.

And fix an erroneous comment in `rustc_errors`.

21 months agoAuto merge of #102517 - nikic:update-llvm-8, r=cuviper
bors [Fri, 30 Sep 2022 20:41:26 +0000 (20:41 +0000)]
Auto merge of #102517 - nikic:update-llvm-8, r=cuviper

Update LLVM submodule

This merges in the current upstream release/15.x branch.

Fixes #102402.

21 months agoFix typo
nils [Fri, 30 Sep 2022 19:02:53 +0000 (21:02 +0200)]
Fix typo

21 months agorustdoc: update test cases for `<section>` tags in traits
Michael Howell [Fri, 30 Sep 2022 18:17:03 +0000 (11:17 -0700)]
rustdoc: update test cases for `<section>` tags in traits

21 months agocreate def ids for impl traits during ast lowering
Santiago Pastorino [Fri, 30 Sep 2022 13:45:02 +0000 (10:45 -0300)]
create def ids for impl traits during ast lowering

21 months agoUpdate compiler/rustc_interface/src/queries.rs
Camille Gillot [Fri, 30 Sep 2022 17:50:48 +0000 (19:50 +0200)]
Update compiler/rustc_interface/src/queries.rs

21 months agoAuto merge of #102520 - matthiaskrgr:rollup-7nreat0, r=matthiaskrgr
bors [Fri, 30 Sep 2022 17:47:57 +0000 (17:47 +0000)]
Auto merge of #102520 - matthiaskrgr:rollup-7nreat0, r=matthiaskrgr

Rollup of 6 pull requests

Successful merges:

 - #102276 (Added more const_closure functionality)
 - #102382 (Manually order `DefId` on 64-bit big-endian)
 - #102421 (remove the unused :: between trait and type to give user correct diag…)
 - #102495 (Reinstate `hir-stats.rs` test for stage 1.)
 - #102505 (rustdoc: remove no-op CSS `h3.variant, .sub-variant h4 { border-bottom: none }`)
 - #102506 (Specify `DynKind::Dyn`)

Failed merges:

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

21 months agorustdoc: add gui test for no-docblock margins
Michael Howell [Fri, 30 Sep 2022 17:44:15 +0000 (10:44 -0700)]
rustdoc: add gui test for no-docblock margins

21 months agorustdoc: add missing margin to no-docblock trait items
Michael Howell [Fri, 30 Sep 2022 17:15:59 +0000 (10:15 -0700)]
rustdoc: add missing margin to no-docblock trait items

Fixes another regression caused by 8846c0853d8687fda0e5f23f6687b03b243980ee,
this time fixing the appearance of methods that have no docblock (we didn't
notice this one because libstd docs *always* have docblocks).

See how it looks at https://doc.rust-lang.org/nightly/nightly-rustc/rustdoc/clean/types/trait.AttributesExt.html

21 months agoRollup merge of #102506 - TaKO8Ki:specify-dyn-kind, r=lcnr
Matthias Krüger [Fri, 30 Sep 2022 17:06:07 +0000 (19:06 +0200)]
Rollup merge of #102506 - TaKO8Ki:specify-dyn-kind, r=lcnr

Specify `DynKind::Dyn`

ref: https://github.com/rust-lang/rust/pull/101212#discussion_r958861297

21 months agoRollup merge of #102505 - notriddle:sub-variant-h4, r=GuillaumeGomez
Matthias Krüger [Fri, 30 Sep 2022 17:06:06 +0000 (19:06 +0200)]
Rollup merge of #102505 - notriddle:sub-variant-h4, r=GuillaumeGomez

rustdoc: remove no-op CSS `h3.variant, .sub-variant h4 { border-bottom: none }`

This rule, added in 69df43b041f76251391f11264c1ff763ca2a64a0 to override the default `h4` style, has been obsoleted when a65c98fefb78cddee955b87214732b0de30a769f changed it so that only the top docblock put `border-bottom` on `h4.`

21 months agoRollup merge of #102495 - nnethercote:reinstate-hir-stats, r=lqd
Matthias Krüger [Fri, 30 Sep 2022 17:06:06 +0000 (19:06 +0200)]
Rollup merge of #102495 - nnethercote:reinstate-hir-stats, r=lqd

Reinstate `hir-stats.rs` test for stage 1.

It was disabled in #94075 for stage 1 because that PR changed type layouts such that the results for this test were different for stage 1 and stage 2. But now that #94075 is in beta, the results for this test are now the same for stage 1 and stage 2.

r? ```@lqd```

21 months agoRollup merge of #102421 - lyming2007:issue-101866, r=lcnr
Matthias Krüger [Fri, 30 Sep 2022 17:06:05 +0000 (19:06 +0200)]
Rollup merge of #102421 - lyming2007:issue-101866, r=lcnr

remove the unused :: between trait and type to give user correct diag…

…nostic information

modified:   compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs
new file:   src/test/ui/type/issue-101866.rs
new file:   src/test/ui/type/issue-101866.stderr

21 months agoRollup merge of #102382 - cuviper:defid-order, r=fee1-dead
Matthias Krüger [Fri, 30 Sep 2022 17:06:05 +0000 (19:06 +0200)]
Rollup merge of #102382 - cuviper:defid-order, r=fee1-dead

Manually order `DefId` on 64-bit big-endian

`DefId` uses different field orders on 64-bit big-endian vs. others, in
order to optimize its `Hash` implementation. However, that also made it
derive different lexical ordering for `PartialOrd` and `Ord`. That
caused spurious differences wherever `DefId`s are sorted, like the
candidate sources list in `report_method_error`.

Now we manually implement `PartialOrd` and `Ord` on 64-bit big-endian to
match the same lexical ordering as other targets, fixing at least one
test, `src/test/ui/methods/method-ambig-two-traits-cross-crate.rs`.

21 months agoRollup merge of #102276 - ink-feather-org:const_closure_ext, r=fee1-dead
Matthias Krüger [Fri, 30 Sep 2022 17:06:04 +0000 (19:06 +0200)]
Rollup merge of #102276 - ink-feather-org:const_closure_ext, r=fee1-dead

Added more const_closure functionality

Enables ConstFnMutClosure to use a tuple of mutable references instead of just a mutable reference to a tuple.

Removes the new function, since it would barely be usable with this new code.

r? `@fee1-dead`

21 months agorustdoc: add missing margin to no-docblock methods
Michael Howell [Fri, 30 Sep 2022 16:42:07 +0000 (09:42 -0700)]
rustdoc: add missing margin to no-docblock methods

Fixes another regression caused by 8846c0853d8687fda0e5f23f6687b03b243980ee,
this time fixing the appearance of methods that have no docblock (we didn't
notice this one because libstd docs *always* have docblocks).

See how it looks without the fix at https://doc.rust-lang.org/nightly/nightly-rustc/rustdoc/clean/types/enum.Type.html#implementations