-
Notifications
You must be signed in to change notification settings - Fork 13.5k
improve search graph docs, reset encountered_overflow
between reruns
#142617
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
// optimization. However, given that the proof tree will likely | ||
// look similar to the previous iterations when reevaluating, it's | ||
// better for caching if the reevaluation also starts out with `false` | ||
encountered_overflow: false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've reworked this to use EvaluationResult
as I've accidentally dropped heads
from previous iterations while working on this change and it took me a bit to actually figure out what's going on. This now makes it clear that we need to track everything correctly.
@@ -26,6 +26,10 @@ pub(super) struct StackEntry<X: Cx> { | |||
/// The available depth of a given goal, immutable. | |||
pub available_depth: AvailableDepth, | |||
|
|||
/// Starts out as `None` and gets set when rerunning this | |||
/// goal in case we encounter a cycle. | |||
pub provisional_result: Option<X::Result>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moving this field as this type is now all the immutable fields and then the mutable ones
encountered_overflow
between rerunsencountered_overflow
between reruns
This comment was marked as outdated.
This comment was marked as outdated.
also return `EvaluationResult` instead of the final `StackEntry` to make sure we correctly track information between reruns.
r? compiler-errors @bors r+ |
…rors improve search graph docs, reset `encountered_overflow` between reruns I think this shouldn't really matter for now. It will be more relevant for my current rework as we otherwise cannot partially reevaluate the root goal in case there has been overflow during the prervious iteration. r? `@BoxyUwU`
Rollup of 6 pull requests Successful merges: - #140254 (Pass -Cpanic=abort for the panic_abort crate) - #142600 (Port `#[rustc_pub_transparent]` to the new attribute system) - #142617 (improve search graph docs, reset `encountered_overflow` between reruns) - #142641 (Generate symbols.o for proc-macros too) - #142776 (All HIR attributes are outer) - #142800 (integer docs: remove extraneous text) r? `@ghost` `@rustbot` modify labels: rollup
…rors improve search graph docs, reset `encountered_overflow` between reruns I think this shouldn't really matter for now. It will be more relevant for my current rework as we otherwise cannot partially reevaluate the root goal in case there has been overflow during the prervious iteration. r? ``@BoxyUwU``
Rollup of 10 pull requests Successful merges: - #140254 (Pass -Cpanic=abort for the panic_abort crate) - #142594 (Add DesugaringKind::FormatLiteral) - #142600 (Port `#[rustc_pub_transparent]` to the new attribute system) - #142617 (improve search graph docs, reset `encountered_overflow` between reruns) - #142641 (Generate symbols.o for proc-macros too) - #142747 (rustdoc_json: conversion cleanups) - #142776 (All HIR attributes are outer) - #142800 (integer docs: remove extraneous text) - #142850 (remove asm_goto feature annotation, for it is now stabilized) - #142860 (Notify me on tidy changes) r? `@ghost` `@rustbot` modify labels: rollup
…rors improve search graph docs, reset `encountered_overflow` between reruns I think this shouldn't really matter for now. It will be more relevant for my current rework as we otherwise cannot partially reevaluate the root goal in case there has been overflow during the prervious iteration. r? ```@BoxyUwU```
Rollup of 9 pull requests Successful merges: - #140254 (Pass -Cpanic=abort for the panic_abort crate) - #142600 (Port `#[rustc_pub_transparent]` to the new attribute system) - #142617 (improve search graph docs, reset `encountered_overflow` between reruns) - #142641 (Generate symbols.o for proc-macros too) - #142747 (rustdoc_json: conversion cleanups) - #142776 (All HIR attributes are outer) - #142800 (integer docs: remove extraneous text) - #142850 (remove asm_goto feature annotation, for it is now stabilized) - #142860 (Notify me on tidy changes) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 10 pull requests Successful merges: - #140254 (Pass -Cpanic=abort for the panic_abort crate) - #142600 (Port `#[rustc_pub_transparent]` to the new attribute system) - #142617 (improve search graph docs, reset `encountered_overflow` between reruns) - #142747 (rustdoc_json: conversion cleanups) - #142776 (All HIR attributes are outer) - #142800 (integer docs: remove extraneous text) - #142841 (Enable fmt-write-bloat for Windows) - #142845 (Enable textrel-on-minimal-lib for Windows) - #142850 (remove asm_goto feature annotation, for it is now stabilized) - #142860 (Notify me on tidy changes) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of #142617 - lcnr:search_graph-3, r=compiler-errors improve search graph docs, reset `encountered_overflow` between reruns I think this shouldn't really matter for now. It will be more relevant for my current rework as we otherwise cannot partially reevaluate the root goal in case there has been overflow during the prervious iteration. r? ````@BoxyUwU````
`evaluate_goal` avoid unnecessary step based on #142617. This does not mess with the debug logging for the trait solver and is a very nice cleanup for #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: [] }) ```
I think this shouldn't really matter for now. It will be more relevant for my current rework as we otherwise cannot partially reevaluate the root goal in case there has been overflow during the prervious iteration.
r? @BoxyUwU