Commit Graph

232194 Commits

Author SHA1 Message Date
WANG Rui 126f4abd8b tests: Fix tests for LoongArch64 2023-08-18 14:56:53 +08:00
bors fe3eae3f31 Auto merge of #114938 - flip1995:clippy_backport, r=matthiaskrgr
Clippy backport

r? `@Manishearth`

This is the accompanying PR to https://github.com/rust-lang/rust/pull/114937. This needs to be merged before tomorrow, so that it gets into master, before beta is branched.

The second commit is pretty much an out-of cycle sync, so that we don't get backport-debt for next release cycle right away.

cc `@Mark-Simulacrum` also mentioning you here, to make sure this is included in the beta branching.
2023-08-18 02:06:50 +00:00
bors 9b4119009e Auto merge of #114951 - cuviper:rollup-iitoep5, r=cuviper
Rollup of 5 pull requests

Successful merges:

 - #113715 (Unstable Book: update `lang_items` page and split it)
 - #114897 (Partially revert #107200)
 - #114913 (Fix suggestion for attempting to define a string with single quotes)
 - #114931 (Revert PR #114052 to fix invalid suggestion)
 - #114944 (update `thiserror` to version >= 1.0.46)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-08-18 00:12:59 +00:00
Josh Stone df877c0353
Rollup merge of #114944 - lqd:fix-thiserror, r=RalfJung
update `thiserror` to version >= 1.0.46

1.0.46 version is the one with [the workaround](https://github.com/dtolnay/thiserror/pull/248) for #114839. I'm also encountering this issue, so let's update the dependency so that everyone doesn't have to `./x clean`.

Fixes #114839.

r? `@RalfJung`
2023-08-17 15:40:09 -07:00
Josh Stone 5861815559
Rollup merge of #114931 - Urgau:revert-114052, r=compiler-errors
Revert PR #114052 to fix invalid suggestion

This PR reverts https://github.com/rust-lang/rust/pull/114052 to fix the invalid suggestion produced by the PR.

Unfortunately the invalid suggestion cannot be improved from the current position where it's emitted since we lack enough information (is an assignment?, left or right?, ...) to be able to fix it here. Furthermore the previous wasn't wrong, just suboptimal, contrary to the current one which is just wrong.

Added a regression test and commented out some code instead of removing it so we can use it later.

Reopens https://github.com/rust-lang/rust/issues/114050
Fixes https://github.com/rust-lang/rust/issues/114925
2023-08-17 15:40:09 -07:00
Josh Stone 7ea4de9632
Rollup merge of #114913 - beetrees:escape-double-quote, r=davidtwco
Fix suggestion for attempting to define a string with single quotes

Currently attempting to compile `fn main() { let _ = '\\"'; }` will result in the following error message:
```
error: character literal may only contain one codepoint
 --> src/main.rs:1:21
  |
1 | fn main() { let _ = '\\"'; }
  |                     ^^^^^
  |
help: if you meant to write a `str` literal, use double quotes
  |
1 | fn main() { let _ = "\\""; }
  |                     ~~~~~
```
The suggestion is invalid as it fails to escape the `"`. This PR fixes the suggestion so that it now reads:
```
help: if you meant to write a `str` literal, use double quotes
  |
1 | fn main() { let _ = "\\\""; }
  |                     ~~~~~~
```
The relevant test is also updated to ensure that this does not regress in future.
2023-08-17 15:40:09 -07:00
Josh Stone 4f14451d7c
Rollup merge of #114897 - joshtriplett:partial-revert-ok-0, r=m-ou-se
Partially revert #107200

`Ok(0)` is indeed something the caller may interpret as an error, but
that's the *correct* thing to return if the writer can't accept any more
bytes.
2023-08-17 15:40:08 -07:00
Josh Stone cd50556e90
Rollup merge of #113715 - kadiwa4:lang_items_doc, r=JohnTitor
Unstable Book: update `lang_items` page and split it

[`lang_items` rendered](https://github.com/kadiwa4/rust/blob/lang_items_doc/src/doc/unstable-book/src/language-features/lang-items.md), [`start` rendered](https://github.com/kadiwa4/rust/blob/lang_items_doc/src/doc/unstable-book/src/language-features/start.md)
Closes #110274
Rustonomicon PR: rust-lang/nomicon#413, Rust Book PR: rust-lang/book#3705

A lot of information doesn't belong on the `lang_items` page. I added a separate page for the `start` feature and moved some text into the Rustonomicon because the `lang_items` page should not be a tutorial on how to build a `#![no_std]` executable.
The list of existing lang items is too long/unstable, so I removed it.

The doctests still don't work. :(
2023-08-17 15:40:08 -07:00
bors ccc3ac0cae Auto merge of #114904 - cjgillot:no-ref-debuginfo, r=wesleywiser
Remove references in VarDebugInfo

The codegen implementation is broken, and attempted to read uninitialized memory.

Fixes https://github.com/rust-lang/rust/issues/114488
2023-08-17 22:22:06 +00:00
Rémy Rakic df3819bd96 update `thsiserror` to release >= 1.0.46
this version is the one containing the workaround for the provider API
changes on nightly
2023-08-17 19:48:22 +00:00
Camille GILLOT 3798bca605 Bless codegen tests. 2023-08-17 18:28:33 +00:00
bors 0768872680 Auto merge of #114802 - chenyukang:yukang-fix-114979-bad-parens-dyn, r=estebank
Fix bad suggestion when wrong parentheses around a dyn trait

Fixes #114797
2023-08-17 17:54:50 +00:00
Camille GILLOT b542c5526f Bless mir-opt tests. 2023-08-17 17:07:53 +00:00
Camille GILLOT c535326537 Add test. 2023-08-17 17:02:04 +00:00
Camille GILLOT 933b618360 Revert "Implement references VarDebugInfo."
This reverts commit 2ec0071913.
2023-08-17 17:02:04 +00:00
bors ff89efeda2
Auto merge of #11314 - GuillaumeGomez:needless_ref_mut_async_block, r=Centri3
Correctly handle async blocks for NEEDLESS_PASS_BY_REF_MUT

Fixes https://github.com/rust-lang/rust-clippy/issues/11299.

The problem was that the `async block`s are popping a closure which we didn't go into, making it miss the mutable access to the variables.

cc `@Centri3`

changelog: none
2023-08-17 18:06:36 +02:00
bors 09d05c04da
Auto merge of #11070 - y21:issue11065, r=flip1995
[`useless_conversion`]: only lint on paths to fn items and fix FP in macro

Fixes #11065 (which is actually two issues: an ICE and a false positive)

It now makes sure that the function call path points to a function-like item (and not e.g. a `const` like in the linked issue), so that calling `TyCtxt::fn_sig` later in the lint does not ICE (fixes https://github.com/rust-lang/rust-clippy/issues/11065#issuecomment-1616836099).
It *also* makes sure that the expression is not part of a macro call (fixes https://github.com/rust-lang/rust-clippy/issues/11065#issuecomment-1616919639). ~~I'm not sure if there's a better way to check this other than to walk the parent expr chain and see if any of them are expansions.~~ (edit: it doesn't do this anymore)

changelog: [`useless_conversion`]: fix ICE when call receiver is a non-fn item
changelog: [`useless_conversion`]: don't lint if argument is a macro argument (fixes a FP)

r? `@llogiq` (reviewed #10814, which introduced these issues)
2023-08-17 18:06:36 +02:00
bors 4a0402cd80 Auto merge of #114932 - RalfJung:miri, r=RalfJung
update Miri

r? `@ghost`
2023-08-17 14:04:37 +00:00
Urgau 1c73248b67 Revert PR #114052 to fix invalid suggestion 2023-08-17 14:33:33 +02:00
bors bd138e2ae1 Auto merge of #114799 - RalfJung:less-transmute, r=m-ou-se
avoid transmuting Box when we can just cast raw pointers instead

Always better to avoid a transmute, in particular when the layout assumptions it is making are not clearly documented. :)
2023-08-17 09:09:29 +00:00
bors d4a881e143 Auto merge of #114922 - matthiaskrgr:rollup-qktdihi, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #112751 (rustdoc: Fixes with --test-run-directory and relative paths.)
 - #114749 (Update `mpsc::Sender` doc to reflect that it implements `Sync`)
 - #114876 (Don't ICE in `is_trivially_sized` when encountering late-bound self ty)
 - #114881 (clarify CStr lack of layout guarnatees)
 - #114921 (Remove Folyd from librustdoc static files)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-08-17 07:21:53 +00:00
Matthias Krüger 40edd35079
Rollup merge of #114921 - Folyd:Folyd-patch-1, r=compiler-errors
Remove Folyd from librustdoc static files

r?`@GuillaumeGomez`
2023-08-17 08:39:22 +02:00
Matthias Krüger 503a8fc92d
Rollup merge of #114881 - RalfJung:cstr, r=cuviper
clarify CStr lack of layout guarnatees

Follow-up to https://github.com/rust-lang/rust/pull/114800
r? `@cuviper`
2023-08-17 08:39:22 +02:00
Matthias Krüger 084c87dfea
Rollup merge of #114876 - compiler-errors:non-lifetime-binders-sized, r=wesleywiser
Don't ICE in `is_trivially_sized` when encountering late-bound self ty

We can see a bound ty var here:
b531630f42/compiler/rustc_trait_selection/src/traits/query/type_op/prove_predicate.rs (L13-L34)

Fixes #114872
2023-08-17 08:39:21 +02:00
Matthias Krüger f4cd7a537b
Rollup merge of #114749 - gurry:issue-114722, r=thomcc
Update `mpsc::Sender` doc to reflect that it implements `Sync`

Fixes #114722
2023-08-17 08:39:21 +02:00
Matthias Krüger da541088ef
Rollup merge of #112751 - ehuss:persist-test-run-directory, r=jsha
rustdoc: Fixes with --test-run-directory and relative paths.

Fixes #112191
Fixes #112210

This fixes some issues with `--test-run-directory` and its interaction with `--runtool` and `--persist-doctests`. Relative directories don't work with `Command::current_dir` very well because it has platform-specific behavior with relative paths. This fixes it by avoiding the use of relative paths.

This is needed because cargo is switching to use `--test-run-directory`, and it uses relative paths when interacting with rustdoc/rustc.
2023-08-17 08:39:20 +02:00
bors aa864a7622 Auto merge of #114875 - Zalathar:line-numbers, r=ozkanonur
coverage: Anonymize line numbers in `run-coverage` test snapshots

LLVM's coverage reporter always prints line numbers in its coverage reports.

For testing purposes this is slightly inconvenient, because it means that adding or removing a line in a test file causes all subsequent lines in the snapshot to change. That makes it harder to see the actually meaningful changes in the re-blessed snapshot.

---

This change fixes that by adding another normalization pass that replaces all line numbers in the coverage reports with `LL`, which is similar to what UI tests tell the compiler to do when emitting line numbers in error messages.
2023-08-17 05:33:42 +00:00
Folyd 9a3dfd7e92
Remove Folyd from librustdoc static files 2023-08-17 12:24:28 +08:00
bors c5833f1956 Auto merge of #114892 - Zoxc:sharded-cfg-cleanup, r=cjgillot
Remove conditional use of `Sharded` from query caches

`Sharded` is already a zero cost abstraction, so it shouldn't affect the performance of the single thread compiler if LLVM does its job.

r? `@cjgillot`
2023-08-17 01:04:38 +00:00
Zalathar bfb16545a3 coverage: Anonymize line numbers in `run-coverage` test snapshots
This makes the test snapshots less sensitive to lines being added/removed.
2023-08-17 10:03:32 +10:00
bors f3b4c6746a Auto merge of #111555 - cjgillot:elaborate-drops, r=tmiasko
Only run MaybeInitializedPlaces dataflow once to elaborate drops

This pass allows forward dataflow analyses to modify the CFG depending on the dataflow state. This possibility is used for the `MaybeInitializedPlace` analysis in drop elaboration, to skip the dataflow effect of dead unwinds without having to compute dataflow twice.
2023-08-16 23:21:17 +00:00
bors 07438b0928 Auto merge of #108693 - Zoxc:arena-opt-funcs, r=cjgillot
Optimize DroplessArena arena allocation

This optimizes `DroplessArena` allocation by always ensuring that it is aligned to `usize` and adding `grow_and_alloc` and `grow_and_alloc_raw`functions which both grow and allocate, reducing code size.

<table><tr><td rowspan="2">Benchmark</td><td colspan="1"><b>Before</b></th><td colspan="2"><b>After</b></th></tr><tr><td align="right">Time</td><td align="right">Time</td><td align="right">%</th></tr><tr><td>🟣 <b>clap</b>:check</td><td align="right">1.6968s</td><td align="right">1.6887s</td><td align="right"> -0.48%</td></tr><tr><td>🟣 <b>hyper</b>:check</td><td align="right">0.2552s</td><td align="right">0.2551s</td><td align="right"> -0.03%</td></tr><tr><td>🟣 <b>regex</b>:check</td><td align="right">0.9613s</td><td align="right">0.9553s</td><td align="right"> -0.62%</td></tr><tr><td>🟣 <b>syn</b>:check</td><td align="right">1.5402s</td><td align="right">1.5374s</td><td align="right"> -0.18%</td></tr><tr><td>🟣 <b>syntex_syntax</b>:check</td><td align="right">5.9175s</td><td align="right">5.8813s</td><td align="right"> -0.61%</td></tr><tr><td>Total</td><td align="right">10.3710s</td><td align="right">10.3178s</td><td align="right"> -0.51%</td></tr><tr><td>Summary</td><td align="right">1.0000s</td><td align="right">0.9962s</td><td align="right"> -0.38%</td></tr></table>
2023-08-16 21:37:13 +00:00
beetrees 072d8c8bbc
Fix suggestion for attempting to define a string with single quotes 2023-08-16 21:51:57 +01:00
bors 27fb598d51 Auto merge of #114905 - matthiaskrgr:rollup-uxhhr7p, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #113115 (we are migrating to askama)
 - #114784 (Improve `invalid_reference_casting` lint)
 - #114822 (Improve code readability by moving fmt args directly into the string)
 - #114878 (rustc book: make more pleasant to search)
 - #114899 (Add missing Clone/Debug impls to SMIR Trait related tys)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-08-16 19:51:47 +00:00
Camille GILLOT 5b2524eb03 Do not pre-compute reachable blocks. 2023-08-16 19:40:46 +00:00
Camille GILLOT f5e4eb91b7 Use Terminator::edges for backward analysis too. 2023-08-16 19:40:46 +00:00
Camille GILLOT 94c5ea350f Update doc comment. 2023-08-16 18:15:49 +00:00
Camille GILLOT b8fed2f21c Make dataflow const-prop handle_switch_int monotonic. 2023-08-16 18:12:18 +00:00
Camille GILLOT e9990ce89c Only evaluate yield place after resume in liveness. 2023-08-16 18:12:18 +00:00
Camille GILLOT 7ded3409b8 Specify that method only applies statement effects. 2023-08-16 18:12:18 +00:00
Camille GILLOT aa697f599e Rename YieldResumeEffect. 2023-08-16 18:12:18 +00:00
Camille GILLOT 388f6a6413 Make TerminatorEdge plural. 2023-08-16 18:12:18 +00:00
Camille GILLOT 6cf15d4cb5 Rename MaybeUnreachable. 2023-08-16 18:12:18 +00:00
Camille GILLOT f19cd3f2e1 Use TerminatorEdge for dataflow-const-prop. 2023-08-16 18:12:18 +00:00
Camille GILLOT 3acfa092db Only run MaybeInitializedPlaces once for drop elaboration. 2023-08-16 18:12:18 +00:00
Camille GILLOT 5173d85043 Allow apply_terminator_effect to customize edges. 2023-08-16 18:12:17 +00:00
Camille GILLOT 32711b2b4e Introduce MaybeUnreachable. 2023-08-16 18:12:17 +00:00
Camille GILLOT 934a99eb65 Move domain_size to GenKillAnalysis. 2023-08-16 18:12:17 +00:00
Camille GILLOT 8726cbc75f Move initialization dataflow impls into their own module. 2023-08-16 18:12:17 +00:00
Camille GILLOT 760881b29d Create bottom on-the-fly instead of cloning it. 2023-08-16 18:12:17 +00:00