Skip to content

Conversation

@detrumi
Copy link
Contributor

@detrumi detrumi commented Jul 13, 2020

This adds a rust-analyzer dump-chalk command, similar to analysis-stats, which writes out the whole chalk progam (see 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))

@detrumi detrumi force-pushed the chalk-writer-integration branch 4 times, most recently from 17e7d06 to 39f5f98 Compare July 26, 2020 10:29
@detrumi detrumi marked this pull request as ready for review July 26, 2020 10:34
@matklad matklad requested a review from flodiebold August 12, 2020 13:41
@flodiebold
Copy link
Member

I'm not sure we should do this whenever CHALK_DEBUG is set. Maybe we could use another env variable?

@detrumi detrumi force-pushed the chalk-writer-integration branch from 41fffc1 to e077340 Compare August 14, 2020 09:30
@detrumi detrumi force-pushed the chalk-writer-integration branch from e077340 to 36052ce Compare August 14, 2020 09:43
@detrumi
Copy link
Contributor Author

detrumi commented Aug 14, 2020

I'm not sure we should do this whenever CHALK_DEBUG is set. Maybe we could use another env variable?

So only print programs if both CHALK_DEBUG and that env var is set? How about PRINT_CHALK?

@flodiebold
Copy link
Member

Yeah, that'd be fine! Maybe CHALK_PRINT fits better with CHALK_DEBUG, but either way is ok.

@detrumi detrumi force-pushed the chalk-writer-integration branch from 285706b to 55974e4 Compare August 14, 2020 12:50
@detrumi detrumi force-pushed the chalk-writer-integration branch from 55974e4 to de282dd Compare August 14, 2020 12:52
@flodiebold
Copy link
Member

bors r+

@bors
Copy link
Contributor

bors bot commented Aug 14, 2020

@bors bors bot merged commit c2594da into rust-lang:master Aug 14, 2020
@detrumi detrumi deleted the chalk-writer-integration branch August 14, 2020 17:14
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.

2 participants