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 a -Zdump-drop-tracking-cfg debugging flag #98533

Merged
merged 2 commits into from
Jul 8, 2022

Commits on Jun 26, 2022

  1. Add a -Zdump-drop-tracking-cfg debugging flag

    This is useful for debugging drop-tracking; previously, you had to recompile
    rustc from source and manually add a call to `write_graph_to_file`. This
    makes the option more discoverable and configurable at runtime.
    
    I also took the liberty of making the labels for the CFG nodes much easier to read:
    previously, they looked like `id(2), local_id: 48`, now they look like
    ```
    expr from_config (hir_id=HirId { owner: DefId(0:10 ~ default_struct_update[79f9]::foo), local_id: 2})
    ```
    jyn514 committed Jun 26, 2022
    Configuration menu
    Copy the full SHA
    483ee1f View commit details
    Browse the repository at this point in the history

Commits on Jul 1, 2022

  1. Make logging for drop-tracking easier to read.

    Some of these are a little questionable because the output is so much longer, but I would really love to keep the bit that adds the pretty-printed expression to the generated CFG .dot file.
    
    Before:
    ```
    DEBUG rustc_typeck::check::generator_interior::drop_ranges::record_consumed_borrow consume PlaceWithHirId { hir_id: HirId { owner: DefId(0:7 ~ default_struct_update[79f9]::foo), local_id: 15 }, place: Place { base_ty: impl std::future::Future<Output = ()>, base: Rvalue, projections: [] } }; diag_expr_id=HirId { owner: DefId(0:7 ~ default_struct_update[79f9]::foo), local_id: 15 }, using parent expr HirId { owner: DefId(0:7 ~ default_struct_update[79f9]::foo), local_id: 49 }
    ```
    
    After:
    ```
    DEBUG rustc_typeck::check::generator_interior::drop_ranges::record_consumed_borrow consume PlaceWithHirId { hir_id: HirId { owner: DefId(0:7 ~ default_struct_update[79f9]::foo), local_id: 15 }, place: Place { base_ty: impl std::future::Future<Output = ()>, base: Rvalue, projections: [] } }; diag_expr_id=expr from_config(Config {
            nickname: None,
            ..Default::default()
        }) (hir_id=HirId { owner: DefId(0:7 ~ default_struct_update[79f9]::foo), local_id: 15 }), using parent expr
        .await (hir_id=HirId { owner: DefId(0:7 ~ default_struct_update[79f9]::foo), local_id: 49 })
    ```
    jyn514 committed Jul 1, 2022
    Configuration menu
    Copy the full SHA
    3164c2a View commit details
    Browse the repository at this point in the history