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

Add ability to output a .chalk file for reproducing bugs #365

Closed
jackh726 opened this issue Mar 27, 2020 · 8 comments
Closed

Add ability to output a .chalk file for reproducing bugs #365

jackh726 opened this issue Mar 27, 2020 · 8 comments
Assignees

Comments

@jackh726
Copy link
Member

No description provided.

@daboross
Copy link
Contributor

daboross commented Apr 4, 2020

@rustbot claim

@super-tuple super-tuple removed their assignment Apr 4, 2020
@super-tuple
Copy link
Contributor

@rustbot claim

@jackh726
Copy link
Member Author

Initial PR merged: #430

There are some followup things in the review there.

@nikomatsakis
Copy link
Contributor

Very cool

@jackh726
Copy link
Member Author

jackh726 commented Jul 2, 2020

Another thing that we should do is also be able to write out a goal

@jackh726
Copy link
Member Author

jackh726 commented Jul 4, 2020

Also, in #557, we now no longer error on printing placeholders, fn defs, and closures. These should actually print the right thing

@jackh726
Copy link
Member Author

jackh726 commented Jul 9, 2020

Also, when we record the goals too, then we won't have to rely on implementation details to ensure that items that are present in them actually get recorded (since we don't actually always need their Datum (see https://github.com/rust-lang/chalk/pull/566/files#r452485578))

bors bot added a commit to rust-lang/rust-analyzer that referenced this issue Aug 14, 2020
5347: Chalk writer integration r=flodiebold a=detrumi

~~This adds a `rust-analyzer dump-chalk` command, similar to analysis-stats, which writes out the whole chalk progam (see [chalk#365](rust-lang/chalk#365) for more info about the .chalk writer)~~

Write out chalk programs in debug output if chalk debugging is active (using `CHALK_DEBUG`).

Example output:
```
[DEBUG ra_hir_ty::traits] solve(UCanonical { canonical: Canonical { value: InEnvironment { environment: Env([]), goal: Implemented(SeparatorTraitRef(?)) }, binders: [] }, universes: 1 }) => None
[INFO  ra_hir_ty::traits] trait_solve_query(Implements(fn min<?0.0>(?0.0, ?0.0) -> ?0.0: Deref))
[DEBUG ra_hir_ty::traits] solve goal: UCanonical { canonical: Canonical { value: InEnvironment { environment: Env([]), goal: Implemented(SeparatorTraitRef(?)) }, binders: [U0 with kind type] }, universes: 1 }
[DEBUG ra_hir_ty::traits::chalk] impls_for_trait Deref
[DEBUG ra_hir_ty::traits::chalk] impls_for_trait returned 0 impls
[DEBUG ra_hir_ty::traits::chalk] trait_datum Ord
[DEBUG ra_hir_ty::traits::chalk] trait Ord = Name(Text("Ord"))
[DEBUG ra_hir_ty::traits] chalk program:
    #[upstream]
    #[non_enumerable]
    #[object_safe]
    trait Ord {}
    #[upstream]
    #[non_enumerable]
    #[object_safe]
    #[lang(sized)]
    trait Sized {}
    fn fn_0<_1_0>(arg_0: _1_0, arg_1: _1_0) -> _1_0
    where
      _1_0: Ord;
    #[upstream]
    #[non_enumerable]
    #[object_safe]
    trait Deref {
      type Assoc_1829: Sized;
    }
    
[DEBUG ra_hir_ty::traits] solve(UCanonical { canonical: Canonical { value: InEnvironment { environment: Env([]), goal: Implemented(SeparatorTraitRef(?)) }, binders: [U0 with kind type] }, universes: 1 }) => None
[INFO  ra_hir_ty::traits] trait_solve_query(Implements(?0.0: Ord))
```

Co-authored-by: Wilco Kusee <wilcokusee@gmail.com>
@jackh726
Copy link
Member Author

Gonna call this one closed, since the base implementation is done and my review comments seemed to have been addressed. Further bugs can be opened as new issues.

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

No branches or pull requests

4 participants