Skip to content
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

reduce decls Debug noise #187

Merged
merged 1 commit into from
Oct 1, 2024
Merged

reduce decls Debug noise #187

merged 1 commit into from
Oct 1, 2024

Conversation

shua
Copy link
Contributor

@shua shua commented Jul 11, 2024

Decls debug rendering is a bit noisy, especially since decls does not
change, but is printed for every step that failed. With this change,
decls is only printed in the prove judgement, with the expectation that
this is the main entrypoint for proofs.

@FullyNonlinear
Copy link
Contributor

FullyNonlinear commented Jul 12, 2024

In my personal opinion, I prefer the original output format. The major benefit of the original format is that I can easily definitively map each field output to the name of the field without further knowledge of how each field is displayed, thanks to the list of field outputs having a fixed length on the top level.

That being said, I don't have a problem with skipping fields that are empty containers, as long as the name of the fields that are non-empty get displayed in the output.

In addition, if the verbosity of the debug output of decls is annoying enough, positioning it at the end of the line after any other useful information could also be another solution. (I understand that decls usually doesn't change across the lines. )

@shua
Copy link
Contributor Author

shua commented Jul 12, 2024

Can you give me an example of an issue you had where it was helpful to see specifically which field in Decls the item was in?

@FullyNonlinear
Copy link
Contributor

FullyNonlinear commented Jul 12, 2024

Can you give me an example of an issue you had where it was helpful to see specifically which field in Decls the item was in?

Here is one example that immediately comes to my mind:

test test::coherence_orphan::CoreTraitLocal_for_AliasToKnown_in_Foo ... ok
prove goal={}, assumptions={}, env=Env { variables: [], bias: Soundness }, decls=decls(222, [trait Foo <ty> ], [impl <ty> Foo(^ty0_0) where {Foo(^ty0_0)}], [impl ! Foo(u32)], [], [], [], {Foo}, {})

In this example, there are two fields that both start with the prefix impl, namely impl_decls and neg_impl_decls. For someone who knows well how to parse the new output format already, they would know to look ahead further to figure out which is the usual impl_decls and which is the neg_impl_decls. (I actually didn't know that until I mapped the output to the fields under the current format.) For beginners who do not have that information, it would be hard for them to know definitively which subsequences belong to which field. (Again, this is just my personal experience and opinion 😊 )

@shua
Copy link
Contributor Author

shua commented Jul 12, 2024

That's fair, so with this PR the output would look like

decls[ trait Foo <ty>, impl <ty> Foo(^ty0_0) where {Foo(^ty_0)}, impl ! Foo(u32) ]

and you're issue was that it wasn't clear you needed to call eg decls.neg_impl_decls(foo_trait_id) to get that value? That makes sense, I was coming from "why did my proof fail?" but not I hadn't really thought of it from the point of view of a dev needing to add a lookup of some id and not sure which field to use.

I'll try a slightly more verbose output, thanks for the feedback.

@shua shua changed the title smaller decls output decls: elide empty fields in Debug Jul 12, 2024
@lcnr
Copy link
Contributor

lcnr commented Jul 16, 2024

as a general question: should we mention the decls at all in the proof trace?

I am not that happy about using .. for empty fields but also don't like the current impl without field names too much. Ideally we could just avoid that entirely :3

@shua
Copy link
Contributor Author

shua commented Jul 18, 2024

@lcnr the decls should only have to be output once in the trace of a proof, because they shouldn't change. So I guess we could just print them in some top-level function like prove_goal and don't print them anywhere else?

@lcnr
Copy link
Contributor

lcnr commented Jul 18, 2024

@lcnr the decls should only have to be output once in the trace of a proof, because they shouldn't change. So I guess we could just print them in some top-level function like prove_goal and don't print them anywhere else?

yeah, exactly 👍

@shua shua force-pushed the decl branch 2 times, most recently from 0e28bda to e656f18 Compare July 20, 2024 19:13
Decls debug rendering is a bit noisy, especially since decls does not
change, but is printed for every step that failed.  With this change,
decls is only printed in the `prove` judgement, with the expectation that
this is the main entrypoint for proofs.
@shua shua changed the title decls: elide empty fields in Debug reduce decls Debug noise Jul 20, 2024
Copy link
Contributor

@lcnr lcnr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removing decls feels ncie. This now adds an additional level of indentation 🤔 I still think that's a fairly nice improvement

cc @nikomatsakis

@@ -53,7 +54,20 @@ pub fn prove(

assert!(env.encloses(term_in));

let result_set = prove_wc_list(decls, &env, assumptions, goal);
struct ProveFailureLabel(String);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: is it even worth including the "decls" here? I'm inclined to think "not really".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's nice to see it at least once in proof trace on failure.

@nikomatsakis nikomatsakis merged commit 0e53834 into rust-lang:main Oct 1, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants