34748 Commits

Author SHA1 Message Date
bors
1a2aef4465 Auto merge of #141685 - orlp:inplace-tls-drop, r=joboet
Do not move thread-locals before dropping

Fixes rust-lang/rust#140816. I also (potentially) improved the speed of `get_or_init` a bit by having an explicit hot/cold path.

We still move the value before dropping in the event of a recursive initialization (leading to double-initialization with one value being silently dropped). This is the old behavior, but changing this to panic instead would involve changing tests and also the other OS-specific `thread_local/os.rs` implementation, which is more than I'd like in this PR.
2025-05-31 14:56:33 +00:00
bors
79a2af75f1 Auto merge of #141678 - Kobzol:revert-141516, r=workingjubilee
Revert "increase perf of charsearcher for single ascii characters"

This reverts commit 245bf503e2a948ac98170516d11df632e85a948b (PR https://github.com/rust-lang/rust/pull/141516).

It caused a large `doc` perf. regression in https://github.com/rust-lang/rust/pull/141605.
2025-05-31 08:11:06 +00:00
bors
24c859a875 Auto merge of #141667 - lqd:lazy-maybe-init, r=matthewjasper
Add fast path for maybe-initializedness in liveness

r? `@matthewjasper`

Correct me if I'm wrong Matthew, but my understanding is that
1. `MaybeInitializedPlaces` is currently eagerly computed, in `do_mir_borrowck`
2. but this data is only used in liveness
3. and `liveness::trace` actually only uses it for drop-liveness

This PR moves the computation to `liveness::trace` which looks to be its only use-site. We also add a fast path there, so that it's only computed by drop-liveness.

This is interesting because 1) liveness is only computed for relevant live locals, 2) drop-liveness is only computed for relevant live locals with >0 drop points; 0 is the common case from our benchmarks, as far as I can tell, so even just computing the entire data lazily helps.

It seems possible to also reduce the domain here, and speed up the analysis for the cases where it has to be computed -- so I've left a fixme for that, and may look into it soon.

(I've come upon this while doing implementation work for polonius, so don't be too enamored with possible wins: the goal is to reduce the eventual polonius overhead and make it more palatable 😓)
2025-05-31 04:52:37 +00:00
bors
2e6a357330 Auto merge of #141657 - petrochenkov:nobinroot, r=jieyouxu
bootstrap: Remove `bin_root` from `PATH`

It's not currently load bearing in typical setups on typical targets.
Basically, if it passes the standard CI, then we can remove it, I think.

If someone later reports this breaking the build, then we can address it in a more fine grained way.
E.g. add it to `PATH` last and not first, only on specific targets, and only if specific files are not already found in `PATH` directories.

Fixes [#t-infra/bootstrap > Build broken in MSYS2 @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/326414-t-infra.2Fbootstrap/topic/Build.20broken.20in.20MSYS2/near/520709527)
2025-05-30 18:56:37 +00:00
bors
8d9f1e3fde Auto merge of #139385 - joboet:threadlocal_address, r=nikic
rustc_codegen_llvm: use `threadlocal.address` intrinsic to access TLS

Fixes #136044
r? `@nikic`
2025-05-30 15:39:56 +00:00
bors
7dbe296eaf Auto merge of #141573 - nnethercote:rustdoc-alloc-cleanups, r=camelid
rustdoc: cleanups relating to allocations

These commits generally clean up the code a bit and also reduce allocation rates a bit.

r? `@camelid`
2025-05-30 08:55:18 +00:00
bors
139475be6d Auto merge of #141651 - compiler-errors:less-assert, r=lcnr
Make some assertions in solver into debug assertions

These may or may not be expensive :>

r? lcnr
2025-05-30 02:21:17 +00:00
bors
768ce719e3 Auto merge of #141490 - compiler-errors:bump-pgo, r=Kobzol
Bump rustc-perf and update PGO crates

Updates rustc-perf to rust-lang/rustc-perf@8158f78f73, and updates the crates.

r? `@Kobzol`
2025-05-29 19:42:49 +00:00
bors
73c7293e0e Auto merge of #141595 - bjorn3:rustc_no_sysroot_proc_macro, r=onur-ozkan
Do not get proc_macro from the sysroot in rustc

With the stage0 refactor the proc_macro version found in the sysroot will no longer always match the proc_macro version that proc-macros get compiled with by the rustc executable that uses this proc_macro. This will cause problems as soon as the ABI of the bridge gets changed to implement new features or change the way existing features work.

To fix this, this commit changes rustc crates to depend directly on the local version of proc_macro which will also be used in the sysroot that rustc will build.
2025-05-29 12:07:53 +00:00
bors
15ba5d5254 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
bors
18f6cf7091 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
Lukas Wirth
ed608f592e
Merge pull request #19881 from Veykril/push-wsrmttkymyps
feat: Desugar assist for `let pat = expr?;` -> `let else`
2025-05-28 09:23:27 +00:00
Lukas Wirth
751ca9ec0d feat: Desugar assist for let pat = expr?; -> let else 2025-05-28 11:12:28 +02:00
Lukas Wirth
5900e25edc
Merge pull request #19880 from Veykril/push-xmpxumsrkymk
fix: Handle included files better in IDE layer
2025-05-28 08:49:42 +00:00
Lukas Wirth
26f4af0350
Merge pull request #19872 from ChayimFriedman2/async-fn-output
fix: Fix inference of `AsyncFnX` return type
2025-05-28 08:39:14 +00:00
Lukas Wirth
e72738de99 fix: Handle included files better in IDE layer
This does not fully fix things, but it introduces a function that can be used to fix occurences.
When using `to_def` functionality, the input node needs to come from the macro expanded include, not the real file that was included.
This does unfortunately add more caller burden, but there is not really a way around it.
2025-05-28 10:38:38 +02:00
Lukas Wirth
c44372d06c
Merge pull request #19876 from ShoyuVanilla/layout-padding
feat: Render padding information when hovering on structs
2025-05-28 08:16:38 +00:00
Lukas Wirth
a420ef2b17
Merge pull request #19879 from Veykril/push-mqykxnqtktuw
fix: Fix IDE layer not resolving some macro calls
2025-05-28 05:20:02 +00:00
Shoyu Vanilla
e806957098 feat: Render padding information when hovering on structs 2025-05-28 14:18:50 +09:00
Lukas Wirth
6440fe2a01 Back out "Fix IDE resolution of item macros"
This backs out commit 3e0ab7219a5464999652beca22698cd46e1e48e8.
2025-05-28 07:09:21 +02:00
Lukas Wirth
5b28e9022e Drop unnecessay code 2025-05-28 07:05:55 +02:00
Lukas Wirth
bbbcfaab8b fix: Fix IDE layer not resolving some macro calls 2025-05-28 06:58:40 +02:00
Lukas Wirth
93182f4670
Merge pull request #19877 from tgross35/remove-concat-idents
chore: Remove support for `concat_idents!`
2025-05-28 04:17:42 +00:00
Trevor Gross
e6e5e3cc41 chore: Remove support for concat_idents!
`concat_idents!` was deprecated in [1] and will be removed in the near
future. rust-analyzer's support is independent of rustc's, so drop RA
support now to make syncing easier.

[1]: https://github.com/rust-lang/rust/pull/137653
2025-05-28 03:59:32 +00:00
Chayim Refael Friedman
4f7af13637
Merge pull request #19875 from ShoyuVanilla/issue-19844
fix: Skip pattern analysis on type mismatches
2025-05-27 23:38:38 +00:00
Shoyu Vanilla
8682c1b9b4 fix: Skip pattern analysis on type mismatches 2025-05-28 08:11:14 +09:00
Chayim Refael Friedman
7230ded9c7
Merge pull request #19850 from regexident/dyn-semantics
Add support for type-erased `Semantics<'db, dyn HirDatabase>`, by use of `DB: ?Sized`
2025-05-27 13:50:27 +00:00
Vincent Esche
a01fe887c6 Make Semantics<'db, DB> support Semantics<'db, dyn HirDatabase>, by use of DB: ?Sized 2025-05-27 10:43:28 +02:00
Chayim Refael Friedman
2a7f18bbda Fix inference of AsyncFnX return type 2025-05-27 06:44:50 +03:00
Chayim Refael Friedman
7fa66d67a7
Merge pull request #19862 from ChayimFriedman2/item-resolve-macro-hir
fix: Fix IDE resolution of item macros
2025-05-26 21:34:18 +00:00
Lukas Wirth
f98b6220c4
Merge pull request #19792 from A4-Tacks/fix-generate-mut-trait-impl-indent
fix: ide-assists, generate mut trait impl indent
2025-05-26 08:29:22 +00:00
Lukas Wirth
acab393c4a
Merge pull request #19819 from Veykril/push-utvzwvwuuvlm
Change import prefix default to be by crate
2025-05-26 08:28:16 +00:00
Lukas Wirth
e0451c4b8a
Merge pull request #19785 from A4-Tacks/fix-generate-new-indent
fixes: ide-assists, generate_new indent loses
2025-05-26 07:24:41 +00:00
Lukas Wirth
d146d3bc90
Merge pull request #19851 from ChayimFriedman2/normalize-exhaustiveness
fix: Normalize when checking for uninhabited types for pattern exhaustiveness checking
2025-05-26 07:19:12 +00:00
Lukas Wirth
de4b7b642b
Merge pull request #19864 from ChayimFriedman2/is-in-macro
fix: Properly implement `might_be_inside_macro_call()` using semantic information instead of syntactical hacks
2025-05-26 05:21:01 +00:00
bors
73c6f1d0c7 Auto merge of #138489 - tmiasko:call-tmps-lifetime, r=workingjubilee
Describe lifetime of call argument temporaries passed indirectly

Fixes #132014.
2025-05-26 01:16:52 +00:00
Chayim Refael Friedman
87529e8631 Properly implement might_be_inside_macro_call() using semantic information instead of syntactical hacks
And rename it to `is_inside_macro_call()` accordingly.
2025-05-25 20:15:58 +03:00
Chayim Refael Friedman
3e0ab7219a Fix IDE resolution of item macros
It wasn't inside the source, because there was no source map.
2025-05-25 17:20:20 +03:00
bors
86349e79a1 Auto merge of #141086 - a1phyr:spec_advance_by, r=jhpratt
Implement `advance_by` via `try_fold` for `Sized` iterators

When `try_fold` is overriden, it is usually easier for compilers to optimize.

Example difference: https://iter.godbolt.org/z/z8cEfnKro
2025-05-25 11:34:43 +00:00
bors
dcbbc5e4c5 Auto merge of #141372 - khuey:ir_call_dbg_loc, r=jieyouxu
Use the fn_span when emitting function calls for better debug info.

This especially improves the developer experience for long chains of function calls that span multiple lines, which is common with builder patterns, chains of iterator/future combinators, etc.

try-job: armhf-gnu
try-job: test-various
try-job: x86_64-msvc-1
try-job: arm-android

r? `@jieyouxu`
2025-05-24 17:48:21 +00:00
bors
93c200ae97 Auto merge of #141062 - ChaiTRex:ide_fmt_2024, r=Mark-Simulacrum
Update IDEs to use rustfmt 2024, fix Zed settings

Update IDEs to use rustfmt 2024, fix Zed settings

- Update IDE `rust-analyzer` settings to use 2024 rather than 2021.
- Fix Zed settings by removing `${workspaceFolder}/` from paths.
2025-05-23 11:15:24 +00:00
Lukas Wirth
d2f17873ff
Merge pull request #19853 from Veykril/push-ovpvzkxmpsuk
Bump salsa
2025-05-26
2025-05-23 11:08:19 +00:00
Lukas Wirth
cbff4ae151 Bump salsa 2025-05-23 12:58:00 +02:00
Chayim Refael Friedman
f17bbfc48b Normalize when checking for uninhabited types for pattern exhaustiveness checking 2025-05-23 01:01:21 +03:00
bors
55bcf3ab63 Auto merge of #141135 - compiler-errors:fast-path-2, r=lcnr
Fast path for processing some obligations in the new solver

Fast path applies to:
- Dyn compatibility predicates
- Region and type outlives predicates
- Trivially sized predicates
2025-05-22 11:39:10 +00:00
bors
9db5a01db4 Auto merge of #140527 - GuillaumeGomez:doctest-main-fn, r=notriddle
Emit a warning if the doctest `main` function will not be run

Fixes #140310.

I think we could try to go much further like adding a "link" (ie UI annotations) on the `main` function in the doctest. However that will require some more computation, not sure if it's worth it or not. Can still be done in a follow-up if we want it.

For now, this PR does two things:
1. Pass the `DiagCtxt` to the doctest parser to emit the warning.
2. Correctly generate the `Span` to where the doctest is starting (I hope the way I did it isn't too bad either...).

cc `@fmease`
r? `@notriddle`
2025-05-22 08:40:58 +00:00
Lukas Wirth
76ee900d7c
Merge pull request #19843 from oli-obk/rust-analyzer.vs
Remove rust-analyzer.vs from other editors
2025-05-22 07:55:48 +00:00
Oli Scherer
41cf50ff91 Remove rust-analyzer.vs from other editors 2025-05-22 07:37:25 +00:00
Lukas Wirth
68e03ee1e5
Merge pull request #19842 from Veykril/push-zunlmrzpnrzk
minor: Support `transmute_unchecked` intrinsic for mir-eval
2025-05-22 06:05:35 +00:00
Lukas Wirth
fce18a5708 Support transmute_unchecked intrinsic for mir-eval 2025-05-22 07:55:06 +02:00