-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Conversation
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}) ```
@bors delegate=eholk |
✌️ @eholk can now approve this pull request |
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 }) ```
The job Click to see the possible cause of the failure (guessed by this bot)
|
@rust-lang/rustdoc can we find some way to change this test so it doesn't have to be updated on each new flag? It doesn't test what you want since if the new flag isn't added to the help output no one will notice. I think also there seems to be a bug in rustdoc itself, it's printing -W instead of -Z |
oh I just noticed this is a UI test; that's not so bad. but the bug in rustdoc is real |
yeah this is printing -Z options on -W help, which is wrong Line 358 in be0b112
it needs to call describe_lints insteadrust/compiler/rustc_driver/src/lib.rs Lines 350 to 356 in e1b6f16
|
Can you open an issue for this bug please? (And since you already have the fix, maybe a PR too? 😉 ) Thanks in advance! |
…meGomez Fix bug in `rustdoc -Whelp` Previously, this printed the debugging options, not the lint options, and only handled `-Whelp`, not `-A/-D/-F`. This also fixes a few other misc issues: - Fix `// check-stdout` for UI tests; previously it only worked for run-fail and compile-fail tests - Add lint headers for tool lints, not just builtin lints rust-lang#98533 (comment) r? `@GuillaumeGomez`
…meGomez Fix bug in `rustdoc -Whelp` Previously, this printed the debugging options, not the lint options, and only handled `-Whelp`, not `-A/-D/-F`. This also fixes a few other misc issues: - Fix `// check-stdout` for UI tests; previously it only worked for run-fail and compile-fail tests - Add lint headers for tool lints, not just builtin lints rust-lang#98533 (comment) r? ``@GuillaumeGomez``
…meGomez Fix bug in `rustdoc -Whelp` Previously, this printed the debugging options, not the lint options, and only handled `-Whelp`, not `-A/-D/-F`. This also fixes a few other misc issues: - Fix `// check-stdout` for UI tests; previously it only worked for run-fail and compile-fail tests - Add lint headers for tool lints, not just builtin lints rust-lang#98533 (comment) r? ```@GuillaumeGomez```
Looks good to me, especially the new labels! This will be much nicer to use next time I or someone else has to debug a drop tracking issue! @bors r+ |
📌 Commit 3164c2a has been approved by |
…holk 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}) ``` r? `@eholk`
Rollup of 4 pull requests Successful merges: - rust-lang#98533 (Add a `-Zdump-drop-tracking-cfg` debugging flag) - rust-lang#98654 (An optimization for `pest-2.1.3`) - rust-lang#98657 (Migrate some diagnostics from `rustc_const_eval` to `SessionDiagnostic`) - rust-lang#98794 (Highlight conflicting param-env candidates) Failed merges: - rust-lang#98957 ( don't allow ZST in ScalarInt ) r? `@ghost` `@rustbot` modify labels: rollup
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
. Thismakes 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 liker? @eholk