Commit Graph

261133 Commits

Author SHA1 Message Date
Matthias Krüger
9db57bf0c9
Rollup merge of #127769 - compiler-errors:ed-2024-dep, r=oli-obk
Don't use implicit features in `Cargo.toml` in `compiler/`

Fixes compiler crates to stop using implicit features (https://github.com/rust-lang/cargo/issues/12826) which are denied in in edition 2024.
2024-07-17 16:22:31 +02:00
Matthias Krüger
23dd3a099c
Rollup merge of #127579 - surechen:fix_127285, r=lcnr
Solve a error `.clone()` suggestion when moving a mutable reference

If the moved value is a mut reference, it is used in a generic function and it's type is a generic param, suggest it can be reborrowed to avoid moving.

for example:

```rust
struct Y(u32);
// x's type is '& mut Y' and it is used in `fn generic<T>(x: T) {}`.
fn generic<T>(x: T) {}
```

fixes #127285
2024-07-17 16:22:29 +02:00
Matthias Krüger
c98487e3be
Rollup merge of #127472 - Zalathar:block-and-unit, r=fmease
MIR building: Stop using `unpack!` for `BlockAnd<()>`

This is a subset of #127416, containing only the parts related to `BlockAnd<()>`.

The first patch removes the non-assigning form of the `unpack!` macro, because it is frustratingly inconsistent with the main form. We can replace it with an ordinary method that discards the `()` and returns the block.

The second patch then finds all of the remaining code that was using `unpack!` with `BlockAnd<()>`, and updates it to use that new method instead.

---

Changes since original review of #127416:
- Renamed `fn unpack_block` → `fn into_block`
- Removed `fn unpack_discard`, replacing it with `let _: BlockAnd<()> = ...` (2 occurrences)
- Tweaked `arm_end_blocks` to unpack earlier and build `Vec<BasicBlock>` instead of `Vec<BlockAnd<()>>`
2024-07-17 16:22:28 +02:00
Matthias Krüger
3ddfd97198
Rollup merge of #127337 - celinval:intrinsics-fallback, r=oli-obk
Move a few intrinsics to Rust abi

Move a few more intrinsic functions to the convention added in #121192. In the second commit, I added documentation about their safety requirements. Let me know if you would like me to move the second commit to a different PR.

Note: I kept the same signature of `pref_align_of`, but I was wondering why this function is considered unsafe?
2024-07-17 16:22:28 +02:00
Matthias Krüger
0472b2a09f
Rollup merge of #127229 - notriddle:notriddle/mile-wide-bar, r=GuillaumeGomez
rustdoc: click target for sidebar items flush left

This change adjusts the clickable area of sidebar links to touch the leftmost edge of the canvas, making them [much easier](https://www.nngroup.com/articles/fitts-law/) to click (when the browser window is maximized or tiled left, but those cases are common enough to matter).

[Screencast from 2024-07-15 15-31-07.webm](https://github.com/user-attachments/assets/1e952d3a-e9e7-476b-b211-44a17c190b38)

<details><summary>old screencast</summary>

[Screencast from 2024-07-01 17-23-34.webm](https://github.com/rust-lang/rust/assets/1593513/dc6f9c2e-5904-403d-b353-d233e6e1afbc)

</details>
2024-07-17 16:22:26 +02:00
Matthias Krüger
2b34490da6
Rollup merge of #125042 - long-long-float:suggest-move-arg-outside, r=fmease
Use ordinal number in argument error

Add an ordinal number to two argument errors ("unexpected" and "missing") for ease of understanding error.

```
error[E0061]: this function takes 3 arguments but 2 arguments were supplied
  --> test.rs:11:5
   |
11 |     f(42, 'a');
   |     ^     --- 2nd argument of type `f32` is missing
   |
(snip)

error[E0061]: this function takes 3 arguments but 4 arguments were supplied
  --> test.rs:12:5
   |
12 |     f(42, 42, 1.0, 'a');
   |     ^   ----
   |         | |
   |         | unexpected 2nd argument of type `{integer}`
   |         help: remove the extra argument
```

To get an ordinal number, I copied `ordinalize` from other crate `rustc_resolve` because I think it is too much to link `rustc_resolve` for this small function. Please let me know if there is a better way.
2024-07-17 16:22:26 +02:00
许杰友 Jieyou Xu (Joe)
d69cc1ccbf tests: update for rfs rename 2024-07-17 13:34:18 +00:00
许杰友 Jieyou Xu (Joe)
1f1bf4c71b run_make_support: use fs internally, but rfs to tests 2024-07-17 13:32:29 +00:00
许杰友 Jieyou Xu (Joe)
a00b860bfc tests: update rustdoc test for renamed assert_dirs_are_equal 2024-07-17 13:32:29 +00:00
许杰友 Jieyou Xu (Joe)
30bdc4a309 run_make_support: rename assert_recursive_eq to assert_dirs_are_equal 2024-07-17 13:32:29 +00:00
许杰友 Jieyou Xu (Joe)
57a2f76557 run_make_support: moved some helpers into string module 2024-07-17 13:32:29 +00:00
许杰友 Jieyou Xu (Joe)
0dfecb3855 run_make_support: move some helpers from assertion to path 2024-07-17 13:32:29 +00:00
许杰友 Jieyou Xu (Joe)
636be91cc0 tests: update for renamed fs module in run_make_support 2024-07-17 13:32:29 +00:00
许杰友 Jieyou Xu (Joe)
e1569fde3e run_make_support: coalesce fs helpers into single fs module
There were *two* `read_dir` helpers, one being a simple
`std::fs::read_dir` wrapper, the other has a different callback-based
signature. We also rename the callback-based `read_dir` as
`read_dir_entries`.

Also don't top-level re-export most `fs::*` helpers.
2024-07-17 13:32:28 +00:00
bors
08cdc2fa1a Auto merge of #127851 - tgross35:rollup-i39um74, r=tgross35
Rollup of 4 pull requests

Successful merges:

 - #127763 (Make more Windows functions `#![deny(unsafe_op_in_unsafe_fn)]`)
 - #127813 (Prevent double reference in generic futex)
 - #127847 (Reviewer on vacation)
 - #127850 (bootstrap: open `llvm-config` as r+w)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-07-17 13:20:54 +00:00
许杰友 Jieyou Xu (Joe)
13a1751061 run_make_support: rename cygpath_windows to get_windows_path and move under external_deps as private 2024-07-17 12:48:23 +00:00
许杰友 Jieyou Xu (Joe)
a443dc4ecd run_make_support: rename env_checked -> env 2024-07-17 12:48:22 +00:00
许杰友 Jieyou Xu (Joe)
b7f7205212 run_make_support: move build_native_static_lib under external_deps
And fix some `ar`-related rebase mishaps.
2024-07-17 12:48:22 +00:00
许杰友 Jieyou Xu (Joe)
aadd08576d run_make_support: make set_host_rpath private and move into util 2024-07-17 12:48:22 +00:00
许杰友 Jieyou Xu (Joe)
e956808c6c run_make_support: move handle_failed_output into util module 2024-07-17 12:48:22 +00:00
许杰友 Jieyou Xu (Joe)
88fd1df017 run_make_support: move assert_recursive_eq into assertion_helpers 2024-07-17 12:48:22 +00:00
许杰友 Jieyou Xu (Joe)
56cbfa8749 tests: update rustdoc test for renamed assert_recursive_eq 2024-07-17 12:48:22 +00:00
许杰友 Jieyou Xu (Joe)
230804dc3a run_make_support: rename recursive_diff to assert_recursive_eq 2024-07-17 12:48:22 +00:00
许杰友 Jieyou Xu (Joe)
f66d3d33e4 run_make_support: move assertions and helpers into own module 2024-07-17 12:48:22 +00:00
许杰友 Jieyou Xu (Joe)
66cef19d11 run_make_support: move run_in_tmpdir and test_while_readonly to scoped_run module 2024-07-17 12:48:22 +00:00
许杰友 Jieyou Xu (Joe)
17212abd1a run_make_support: move fs helpers to own module 2024-07-17 12:48:22 +00:00
许杰友 Jieyou Xu (Joe)
dc9531533c run_make_support: move path-related helpers into own module 2024-07-17 12:48:22 +00:00
许杰友 Jieyou Xu (Joe)
483328d401 run_make_support: move artifact name helpers into artifact_names module 2024-07-17 12:48:22 +00:00
许杰友 Jieyou Xu (Joe)
439c6f60c7 run_make_support: move ar into own module 2024-07-17 12:48:22 +00:00
许杰友 Jieyou Xu (Joe)
f042e72d1e run_make_support: cleanup and document some lib.rs reexports 2024-07-17 12:48:22 +00:00
许杰友 Jieyou Xu (Joe)
288c572745 run_make_support: move external deps to external_deps module 2024-07-17 12:48:21 +00:00
许杰友 Jieyou Xu (Joe)
a02008edac run_make_support: move env_var{,_os} into env_checked module 2024-07-17 12:48:21 +00:00
许杰友 Jieyou Xu (Joe)
544dda3828 run_make_support: move target checks into targets module 2024-07-17 12:48:21 +00:00
许杰友 Jieyou Xu (Joe)
427cf94106 run_make_support: move impl_common_helpers into own macros module 2024-07-17 12:48:21 +00:00
Tobias Bucher
2162f3f34b Mention how you can go from BorrowedFd to OwnedFd and back 2024-07-17 14:34:00 +02:00
Tobias Bucher
538b31e977 Make language around ToOwned for BorrowedFd more precise 2024-07-17 14:33:39 +02:00
Kriskras99
99f879c32f
Document the column numbers for the dbg! macro
The line numbers were also made consistent, some examples used the line numbers as shown on the playground while others used the line numbers that you would expect when just seeing the documentation.
The second option was chosen to make everything consistent.
2024-07-17 14:10:41 +02:00
Ralf Jung
f9c0d3370f ptr::metadata: update comment on vtable_ptr work-around 2024-07-17 13:56:25 +02:00
Zalathar
411fcb6b2d Rename test to pick_test_for_match_pair 2024-07-17 21:50:12 +10:00
Zalathar
03bfa3690e Rename MatchPair to MatchPairTree
In #120904, `MatchPair` became able to store other match pairs as children,
forming a tree. That has made the old name confusing, so this patch renames the
type to `MatchPairTree`.
2024-07-17 21:50:07 +10:00
Ralf Jung
21dc49c587 ptr::metadata: avoid references to extern types 2024-07-17 13:50:01 +02:00
yukang
2c2ef6ce9d add chenyukang to review rotation 2024-07-17 19:12:05 +08:00
yukang
40e07a3ab1 Remove invalid further restricting for type bound 2024-07-17 19:08:37 +08:00
bors
3de0a7c716 Auto merge of #127602 - onur-ozkan:calling-order, r=Kobzol
maintain the given order on step execution

Previously step execution disregarded the CLI order and this change executes the given steps in the order specified on CLI.

For example, running `x $kind a b c` will execute `$kind` step for `a`, then `b`, then `c` crates in the specified order.

Fixes #126165
cc `@matthiaskrgr`
2024-07-17 10:57:17 +00:00
onur-ozkan
4ad753af91 maintain the given order on step execution
Previously step execution disregarded the CLI order and this change executes the given
steps in the order specified on CLI.

For example, running `x $kind a b c` will execute `$kind` step for `a`, then `b`, then `c` crates
in the specified order.

Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-07-17 12:37:36 +03:00
Trevor Gross
f99f61b272
Rollup merge of #127850 - jieyouxu:bootstrap-llvm-config, r=onur-ozkan
bootstrap: open `llvm-config` as r+w

This previously failed on Windows and prevented building on Windows for compiler stuff because the `llvm-config` file was open as read-only.

Tested locally on a Windows machine.

Fixes #127849.
2024-07-17 04:06:01 -05:00
Trevor Gross
5d7466efb8
Rollup merge of #127847 - ChrisDenton:vacation, r=jhpratt
Reviewer on vacation

``@jhpratt`` asked to be set as on vacation
2024-07-17 04:06:00 -05:00
Trevor Gross
599d32414b
Rollup merge of #127813 - ChrisDenton:win-futex, r=joboet
Prevent double reference in generic futex

In the Windows futex implementation we were a little lax at allowing references to references (i.e. `&&`) which can lead to deadlocks due to reading the wrong memory address. This uses a trait to tighten the constraints and ensure this doesn't happen.

r? libs
2024-07-17 04:05:59 -05:00
Trevor Gross
56f95559da
Rollup merge of #127763 - ChrisDenton:safe-unsafe-unsafe, r=tgross35
Make more Windows functions `#![deny(unsafe_op_in_unsafe_fn)]`

As part of #127747, I've evaluated some more Windows functions and added `unsafe` blocks where necessary. Some are just trivial wrappers that "inherit" the full unsafety of their function, but for others I've added some safety comments. A few functions weren't actually unsafe at all. I think they were just using `unsafe fn` to avoid an `unsafe {}` block.

I'm not touching `c.rs` yet because that is partially being addressed by another PR and also I have plans to further reduce the number of wrapper functions we have in there.

r? libs
2024-07-17 04:05:59 -05:00
许杰友 Jieyou Xu (Joe)
3bee50736d bootstrap: open llvm_config as r+w
This previously failed on Windows because the `llvm_config` file was
open as read-only.
2024-07-17 17:00:06 +08:00