Commit Graph

291081 Commits

Author SHA1 Message Date
Jacob Pratt
eeb4fa406c Rollup merge of #141638 - oli-obk:builtin-index, r=lcnr
Use `builtin_index` instead of hand-rolling it

Just using the dedicated method more
2025-05-29 04:49:42 +02:00
Jacob Pratt
d3a69636c9 Rollup merge of #141638 - oli-obk:builtin-index, r=lcnr
Use `builtin_index` instead of hand-rolling it

Just using the dedicated method more
2025-05-29 04:49:42 +02:00
Jacob Pratt
1c46b4a4a9 Rollup merge of #141612 - jhpratt:phantom-docs, r=tgross35
Call out possibility of invariant result in variance markers

ref https://github.com/rust-lang/rust/issues/135806#issuecomment-2766191535
2025-05-29 04:49:42 +02:00
Jacob Pratt
6bf4224f68 Rollup merge of #141533 - RalfJung:rintf, r=bjorn3
clean up old rintf leftovers

As usual stdarch needed special treatment due to https://github.com/rust-lang/stdarch/issues/1655, and apparently I forgot to clean up these leftovers here. They can be removed now.
2025-05-29 04:49:41 +02:00
Jacob Pratt
ffdd3b16dc Rollup merge of #141477 - tshepang:patch-1, r=ChrisDenton
Path::with_extension: show that it adds an extension where one did no…

…t exist

I think the times I encountered this, I had to check first if files without extensions were added, since all examples only had files with existing extensions.

Also, this replaced example already has a similar example below.
2025-05-29 04:49:41 +02:00
Jacob Pratt
d9ed86729b Rollup merge of #141104 - PaulDance:fix-win7-test_eq_windows_file_type, r=ChrisDenton
Test(fs): Fix `test_eq_windows_file_type` for Windows 7

Would otherwise fail on:

```
thread 'fs::tests::test_eq_windows_file_type' panicked at library/std/src/test_helpers.rs:53:20:
called `Result::unwrap()` on an `Err` value: Os { code: 5, kind: PermissionDenied, message: "Access is denied." }
```

This came from the read-only attribute set on the test file. In order to fix this, instead of simply disabling the test, the attribute is reset before the test's end so it may still run successfully.

`@rustbot` label T-libs A-filesystem A-testsuite O-windows-7 O-windows-msvc
2025-05-29 04:49:40 +02:00
Jacob Pratt
394fde04a8 Rollup merge of #138139 - xizheyin:issue-137384, r=ChrisDenton
Emit warning while outputs is not exe and prints linkage info

cc #137384

```bash
$ rustc +stage1 /dev/null --print native-static-libs --crate-type staticlib  --emit metadata
warning: skipping link step due to conflict: cannot output linkage information without emitting executable

note: consider emitting executable to print link information

warning: 1 warning emitted
```
2025-05-29 04:49:40 +02:00
Jacob Pratt
d3c605a051 Rollup merge of #136429 - fmease:gci-fix-def-site-checks, r=BoxyUwU
GCI: At their def site, actually wfcheck the where-clause & always eval free lifetime-generic constants

* 1st commit: Partially addresses [#136204](https://github.com/rust-lang/rust/issues/136204) by turning const eval errors from post to pre-mono for free lifetime-generic constants.
  * As the linked issue/comment states, on master there's a difference between `const _: () = panic!();` (pre-mono error) and `const _<'a>: () = panic!();` (post-mono error) which feels wrong.
  * With this PR, both become pre-mono ones!
* 2nd commit: Oof, yeah, I missed that in the initial impl!

This doesn't fully address #136204 because I still haven't figured out how & where to properly & best suppress const eval of free constants whose predicates don't hold at the def site. The motivating example is `const _UNUSED: () = () where for<'_delay> String: Copy;` which can also be found over at the tracking issue #113521.

r? compiler-errors or reassign
2025-05-29 04:49:39 +02:00
bors
5f025f363d Auto merge of #141581 - lcnr:fold-clauses, r=compiler-errors
add additional `TypeFlags` fast paths

Some crates, e.g. `diesel`, have items with a lot of where-clauses (more than 150). In these cases checking the `TypeFlags` of the whole `param_env` can be very beneficial.

This adds `fn fold_clauses` to mirror the existing `fn visit_clauses` and then uses this in folders which fold `ParamEnv`s.

Split out from rust-lang/rust#141451, depends on rust-lang/rust#141442.

r? `@compiler-errors`
2025-05-29 02:29:01 +00:00
WANG Rui
b2858f3132 Add loongarch64 with d feature to f32::midpoint fast path
This patch enables the optimized implementation of `f32::midpoint` for
`loongarch64` targets that support the `d`feature. Targets with reliable
64-bit float support can safely use the faster and more accurate computation
via `f64`, avoiding the fallback branchy version.
2025-05-29 09:30:25 +08:00
Orson Peters
aff29df28e Remove unneeded feature 2025-05-29 02:48:57 +02:00
Orson Peters
22c5e1d686 Add test 2025-05-29 02:47:23 +02:00
bors
ebe9b00602 Auto merge of #141693 - lnicola:sync-from-ra, r=lnicola
Subtree update of `rust-analyzer`

r? `@ghost`
2025-05-28 23:05:24 +00:00
许杰友 Jieyou Xu (Joe)
f3cca6a281 Merge pull request #2420 from rust-lang/aDotInTheVoid-patch-1
directives.md: Fix `//@ build_aux_docs` -> `//@ build-aux-docs`
2025-05-29 05:04:46 +08:00
许杰友 Jieyou Xu (Joe)
c3dc77f4d1 Merge pull request #2421 from aDotInTheVoid/slashslashat
Fix some old `// <directive>` to `//@ <directive>`
2025-05-29 05:03:49 +08:00
Ralf Jung
a387c86a92 get rid of rustc_codegen_ssa::common::AtomicOrdering 2025-05-28 22:57:55 +02:00
Ralf Jung
4794ea176b atomic_load intrinsic: use const generic parameter for ordering 2025-05-28 22:57:55 +02:00
bjorn3
865c7b9c78 Remove unused arg_memory_ty method 2025-05-28 20:55:00 +00:00
bjorn3
f0707fad31 Mark all optimize methods and the codegen method as safe
There is no safety contract and I don't think any of them can actually
cause UB in more ways than passing malicious source code to rustc can.
While LtoModuleCodegen::optimize says that the returned ModuleCodegen
points into the LTO module, the LTO module has already been dropped by
the time this function returns, so if the returned ModuleCodegen indeed
points into the LTO module, we would have seen crashes on every LTO
compilation, which we don't. As such the comment is outdated.
2025-05-28 20:55:00 +00:00
bjorn3
d7c0bde0c1 Remove methods from StaticCodegenMethods that are not called in cg_ssa itself 2025-05-28 20:55:00 +00:00
bjorn3
669e2ea848 Make predefine methods take &mut self 2025-05-28 20:55:00 +00:00
bjorn3
0809b41cd9 Move supports_parallel from CodegenBackend to ExtraBackendMethods
It is only relevant when using cg_ssa for driving compilation.
2025-05-28 20:55:00 +00:00
bjorn3
0fd257d66c Remove a couple of uses of interior mutability around statics 2025-05-28 20:55:00 +00:00
bjorn3
a4cb1c72c5 Reduce amount of types that need to be PartialEq 2025-05-28 20:55:00 +00:00
bjorn3
5b0ab2cbdd The personality function is a Function, not a Value 2025-05-28 20:55:00 +00:00
bjorn3
c593c01703 Remove codegen_unit from MiscCodegenMethods 2025-05-28 20:55:00 +00:00
Guillaume Gomez
9e5dd51166 Remove checks that are run with tidy 2025-05-28 22:37:08 +02:00
Guillaume Gomez
0527f027e8 Add eslint as part of tidy run 2025-05-28 22:37:08 +02:00
Alona Enraght-Moony
ea6238e1d0 Fix some old // <directive> to //@ <directive> 2025-05-28 20:32:56 +01:00
Alona Enraght-Moony
084e8d9db1 directives.md: Fix //@ build_aux_docs -> //@ build-aux-docs 2025-05-28 20:18:56 +01:00
Eric Holk
9f2ee0f4fb Add eholk to compiler reviewer rotation
Now that we have work queue limits on triagebot, I'm happy to share some
of the review load.
2025-05-28 11:30:18 -07:00
bors
6f69710780 Auto merge of #141696 - tgross35:rollup-fhpj180, r=tgross35
Rollup of 7 pull requests

Successful merges:

 - rust-lang/rust#140369 (Add data_ptr method to Mutex and RwLock)
 - rust-lang/rust#140697 (Split `autodiff` into `autodiff_forward` and `autodiff_reverse`)
 - rust-lang/rust#141404 (Improve intrinsic handling in cg_ssa)
 - rust-lang/rust#141411 (rustdoc: linking to a local proc macro no longer warns)
 - rust-lang/rust#141548 (consider glob imports in cfg suggestion)
 - rust-lang/rust#141627 (Drop-build cleanups)
 - rust-lang/rust#141670 (Fix ICE in tokenstream with contracts from parser recovery)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-05-28 17:32:45 +00:00
Ralf Jung
5a38c32c6d Merge pull request #4354 from RalfJung/before_stack_pop
fix comment in before_stack_pop
2025-05-28 16:46:10 +00:00
Jason Newcomb
beaf15532a while_let_loop: Include let assignment in suggestion (#14756)
Placeholders are still given for the content of the whole block.
However, if the result of the original `if let` or `match` expression
was assigned, the assignment is reflected in the suggestion.

No-op assignments (`let x = x;`) are skipped though, unless they contain
an explicit type which might help the compiler (`let x: u32 = x;` is
kept).

Closes rust-lang/rust-clippy#362

changelog: [`while_let_loop`]: include `let` assignment in suggestion
2025-05-28 16:26:14 +00:00
Ralf Jung
6b8a92201e fix comment in before_stack_pop 2025-05-28 18:18:39 +02:00
Samuel Tardieu
b90880d408 Optimize unit_return_expecting_ord (#14905)
This lint was previously written very clumsily, not short-circuiting and
doing a lot of unnecessary work.

Now it makes sure to do the cheaper functions earlier and in general, is
just smarter.
(I specifically focused on minimizing binder instantiation

Sadly, I'm not finding any relevant result in a benchmark. Still with
the LLVM coverage instruments, the expensive bits are called lots of
less times (The binder instantiation that I care about is reduced from
95k to 10k throughout our test suite).

changelog:[`unit_return_expecting_ord`]: Optimize the lint
2025-05-28 16:05:48 +00:00
blyxyas
7e590de435 Optimize unit_return_expecting_ord
This lint was previously written very clumsily, not
shortcircuiting and doing a lot of unnecessary work.

Now it makes sure to do the cheaper functions earlier
and in general, just be smarter.
(I specifically focused on minimizing binder instantiation)

Also, avoid allocating unnecessarily
2025-05-28 18:00:16 +02:00
Orson Peters
9ffbc62cb6 When replacing an old value we may not drop it in place 2025-05-28 17:53:14 +02:00
Alejandra González
3a1159ed9f needless_return: look inside else if parts as well (#14798)
`if` expressions don't necessarily contain a block in the `else` part in
the presence of an `else if`. The `else` part, if present, must be
handled as a regular expression, not necessarily as a block expression.

Found while applying Clippy to triagebot and looking at the result. This
also found an issue in Clippy itself.

changelog: [`needless_return`]: look inside `else if` parts as well
2025-05-28 15:42:03 +00:00
Philipp Krones
291b8fd3be [book] fix the trait checking example code (#14908)
Fix the argument in the example for "Trait Checking".

changelog: none
2025-05-28 15:41:03 +00:00
Alejandra González
a31d3b0fc4 Mark myself as on vacation until June 30 (#14909)
https://rust-lang.zulipchat.com/#narrow/channel/257328-clippy/topic/Outside.20rotation.20until.20June.2030/with/520912074

changelog: none
2025-05-28 15:27:29 +00:00
vremyavnikuda
430f75a818 docs:deleting duplicate documentation 2025-05-28 22:17:29 +07:00
Orson Peters
8785f7b122 Add same unsafe bound on get_or_init_slow 2025-05-28 17:10:50 +02:00
Patrick-6
8237107d88 Add comments to diagnostic items 2025-05-28 17:05:45 +02:00
Mu001999
419897c132 Add cfg for FormatShortCmd 2025-05-28 23:00:27 +08:00
Orson Peters
13bce27e37 Do not panic, maintain old behavior 2025-05-28 16:56:26 +02:00
blyxyas
854a0b65b0 Mark myself as on vacation until June 30 2025-05-28 16:49:46 +02:00
Kazuki Obata
402fc8105b Update trait_checking.md 2025-05-28 23:37:31 +09:00
Trevor Gross
d6b1108cda Rollup merge of #141670 - chenyukang:yukang-fix-ice-from-contracts, r=nnethercote
Fix ICE in tokenstream with contracts from parser recovery

Fixes rust-lang/rust#140683

After two times of parsing error, the `recover_stmt_` constructs an error ast, then when we expand macors, the invalid tokenstream triggered ICE because of mismatched delims.

Expected `{` and get other tokens is an obvious error message, too much effort on recovery may introduce noise.

r? ```@nnethercote```
2025-05-28 10:28:11 -04:00
Trevor Gross
97f6e6e8ba Rollup merge of #141627 - nnethercote:drop-cleanups, r=matthewjasper
Drop-build cleanups

Some cleanups I made while trying to speed up the program in rust-lang/rust#134404.

r? ```@matthewjasper```
2025-05-28 10:28:11 -04:00