35242 Commits

Author SHA1 Message Date
Chayim Refael Friedman
a6c1fa01d9
Merge pull request #20100 from ShoyuVanilla/ignore-sized-hierarchy
Backport new sized-hierarchy trait bounds in old ways
2025-06-26 20:37:18 +00:00
Hayashi Mikihiro
720f9f12fc generate new for tuple field
Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>
2025-06-27 02:39:04 +09:00
bors
7309085057 Auto merge of #142774 - lcnr:search_graph-2, r=oli-obk
`evaluate_goal` avoid unnecessary step

based on rust-lang/rust#142617.

This does not mess with the debug logging for the trait solver and is a very nice cleanup for rust-lang/rust#142735. E.g. for
```rust
#[derive(Clone)]
struct Wrapper<T>(T);
#[derive(Clone)]
struct Nested; // using a separate type to avoid the fast paths
fn is_clone<T: Clone>() {}
fn main() {
    is_clone::<Wrapper<Nested>>();
}
```
We get the following proof tree with `RUSTC_LOG=rustc_type_ir::search_graph=debug,rustc_next_trait_solver=debug`
```
 rustc_next_trait_solver::solve::eval_ctxt::evaluate_root_goal goal=Goal { param_env: ParamEnv { caller_bounds: [] }, predicate: Binder { value: TraitPredicate(<Wrapper<Nested> as std::clone::Clone>, polarity:Positive), bound_vars: [] } }, generate_proof_tree=No, span=src/main.rs:7:5: 7:34 (#0), stalled_on=None
   rustc_type_ir::search_graph::evaluate_goal input=CanonicalQueryInput { canonical: Canonical { value: QueryInput { goal: Goal { param_env: ParamEnv { caller_bounds: [] }, predicate: Binder { value: TraitPredicate(<Wrapper<Nested> as std::clone::Clone>, polarity:Positive), bound_vars: [] } }, predefined_opaques_in_body: PredefinedOpaques(PredefinedOpaquesData { opaque_types: [] }) }, max_universe: U0, variables: [] }, typing_mode: Analysis { defining_opaque_types_and_generators: [] } }, step_kind_from_parent=Unknown
     rustc_next_trait_solver::solve::eval_ctxt::probe::enter source=Impl(DefId(0:10 ~ main[21d2]::{impl#0}))
       rustc_next_trait_solver::solve::eval_ctxt::add_goal source=ImplWhereBound, goal=Goal { param_env: ParamEnv { caller_bounds: [] }, predicate: Binder { value: TraitPredicate(<_ as std::marker::Sized>, polarity:Positive), bound_vars: [] } }
       rustc_next_trait_solver::solve::eval_ctxt::add_goal source=ImplWhereBound, goal=Goal { param_env: ParamEnv { caller_bounds: [] }, predicate: Binder { value: TraitPredicate(<_ as std::clone::Clone>, polarity:Positive), bound_vars: [] } }
       rustc_type_ir::search_graph::evaluate_goal input=CanonicalQueryInput { canonical: Canonical { value: QueryInput { goal: Goal { param_env: ParamEnv { caller_bounds: [] }, predicate: Binder { value: TraitPredicate(<Nested as std::clone::Clone>, polarity:Positive), bound_vars: [] } }, predefined_opaques_in_body: PredefinedOpaques(PredefinedOpaquesData { opaque_types: [] }) }, max_universe: U0, variables: [] }, typing_mode: Analysis { defining_opaque_types_and_generators: [] } }, step_kind_from_parent=Unknown
         0ms DEBUG rustc_type_ir::search_graph global cache hit, required_depth=0
         0ms DEBUG rustc_type_ir::search_graph return=Ok(Canonical { value: Response { certainty: Yes, var_values: CanonicalVarValues { var_values: [] }, external_constraints: ExternalConstraints(ExternalConstraintsData { region_constraints: [], opaque_types: [], normalization_nested_goals: NestedNormalizationGoals([]) }) }, max_universe: U0, variables: [] })
     rustc_next_trait_solver::solve::eval_ctxt::probe::enter source=BuiltinImpl(Misc)
     rustc_next_trait_solver::solve::trait_goals::merge_trait_candidates candidates=[Candidate { source: Impl(DefId(0:10 ~ main[21d2]::{impl#0})), result: Canonical { value: Response { certainty: Yes, var_values: CanonicalVarValues { var_values: [] }, external_constraints: ExternalConstraints(ExternalConstraintsData { region_constraints: [], opaque_types: [], normalization_nested_goals: NestedNormalizationGoals([]) }) }, max_universe: U0, variables: [] } }]
       0ms DEBUG rustc_next_trait_solver::solve::trait_goals return=Ok((Canonical { value: Response { certainty: Yes, var_values: CanonicalVarValues { var_values: [] }, external_constraints: ExternalConstraints(ExternalConstraintsData { region_constraints: [], opaque_types: [], normalization_nested_goals: NestedNormalizationGoals([]) }) }, max_universe: U0, variables: [] }, Some(Misc)))
     0ms DEBUG rustc_type_ir::search_graph insert global cache, evaluation_result=EvaluationResult { encountered_overflow: false, required_depth: 1, heads: CycleHeads { heads: {} }, nested_goals: NestedGoals { nested_goals: {} }, result: Ok(Canonical { value: Response { certainty: Yes, var_values: CanonicalVarValues { var_values: [] }, external_constraints: ExternalConstraints(ExternalConstraintsData { region_constraints: [], opaque_types: [], normalization_nested_goals: NestedNormalizationGoals([]) }) }, max_universe: U0, variables: [] }) }
     0ms DEBUG rustc_type_ir::search_graph return=Ok(Canonical { value: Response { certainty: Yes, var_values: CanonicalVarValues { var_values: [] }, external_constraints: ExternalConstraints(ExternalConstraintsData { region_constraints: [], opaque_types: [], normalization_nested_goals: NestedNormalizationGoals([]) }) }, max_universe: U0, variables: [] })
```
2025-06-26 17:04:47 +00:00
Shoyu Vanilla
953e9d1c36 Backport new sized-hierarchy trait bounds in old ways 2025-06-26 23:22:26 +09:00
Lukas Wirth
317c76fe78
Merge pull request #20106 from Veykril/push-pytuxksnntux
Salsa idiomize `VariantFields` query
2025-06-26 12:28:02 +00:00
Lukas Wirth
468726178f Bring back the firewall query 2025-06-26 14:12:57 +02:00
Lukas Wirth
11c7207aa5
Merge pull request #20103 from ChayimFriedman2/path-transform-prettify
fix: Prettify AST in `PathTransform` if it's coming from a macro
2025-06-26 11:12:09 +00:00
Lukas Wirth
889d84a1be Salsa idiomize VariantFields query 2025-06-26 12:55:55 +02:00
Lukas Wirth
d2691ac24b
Merge pull request #20105 from Veykril/push-qtmwnuqvsruw
Parse new const trait syntax
2025-06-26 10:38:11 +00:00
bors
30e0419301 Auto merge of #142581 - Kobzol:bootstrap-std-method, r=jieyouxu
Enforce in bootstrap that build must have stage at least 1

This PR is a step towards https://rust-lang.zulipchat.com/#narrow/channel/326414-t-infra.2Fbootstrap/topic/Proposal.20to.20cleanup.20stages.20and.20steps.20after.20the.20redesign/with/523586917. It's very hard or me to make self-contained changes to bootstrap at this moment, so this PR kind of does several things:

1) (first two commits) Try to reduce the usage of `Std::new` in bootstrap, and replace it with a `Builder::std` method (similar to `Builder::compiler`). This is mostly to remove executions of the `Std` step for stage 0, which doesn't make a lot of sense; I'd like to ideally have the invariant that when a step is invoked, it actually builds or does something. Eventually, I'd like for everything to go through `Builder::std`. (Note: I'm not totally married to this idea, if you don't like it, we can remove it from this PR. I mostly did it right now to remove stage 0 std steps from snapshot tests, which shouldn't be there, but we can also filter them out in a different way)
2) Make sure that when you pass `x build compiler`, only the `Assemble` root level step will be invoked, and not the `Rustc` step. Before, both were invoked, which actually ran `Rustc` twice, once with all `crates` filled, and once with no crates (but both actually represent the same situation). Since the `Rustc::make_run` step actually requests a compile that is one stage below it, this actually made `build compiler --stage 0` work, which we don't want to have anymore.
3) Enforce a bootstrap-global invariant that all `build` commands are always on stage `>=1`. If you try to `build` anything on stage 0, it will print a warning and exit bootstrap. This follows the intuition from the new staging rules after the stage redesign; artifacts that are "stage 0" come outside of bootstrap, and we can't really build something for which we don't have source (although we can still test it, but that's for another PR).

Now the logic for build should be quite simple. For pretty much everything except for `Std`, you first use the stage0 compiler to build stage 1. Then you can build a stage 2 <something> using the previously built stage 1 (and then you can continue to stage 3 etc.). And that's it. The default build stage for everything is 1 (modulo download-ci-rustc, but that's a separate can of worms).

The snapshot test infra isn't super nice at the moment, as one of next steps I want to create some simple Builder pattern that will allow us to configure the bootstrap invocations in a more "forward-compatible" way (e.g. now it's not possible to modify the config passed to `configure_with_args`).

There are some things not yet fully resolved for build stage 0:
1) Cargo is still a `ModeRustc` tool, even though it doesn't really have to be, it is buildable with the stage0 compiler
2) bootstrap tools (`opt-dist`, `build-manifest` etc.) are still called stage0 tools, and in the bootstrap output it says something like "stage 0 rustc builds stage 0 opt-dist". Which is a bit weird, but functionally there's no difference, it's just a slightly inconsistent output. We still haven't decided if we should make these tools ignore staging altogether (which is IMO the right choice) or if we want to allow building stage 1/2/3/... bootstrap tools.

r? `@jieyouxu`

try-job: x86_64-rust-for-linux
2025-06-26 09:20:07 +00:00
Lukas Wirth
5924b38e3d Parse new const trait syntax 2025-06-26 11:08:30 +02:00
Lukas Wirth
332434aecd
Merge pull request #20104 from Veykril/push-nqnmmlvksyty
Cleanup `provideCodeActions` vscode hook
2025-06-26 08:44:57 +00:00
Lukas Wirth
db07723fe9 Cleanup provideCodeActions vscode hook 2025-06-26 10:32:13 +02:00
Lukas Wirth
560f235362
Merge pull request #19546 from roife/branch-value-highlights
feat: highlighting of return values while the cursor is on `match` / `if` / `=>`
2025-06-26 07:24:22 +00:00
Chayim Refael Friedman
4db8341ddb Prettify AST in PathTransform if it's coming from a macro 2025-06-26 10:03:44 +03:00
bors
201e4834aa Auto merge of #141899 - Kobzol:stdarch-josh, r=Amanieu
Turn `stdarch` into a Josh subtree

In a similar vein as https://github.com/rust-lang/rust/pull/141229, this PR makes the `stdarch` repository a Josh subtree (it was previously a submodule). The initial commit of `stdarch` upon this is based is `5a7342fc16b208b1b16624e886937ed8509a6506`, which is the previous commit SHA of the `stdarch` submodule. The sync was performed according to https://hackmd.io/7pOuxnkdQDaL1Y1FQr65xg.

This was decided in https://github.com/rust-lang/stdarch/issues/1655.

Test pull PR on my fork: https://github.com/Kobzol/stdarch/pull/1
Test push PR on my fork: https://github.com/Kobzol/rust/pull/59

I plan to use the same Rust (miri-inspired) tooling that we use for `rustc-dev-guide` to enable pulls/pushes on stdarch.

Note that this repository currently doesn't have any stdarch-specific tests, so before that, the subtree should only be modified through this repository only when dealing with changes that contain "cyclical dependencies" between stdarch and rustc. The long term vision is to integrate stdarch into rust-lang/rust completely.

CC `@Amanieu`

try-job: aarch64-apple
try-job: aarch64-gnu
try-job: `x86_64-msvc-*`
try-job: x86_64-gnu
try-job: x86_64-gnu-aux
2025-06-26 06:18:35 +00:00
roifewu
15e70c21d8 refactor: enhance highlighting for control flow kws in macros 2025-06-26 13:43:15 +08:00
roifewu
79de21bd9d refactor: simplify functions related to branch_exit_points in highlight_related 2025-06-26 13:41:41 +08:00
roifewu
c36758def4 refactor: rename branches to branch_exit_points in highlight_related 2025-06-26 13:41:41 +08:00
roifewu
9fa0543504 refactor: improve macro handling in navigation for control-flow kws 2025-06-26 13:41:41 +08:00
roifewu
f87220e22a feat: highlighting of related return values while the cursor is on any match, if, or match arm arrow (=>) 2025-06-26 13:41:39 +08:00
Laurențiu Nicola
c6633fa1f2
Merge pull request #20101 from ShoyuVanilla/comp-time-deps-sooner
minor: Decrease minimal toolchain version for `comp-time-deps` to `1.89.0`
2025-06-26 05:05:51 +00:00
bors
89eeb89b5c Auto merge of #142879 - Mark-Simulacrum:opt-cleanup, r=WaffleLapkin
Remove dead instructions in terminate blocks

Terminate blocks look pretty in the IR I've looked at, so no actual perf delta from this. But it seems reasonable to note produce unused IR.
2025-06-25 17:33:39 +00:00
David Barsky
317542c1e4
Merge pull request #20098 from regexident/cleanup-progress-messages
Unify formatting of progress messages
2025-06-25 17:15:59 +00:00
Shoyu Vanilla
89a0a28d4f minor: Decrease minimal toolchain version for comp-time-deps by 0.1 2025-06-26 01:20:35 +09:00
Vincent Esche
3e6509f18b Unify formatting of progress messages 2025-06-25 16:41:08 +02:00
bors
487ae61c02 Auto merge of #142870 - tmiasko:copy-prop-early-exit, r=cjgillot
Leave from CopyProp early when there are no replacements

r? cjgillot
2025-06-25 14:34:08 +00:00
Lukas Wirth
749288e0de
Merge pull request #20096 from lnicola/silence-rustfmt-failed
internal: Don't show notifications on failed rustfmt calls
2025-06-25 13:03:21 +00:00
Lukas Wirth
d3e6dcd3ca Adjust minicore for Sized Hierarchy changes 2025-06-25 21:51:51 +09:00
Laurențiu Nicola
4c07f8b25a Don't show notifications on failed rustfmt calls 2025-06-25 15:51:31 +03:00
Lukas Wirth
01339d4deb
Merge pull request #20092 from Veykril/push-kollxvpyknqs
Drop rustc workspace loading error, if we don't needs its sources
2025-06-25 10:20:30 +00:00
bors
b46ad7859c Auto merge of #142746 - compiler-errors:super-implied-outlives, r=lcnr
Apply `impl_super_outlives` optimization to new trait solver

I never did rust-lang/rust#128746 for the new solver.

r? lcnr
2025-06-25 10:10:21 +00:00
Lukas Wirth
aee96c7f17 Drop rustc workspace loading error, if we don't needs its sources 2025-06-25 12:09:54 +02:00
Lukas Wirth
ad3a2d7280
Merge pull request #20088 from Veykril/push-qrslvzzlqqoz
De-arc trait items query
2025-06-25 08:19:32 +00:00
Lukas Wirth
756f1bfd65
Merge pull request #20077 from markpots5/master
feat: Extend vscode 'run' command with optional mode argument for run…
2025-06-25 08:13:14 +00:00
Lukas Wirth
3eb4925fbc
Merge pull request #20084 from ShoyuVanilla/fix-windows-cancel-par
ci:  Fix cancel parallel jobs on windows
2025-06-25 08:11:28 +00:00
Lukas Wirth
f25912c6f9 De-arc trait items query 2025-06-25 10:09:21 +02:00
Chayim Refael Friedman
c3fc95a40e
Merge pull request #20089 from ChayimFriedman2/faq
minor: Fix link in the book
2025-06-25 03:40:59 +00:00
Chayim Refael Friedman
6b558621a9 Fix link in the book 2025-06-25 06:30:16 +03:00
bors
1ff3fa0665 Auto merge of #140999 - hkBst:update-escaper, r=nnethercote
update to literal-escaper 0.0.4 for better API without `unreachable` and faster string parsing

This is the replacement for just the part of https://github.com/rust-lang/rust/pull/138163 dealing with the changed API of unescape functionality, since that got moved into its own crate.

<del>This uses an unpublished version of literal-escaper (https://github.com/rust-lang/literal-escaper/pull/8).</del>

r? `@nnethercote`
2025-06-25 01:03:30 +00:00
Lukas Wirth
c68c8a81a7
Merge pull request #20087 from Veykril/push-rrtkwpzmmwwz
Short circuit a couple hir-ty/lower queries
2025-06-24 18:15:42 +00:00
Lukas Wirth
c43e7c71de Short circuit a couple hir-ty/lower queries 2025-06-24 20:04:43 +02:00
Shoyu Vanilla
dfd2c0e940 ci: Fix cancel parallel jobs on windows 2025-06-24 23:10:52 +09:00
Mark Pots
e2e24f84c4 Remove special casing in command factory (revert changes in ctx.ts), update main.createCommands instead 2025-06-24 11:56:22 +02:00
Lukas Wirth
70cbf8332a
Merge pull request #20012 from lnicola/bump-literal-escaper
Update to literal-escaper 0.0.4
2025-06-24 08:21:36 +00:00
Lukas Wirth
4589eb8748
Merge pull request #20080 from Veykril/push-vnrwqppplykm
Cleanup `folding_ranges` and support more things
2025-06-24 08:02:55 +00:00
Lukas Wirth
13221eb4e6 Cleanup folding_ranges and support more things 2025-06-24 09:51:44 +02:00
Lukas Wirth
ee012e0749
Merge pull request #20061 from ChayimFriedman2/wrap-ret-ty
fix: In "Wrap return type" assist, don't wrap exit points if they already have the right type
2025-06-24 07:16:46 +00:00
Lukas Wirth
5cda2dd412
Merge pull request #20064 from Wilfred/document_sysroot_project
Document sysroot_project field in rust-project.json
2025-06-24 07:15:19 +00:00
Lukas Wirth
b50d527931
Merge pull request #20036 from Veykril/push-yquvoyrxkksx
Do not default to 'static for trait object lifetimes
2025-06-24 06:59:54 +00:00