Commit Graph

219212 Commits

Author SHA1 Message Date
Mu42
2fe288fd29 emit the suspicious_auto_trait_impls for negative impls as well 2023-03-06 20:04:33 +08:00
Guillaume Gomez
511d2628c0 Update documentation for HTML templates style 2023-03-06 11:38:15 +01:00
Guillaume Gomez
a776c17263 Remove unneeded minus sign in jinja tags 2023-03-06 11:38:15 +01:00
Guillaume Gomez
76714c3731 Update askama version to 0.12 2023-03-06 11:17:11 +01:00
Camille GILLOT
8c0cbd8767 Do not ICE when failing to normalize in ConstProp. 2023-03-06 09:28:49 +00:00
bors
ac4379fea9 Auto merge of #108787 - cjgillot:sroa-lifetime, r=compiler-errors
Erase regions even when failing to normalize type in MIR opts

The first commit just moves the tests around.

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

cc `@saethlin`
2023-03-06 08:31:28 +00:00
bors
8c0f83d773 Auto merge of #108789 - matthiaskrgr:rollup-nyurto8, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #108244 (Add test for semicolon recovery ICE)
 - #108746 (Don't project to RPITIT that has no default value)
 - #108764 (Tweaks to -Zdrop-tracking-mir)
 - #108770 (Improve documentation and argument naming of some TyCtxt methods)
 - #108773 (x fmt: Only check modified files locally)
 - #108775 (Use the correct bound vars in return type suggestion.)
 - #108776 (Make `x test tidy` less noisy)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-03-06 00:43:06 +00:00
clubby789
2632a1c879 Append to PYTHONPATH in compiletest 2023-03-06 00:12:35 +00:00
Scott McMurray
3554036280 Use nuw when calculating slice lengths from Ranges
An `assume` would definitely not be worth it, but since the flag is almost free we might as well tell LLVM this, especially on `_unchecked` calls where there's no obvious way for it to deduce it.

(Today neither safe nor unsafe indexing gets it: <https://rust.godbolt.org/z/G1jYT548s>)
2023-03-05 15:15:22 -08:00
bors
816f958ac3 Auto merge of #108157 - scottmcm:tuple-gt-via-partialcmp, r=dtolnay
Use `partial_cmp` to implement tuple `lt`/`le`/`ge`/`gt`

In today's implementation, `(A, B)::gt` contains calls to *both* `A::eq` *and* `A::gt`.

That's fine for primitives, but for things like `String`s it's kinda weird -- `(String, usize)::gt` has a call to both `bcmp` and `memcmp` (<https://rust.godbolt.org/z/7jbbPMesf>) because when `bcmp` says the `String`s aren't equal, it turns around and calls `memcmp` to find out which one's bigger.

This PR changes the implementation to instead implement `(A, …, C, Z)::gt` using `A::partial_cmp`, `…::partial_cmp`, `C::partial_cmp`, and `Z::gt`.  (And analogously for `lt`, `le`, and `ge`.)  That way expensive comparisons don't need to be repeated.

Technically this is an observable change on stable, so I've marked it `needs-fcp` + `T-libs-api` and will
r? rust-lang/libs-api

I'm hoping that this will be non-controversial, however, since it's very similar to the observable changes that were made to the derives (#81384 #98655) -- like those, this only changes behaviour if a type overrode behaviour in a way inconsistent with the rules for the various traits involved.

(The first commit here is #108156, adding the codegen test, which I used to make sure this doesn't regress behaviour for primitives.)

Zulip conversation about this change: <https://rust-lang.zulipchat.com/#narrow/stream/219381-t-libs/topic/.60.3E.60.20on.20Tuples/near/328392927>.
2023-03-05 22:02:26 +00:00
Camille GILLOT
858eab6391 Do not ICE when casting polymorphic values. 2023-03-05 20:55:32 +00:00
Camille GILLOT
5d7234abb6 Add test. 2023-03-05 20:55:29 +00:00
Matthias Krüger
c08c69b4b1
Rollup merge of #108776 - jyn514:quiet-tidy, r=ozkanonur
Make `x test tidy` less noisy

Before:
```
Building tool tidy (stage0)
    Finished release [optimized + debuginfo] target(s) in 0.29s
fmt check
skip untracked path chrome_profiler.json during rustfmt invocations
skip untracked path query_impl-default,args.mm_profdata during rustfmt invocations
skip untracked path query_impl-llvm.txt during rustfmt invocations
skip untracked path query_impl-mono_items.txt during rustfmt invocations
skip untracked path query_impl-summarize.txt during rustfmt invocations
skip untracked path rustc.svg during rustfmt invocations
skip untracked path rustc_middle.mono_items.json during rustfmt invocations
skip untracked path rustc_middle.mono_items.md during rustfmt invocations
skip untracked path rustc_query_impl.mono_items-thread_local_attr.json during rustfmt invocations
skip untracked path rustc_query_impl.mono_items-thread_local_macro.json during rustfmt invocations
skip untracked path rustc_query_impl.mono_items.md during rustfmt invocations
tidy check
Found 505 error codes
Highest error code: `E0793`
* 397 features
Ensuring the YAML anchors in the GitHub Actions config were expanded
Building tool expand-yaml-anchors (stage0)
    Finished release [optimized + debuginfo] target(s) in 0.14s
Build completed successfully in 0:00:54
```

After:
```
Building tool tidy (stage0)
    Finished release [optimized + debuginfo] target(s) in 2.24s
fmt check
tidy check
Ensuring the YAML anchors in the GitHub Actions config were expanded
Building tool expand-yaml-anchors (stage0)
    Finished release [optimized + debuginfo] target(s) in 0.14s
Build completed successfully in 0:00:04
```
2023-03-05 20:57:23 +01:00
Matthias Krüger
5c49f0885e
Rollup merge of #108775 - cjgillot:issue-107860, r=compiler-errors
Use the correct bound vars in return type suggestion.

Fixes https://github.com/rust-lang/rust/issues/107860
2023-03-05 20:57:23 +01:00
Matthias Krüger
7125df06c3
Rollup merge of #108773 - jyn514:faster-tidy-fmt, r=albertlarsan68
x fmt: Only check modified files locally

Previously, `x fmt` would only format modified files, while `x fmt .` and `x fmt --check` would still look at all files. After this change, `x fmt --check` only looks at modified files locally.

I feel pretty confident in this change - other than https://github.com/rust-lang/rust/issues/106261, no one has reported bugs in `get_modified_rs_files` since it was added in https://github.com/rust-lang/rust/pull/105702.

Combined with the changes in https://github.com/rust-lang/rust/pull/108772, this brings the time for me to run `x t tidy` with a hot FS cache down from 5 to 2 seconds (and moves the majority of the time spent back to `tidy check`, which means it can be sped up more in the future).
2023-03-05 20:57:22 +01:00
Matthias Krüger
970f263156
Rollup merge of #108770 - GuillaumeGomez:improve-doc-and-naming, r=cjgillot
Improve documentation and argument naming of some TyCtxt methods

I got bit by this recently so better prevent others to end up the same as me.
2023-03-05 20:57:22 +01:00
Matthias Krüger
1c2f641e15
Rollup merge of #108764 - cjgillot:dpm-adapt, r=compiler-errors
Tweaks to -Zdrop-tracking-mir

Split from https://github.com/rust-lang/rust/pull/107421

3 commits: 1 diagnostic improvement and 2 ICEs.
2023-03-05 20:57:21 +01:00
Matthias Krüger
b8762321a2
Rollup merge of #108746 - compiler-errors:rpitit-dont-project-default-w-no-valu, r=cjgillot
Don't project to RPITIT that has no default value

Replicates this behavior, but for RPITIT projection logic (which currently is separate)

b1719530f4/compiler/rustc_trait_selection/src/traits/project.rs (L2105-L2115)

Fixes #108738
2023-03-05 20:57:20 +01:00
Matthias Krüger
ced9cd19c8
Rollup merge of #108244 - lukas-code:semicolon-recovery-span, r=cjgillot
Add test for semicolon recovery ICE

closes https://github.com/rust-lang/rust/issues/108242
2023-03-05 20:57:20 +01:00
bors
7820b62d20 Auto merge of #105117 - pitaj:debug_asserts, r=the8472
Add more debug assertions to unsafe functions

related to #51713
2023-03-05 19:35:44 +00:00
Camille GILLOT
708536bb47 Remove -Zverbose. 2023-03-05 19:18:58 +00:00
clubby789
3eeb3fd05a Remove allow(potential_query_instability) from borrowck 2023-03-05 18:59:19 +00:00
Ben Kimock
cb4ebc1453 Check for free regions in MIR validation 2023-03-05 13:46:20 -05:00
Camille GILLOT
fc1a861558 Erase lifetimes in SROA. 2023-03-05 18:35:30 +00:00
Camille GILLOT
248a5301af Move SROA tests. 2023-03-05 18:15:57 +00:00
Antoni Boucher
2c0c25dcc1 Fix for diagnostics 2023-03-05 12:31:16 -05:00
Antoni Boucher
fce7053567 Update gccjit 2023-03-05 12:16:33 -05:00
Antoni Boucher
6bb2af0e6d Merge commit '08a6d6e16b5efe217123e780398969946266268f' into sync-cg_gcc-2023-03-04 2023-03-05 12:03:19 -05:00
bors
73c8d2df7b Auto merge of #108041 - Mark-Simulacrum:relnotes, r=Mark-Simulacrum
Add 1.68.0 release notes

r? `@cuviper`
2023-03-05 16:45:20 +00:00
Camille GILLOT
1e9b58bdf8 Use the correct bound vars in return type suggestion. 2023-03-05 16:08:06 +00:00
Giacomo Pasini
beebd3a4c6
Add regression tests for issue 70919
Desugaring DropAndReplace at MIR build (#107844) fixed issue
70919. Add regressions tests, borrowed from #102078, to ensure we
check for this in the future.

Co-authored-by: Aaron Hill <aa1ronham@gmail.com>
2023-03-05 16:56:57 +01:00
Joshua Nelson
b4a5f4c221 Make x test tidy less noisy
Before:
```
Building tool tidy (stage0)
    Finished release [optimized + debuginfo] target(s) in 0.29s
fmt check
skip untracked path chrome_profiler.json during rustfmt invocations
skip untracked path query_impl-default,args.mm_profdata during rustfmt invocations
skip untracked path query_impl-llvm.txt during rustfmt invocations
skip untracked path query_impl-mono_items.txt during rustfmt invocations
skip untracked path query_impl-summarize.txt during rustfmt invocations
skip untracked path rustc.svg during rustfmt invocations
skip untracked path rustc_middle.mono_items.json during rustfmt invocations
skip untracked path rustc_middle.mono_items.md during rustfmt invocations
skip untracked path rustc_query_impl.mono_items-thread_local_attr.json during rustfmt invocations
skip untracked path rustc_query_impl.mono_items-thread_local_macro.json during rustfmt invocations
skip untracked path rustc_query_impl.mono_items.md during rustfmt invocations
tidy check
Found 505 error codes
Highest error code: `E0793`
* 397 features
Ensuring the YAML anchors in the GitHub Actions config were expanded
Building tool expand-yaml-anchors (stage0)
    Finished release [optimized + debuginfo] target(s) in 0.14s
Build completed successfully in 0:00:54
```

After:
```
Building tool tidy (stage0)
    Finished release [optimized + debuginfo] target(s) in 2.24s
fmt check
tidy check
Ensuring the YAML anchors in the GitHub Actions config were expanded
Building tool expand-yaml-anchors (stage0)
    Finished release [optimized + debuginfo] target(s) in 0.14s
Build completed successfully in 0:00:04
```
2023-03-05 14:49:29 +00:00
Joshua Nelson
8becfed1c9 Remove the option to disable llvm-version-check
We don't support old versions of LLVM; there's no reason to have an easy
way to force bootstrap to use them anyway. If someone really needs to
use an unsupported version, they can modify bootstrap to change the
version range.
2023-03-05 14:42:15 +00:00
Joshua Nelson
339980930d Greatly improve the error messages when run-make/translation fails
Before:
```
LD_LIBRARY_PATH="/home/gh-jyn514/rust/build/aarch64-unknown-linux-gnu/test/run-make/translation/translation:/home/gh-jyn514/rust/build/aarch64-unknown-linux-gnu/stage2/lib:/home/gh-jyn514/rust/build/aarch64-unknown-linux-gnu/stage0-bootstrap-tools/aarch64-unknown-linux-gnu/release/deps:/home/gh-jyn514/rust/build/aarch64-unknown-linux-gnu/stage0/lib" '/home/gh-jyn514/rust/build/aarch64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /home/gh-jyn514/rust/build/aarch64-unknown-linux-gnu/test/run-make/translation/translation -L /home/gh-jyn514/rust/build/aarch64-unknown-linux-gnu/test/run-make/translation/translation  test.rs --sysroot /home/gh-jyn514/rust/build/aarch64-unknown-linux-gnu/test/run-make/translation/translation/fakeroot -Ztranslate-lang=zh-CN 2>&1 | grep "this is a test message"
------------------------------------------
--- stderr -------------------------------
make: *** [Makefile:51: sysroot] Error 1
------------------------------------------

failures:
    [run-make] tests/run-make/translation
```

After:

```
LD_LIBRARY_PATH="/home/gh-jyn514/rust/build/aarch64-unknown-linux-gnu/test/run-make/translation/translation:/home/gh-jyn514/rust/build/aarch64-unknown-linux-gnu/stage2/lib:/home/gh-jyn514/rust/build/aarch64-unknown-linux-gnu/stage0-bootstrap-tools/aarch64-unknown-linux-gnu/release/deps:/home/gh-jyn514/rust/build/aarch64-unknown-linux-gnu/stage0/lib" '/home/gh-jyn514/rust/build/aarch64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /home/gh-jyn514/rust/build/aarch64-unknown-linux-gnu/test/run-make/translation/translation -L /home/gh-jyn514/rust/build/aarch64-unknown-linux-gnu/test/run-make/translation/translation  test.rs --sysroot /home/gh-jyn514/rust/build/aarch64-unknown-linux-gnu/test/run-make/translation/translation/fakeroot -Ztranslate-lang=zh-CN 2>&1 | grep "this is a test message"
[[[ begin stdout ]]]
error: failed to load fluent bundle: failed to add resource: Attempt to override an existing message: "parse_struct_literal_body_without_path".

[[[ end stdout ]]]
Error: cannot match: this is a test message
------------------------------------------
--- stderr -------------------------------
make: *** [Makefile:51: sysroot] Error 1
------------------------------------------

failures:
    [run-make] tests/run-make/translation
```
2023-03-05 14:31:36 +00:00
Joshua Nelson
620efed932 x fmt: Only check modified files locally
Previously, `x fmt` would only format modified files, while `x fmt .`
and `x fmt --check` would still look at all files. After this change, `x
fmt --check` only looks at modified files locally.

I feel pretty confident in this change - other than
https://github.com/rust-lang/rust/issues/106261, no one has reported
bugs in `get_modified_rs_files` since it was added in
https://github.com/rust-lang/rust/pull/105702.
2023-03-05 08:22:55 -06:00
bors
04e957578c Auto merge of #108771 - matthiaskrgr:rollup-whlvo2g, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #106440 (Ignore files in .gitignore in tidy)
 - #108613 (Remove `llvm.skip-rebuild` option)
 - #108616 (Sync codegen defaults with compiler defaults and add a ping message so they stay in sync)
 - #108618 (Rename `src/etc/vscode_settings.json` to `rust_analyzer_settings.json`)
 - #108626 (rustdoc-json: switch from HashMap to FxHashMap to fix non-determinism)
 - #108744 (Don't ICE when encountering bound var in builtin copy/clone bounds)
 - #108749 (Clean up rustdoc-js tester.js file)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-03-05 13:46:04 +00:00
Matthias Krüger
52196169fe
Rollup merge of #108749 - GuillaumeGomez:clean-up-rustdoc-js-tester, r=notriddle
Clean up rustdoc-js tester.js file

A much needed cleanup.

r? `@notriddle`
2023-03-05 14:29:10 +01:00
Matthias Krüger
ec162703dc
Rollup merge of #108744 - compiler-errors:non_lifetime_binders-bad-copy-clone, r=jackh726
Don't ICE when encountering bound var in builtin copy/clone bounds

Fixes #108742
2023-03-05 14:29:10 +01:00
Matthias Krüger
03c1e4d4ff
Rollup merge of #108626 - ozkanonur:consistent-json-docs, r=aDotInTheVoid
rustdoc-json: switch from HashMap to FxHashMap to fix non-determinism

Using `HashMap` in `rustdoc_json_types::Crate` were causing creating randomly ordered objects in the json doc files. Which might cause problems to people who are doing comparison on those files specially in CI pipelines. See https://github.com/rust-lang/rust/issues/103785#issuecomment-1307425590

This PR fixes that issue and extends the coverage of `tests/run-make/rustdoc-verify-output-files` testing ability.
2023-03-05 14:29:09 +01:00
Matthias Krüger
f7bd8afa07
Rollup merge of #108618 - KittyBorgX:master, r=Mark-Simulacrum
Rename `src/etc/vscode_settings.json` to `rust_analyzer_settings.json`

Fixes https://github.com/rust-lang/rust/issues/108614
2023-03-05 14:29:09 +01:00
Matthias Krüger
c86ea5a0ef
Rollup merge of #108616 - jyn514:sync-codegen, r=albertlarsan68
Sync codegen defaults with compiler defaults and add a ping message so they stay in sync

Looks like this got missed in https://github.com/rust-lang/rust/pull/107241.
2023-03-05 14:29:08 +01:00
Matthias Krüger
925baa8b37
Rollup merge of #108613 - jyn514:rm-skip-rebuild, r=Mark-Simulacrum
Remove `llvm.skip-rebuild` option

This was added to in 2019 to speed up rebuild times when LLVM was modified. Now that download-ci-llvm exists, I don't think it makes sense to support an unsound option like this that can lead to miscompiles; and the code cleanup is nice too.

r? `@Mark-Simulacrum` cc `@varkor` #65612
2023-03-05 14:29:08 +01:00
Matthias Krüger
2f8bf34c9c
Rollup merge of #106440 - jyn514:tidy, r=the8472
Ignore files in .gitignore in tidy

- Switch from `walkdir` to `ignore`. This required various changes to make `skip` thread-safe.
- Ignore `build` anywhere in the source tree, not just at the top-level. We support this in bootstrap, we should support it in tidy too.

As a nice side benefit, this also makes tidy a bit faster.

Before:
```
; hyperfine -i '"/home/gh-jyn514/rust2/build/aarch64-unknown-linux-gnu/stage0-tools-bin/rust-tidy" "/home/gh-jyn514/rust2" "/home/gh-jyn514/rust2/build/aarch64-unknown-linux-gnu/stage0/bin/cargo" "/home/gh-jyn514/rust2/build" "32"'
Benchmark 1: "/home/gh-jyn514/rust2/build/aarch64-unknown-linux-gnu/stage0-tools-bin/rust-tidy" "/home/gh-jyn514/rust2" "/home/gh-jyn514/rust2/build/aarch64-unknown-linux-gnu/stage0/bin/cargo" "/home/gh-jyn514/rust2/build" "32"
  Time (mean ± σ):      1.080 s ±  0.008 s    [User: 2.616 s, System: 3.243 s]
  Range (min … max):    1.069 s …  1.099 s    10 runs
```

After:
```
; hyperfine '"/home/gh-jyn514/rust2/build/aarch64-unknown-linux-gnu/stage0-tools-bin/rust-tidy" "/home/gh-jyn514/rust2" "/home/gh-jyn514/rust2/build/aarch64-unknown-linux-gnu/stage0/bin/cargo" "/home/gh-jyn514/rust2/build" "32"'
Benchmark 1: "/home/gh-jyn514/rust2/build/aarch64-unknown-linux-gnu/stage0-tools-bin/rust-tidy" "/home/gh-jyn514/rust2" "/home/gh-jyn514/rust2/build/aarch64-unknown-linux-gnu/stage0/bin/cargo" "/home/gh-jyn514/rust2/build" "32"
  Time (mean ± σ):     705.0 ms ±   1.4 ms    [User: 3179.1 ms, System: 1517.5 ms]
  Range (min … max):   702.3 ms … 706.9 ms    10 runs
```

r? `@the8472`
2023-03-05 14:29:07 +01:00
Lukas Markeffsky
a435b3c0cd add test for https://github.com/rust-lang/rust/issues/108242 2023-03-05 14:23:43 +01:00
Guillaume Gomez
1836fe44b5 Improve documentation and argument naming of some TyCtxt methods 2023-03-05 13:35:13 +01:00
Joshua Nelson
98334f6a2d Don't walk the tests/ directories in checks that always skip it
`WalkBuilder` handles top-level paths differently than `fn walk` used
to: it doesn't run the `skip` function to determine if it should be
skipped, instead assuming the top-level function is always included.

This is a reasonable assumption; adapt our code so it doesn't make
pointless calls to `walk`.
2023-03-05 05:51:23 -06:00
Joshua Nelson
97cffd5295 Reuse allocations between files 2023-03-05 05:44:13 -06:00
Joshua Nelson
1cccf2dd4c Ignore things in .gitignore in tidy
- Switch from `walkdir` to `ignore`. This required various changes to
  make `skip` thread-safe.
- Ignore `build` anywhere in the source tree, not just at the top-level.
  We support this in bootstrap, we should support it in tidy too.

As a nice side benefit, this also makes tidy a bit faster.

Before:
```
; hyperfine -i '"/home/gh-jyn514/rust2/build/aarch64-unknown-linux-gnu/stage0-tools-bin/rust-tidy" "/home/gh-jyn514/rust2" "/home/gh-jyn514/rust2/build/aarch64-unknown-linux-gnu/stage0/bin/cargo" "/home/gh-jyn514/rust2/build" "32"'
Benchmark 1: "/home/gh-jyn514/rust2/build/aarch64-unknown-linux-gnu/stage0-tools-bin/rust-tidy" "/home/gh-jyn514/rust2" "/home/gh-jyn514/rust2/build/aarch64-unknown-linux-gnu/stage0/bin/cargo" "/home/gh-jyn514/rust2/build" "32"
  Time (mean ± σ):      1.080 s ±  0.008 s    [User: 2.616 s, System: 3.243 s]
  Range (min … max):    1.069 s …  1.099 s    10 runs
```

After:
```
; hyperfine '"/home/gh-jyn514/rust2/build/aarch64-unknown-linux-gnu/stage0-tools-bin/rust-tidy" "/home/gh-jyn514/rust2" "/home/gh-jyn514/rust2/build/aarch64-unknown-linux-gnu/stage0/bin/cargo" "/home/gh-jyn514/rust2/build" "32"'
Benchmark 1: "/home/gh-jyn514/rust2/build/aarch64-unknown-linux-gnu/stage0-tools-bin/rust-tidy" "/home/gh-jyn514/rust2" "/home/gh-jyn514/rust2/build/aarch64-unknown-linux-gnu/stage0/bin/cargo" "/home/gh-jyn514/rust2/build" "32"
  Time (mean ± σ):     705.0 ms ±   1.4 ms    [User: 3179.1 ms, System: 1517.5 ms]
  Range (min … max):   702.3 ms … 706.9 ms    10 runs
```
2023-03-05 05:44:13 -06:00
Ali MJ Al-Nasrawy
095b5fae1c bless rustdoc tests 2023-03-05 14:41:35 +03:00
Joshua Nelson
ba0b7af236 Sync codegen defaults with compiler defaults and add a ping message so they stay in sync 2023-03-05 05:16:37 -06:00