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

Improved support of collapse_debuginfo attribute for macros. #118903

Merged

Conversation

azhogin
Copy link
Contributor

@azhogin azhogin commented Dec 13, 2023

Added walk_chain_collapsed function to consider collapse_debuginfo attribute in parent macros in call chain.
Fixed collapse_debuginfo attribute processing for cranelift (there was if/else branches error swap).

cc #100758

@rustbot
Copy link
Collaborator

rustbot commented Dec 13, 2023

r? @WaffleLapkin

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Dec 13, 2023
@rustbot
Copy link
Collaborator

rustbot commented Dec 13, 2023

Some changes occurred in compiler/rustc_codegen_cranelift

cc @bjorn3

@azhogin azhogin force-pushed the azhogin/skip_second_stmt_debuginfo.rs branch from 374c882 to 2fa1ecf Compare December 13, 2023 06:58
@WaffleLapkin
Copy link
Member

r? @bjorn3

@rustbot rustbot assigned bjorn3 and unassigned WaffleLapkin Dec 13, 2023
@azhogin azhogin force-pushed the azhogin/skip_second_stmt_debuginfo.rs branch from 2fa1ecf to b5cb3ee Compare December 13, 2023 15:58
@petrochenkov petrochenkov self-assigned this Dec 13, 2023
@petrochenkov
Copy link
Contributor

cc @davidtwco

@azhogin azhogin force-pushed the azhogin/skip_second_stmt_debuginfo.rs branch from b5cb3ee to 2546264 Compare December 14, 2023 12:32
@petrochenkov
Copy link
Contributor

@azhogin to split the work into two parts - one with tests and bugfixes, and another with enabling collapse_debuginfo for built-in and standard library macros.
@rustbot author

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 15, 2023
@azhogin azhogin force-pushed the azhogin/skip_second_stmt_debuginfo.rs branch from 2546264 to dc993ca Compare December 21, 2023 07:11
@rust-log-analyzer

This comment has been minimized.

@azhogin azhogin force-pushed the azhogin/skip_second_stmt_debuginfo.rs branch from dc993ca to 24df98d Compare December 21, 2023 08:29
@azhogin
Copy link
Contributor Author

azhogin commented Dec 21, 2023

@azhogin to split the work into two parts - one with tests and bugfixes, and another with enabling collapse_debuginfo for built-in and standard library macros. @rustbot author

This PR converted into first part - no default attribute for builtin/std macros.
Added the required test cases.
@rustbot review

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Dec 21, 2023
tests/debuginfo/skip_second_statement_collapse.rs Outdated Show resolved Hide resolved
tests/debuginfo/skip_second_statement_si_collapse.rs Outdated Show resolved Hide resolved
compiler/rustc_middle/src/ty/mod.rs Outdated Show resolved Hide resolved
compiler/rustc_span/src/hygiene.rs Outdated Show resolved Hide resolved
compiler/rustc_span/src/hygiene.rs Outdated Show resolved Hide resolved
compiler/rustc_middle/src/ty/mod.rs Outdated Show resolved Hide resolved
compiler/rustc_middle/src/ty/mod.rs Outdated Show resolved Hide resolved
compiler/rustc_span/src/hygiene.rs Outdated Show resolved Hide resolved
compiler/rustc_span/src/hygiene.rs Outdated Show resolved Hide resolved
compiler/rustc_span/src/hygiene.rs Outdated Show resolved Hide resolved
@petrochenkov
Copy link
Contributor

Mostly ready, some minor comments.
@rustbot author

@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 21, 2023
@bors

This comment was marked as resolved.

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Dec 28, 2023
@petrochenkov petrochenkov added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 28, 2023
Copy link
Member

@davidtwco davidtwco left a comment

Choose a reason for hiding this comment

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

To make sure I understand correctly, this just makes #[collapse_debuginfo] work when macro calls to annotated macros are themselves within a macro?

I'd appreciate some additional comments/documentation as per my review comments below, some of these tests are quite hard to understand otherwise.

compiler/rustc_span/src/hygiene.rs Outdated Show resolved Hide resolved
tests/debuginfo/skip_second_statement.rs Outdated Show resolved Hide resolved
@azhogin
Copy link
Contributor Author

azhogin commented Jan 5, 2024

To make sure I understand correctly, this just makes #[collapse_debuginfo] work when macro calls to annotated macros are themselves within a macro?

I'd appreciate some additional comments/documentation as per my review comments below, some of these tests are quite hard to understand otherwise.

Yes, to correctly process chained situations: tagged macro inside untagged macro, tagged macro inside untagged macro etc.
Also, there was (probably), if-else branch swapped in compiler/rustc_codegen_cranelift/src/debuginfo/line_info.rs:

let span = if tcx.should_collapse_debuginfo(span) {
    span
} else {
    // Walk up the macro expansion chain until we reach a non-expanded span.
    // We also stop at the function body level because no line stepping can occur
    // at the level above that.
    rustc_span::hygiene::walk_chain(span, function_span.ctxt())
};

Right?

@azhogin azhogin force-pushed the azhogin/skip_second_stmt_debuginfo.rs branch from ea1350e to 5fee6e5 Compare January 7, 2024 22:34
@rust-log-analyzer

This comment has been minimized.

@azhogin azhogin force-pushed the azhogin/skip_second_stmt_debuginfo.rs branch from 5fee6e5 to f2dbeba Compare January 8, 2024 10:47
@petrochenkov
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Jan 8, 2024

📌 Commit f2dbeba has been approved by petrochenkov

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jan 8, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jan 8, 2024
…ebuginfo.rs, r=petrochenkov

Improved support of collapse_debuginfo attribute for macros.

Added walk_chain_collapsed function to consider collapse_debuginfo attribute in parent macros in call chain.
Fixed collapse_debuginfo attribute processing for cranelift (there was if/else branches error swap).

cc rust-lang#100758
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 8, 2024
…iaskrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#118903 (Improved support of collapse_debuginfo attribute for macros.)
 - rust-lang#119033 (coverage: `llvm-cov` expects column numbers to be bytes, not code points)
 - rust-lang#119654 (bump bootstrap dependencies)
 - rust-lang#119660 (remove an unnecessary stderr-per-bitwidth)
 - rust-lang#119663 (tests: Normalize `\r\n` to `\n` in some run-make tests)
 - rust-lang#119681 (coverage: Anonymize line numbers in branch views)
 - rust-lang#119704 (Fix two variable binding issues in lint let_underscore)
 - rust-lang#119725 (Add helper for when we want to know if an item has a host param)

r? `@ghost`
`@rustbot` modify labels: rollup
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jan 8, 2024
…ebuginfo.rs, r=petrochenkov

Improved support of collapse_debuginfo attribute for macros.

Added walk_chain_collapsed function to consider collapse_debuginfo attribute in parent macros in call chain.
Fixed collapse_debuginfo attribute processing for cranelift (there was if/else branches error swap).

cc rust-lang#100758
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jan 8, 2024
…ebuginfo.rs, r=petrochenkov

Improved support of collapse_debuginfo attribute for macros.

Added walk_chain_collapsed function to consider collapse_debuginfo attribute in parent macros in call chain.
Fixed collapse_debuginfo attribute processing for cranelift (there was if/else branches error swap).

cc rust-lang#100758
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 8, 2024
…iaskrgr

Rollup of 11 pull requests

Successful merges:

 - rust-lang#116343 (Stop mentioning internal lang items in no_std binary errors)
 - rust-lang#118903 (Improved support of collapse_debuginfo attribute for macros.)
 - rust-lang#119033 (coverage: `llvm-cov` expects column numbers to be bytes, not code points)
 - rust-lang#119598 (Fix a typo in core::ops::Deref's doc)
 - rust-lang#119660 (remove an unnecessary stderr-per-bitwidth)
 - rust-lang#119663 (tests: Normalize `\r\n` to `\n` in some run-make tests)
 - rust-lang#119681 (coverage: Anonymize line numbers in branch views)
 - rust-lang#119704 (Fix two variable binding issues in lint let_underscore)
 - rust-lang#119725 (Add helper for when we want to know if an item has a host param)
 - rust-lang#119738 (Add `riscv32imafc-esp-espidf` tier 3 target for the ESP32-P4.)
 - rust-lang#119740 (Remove crossbeam-channel)

Failed merges:

 - rust-lang#119723 (Remove `-Zdont-buffer-diagnostics`.)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 9, 2024
…iaskrgr

Rollup of 10 pull requests

Successful merges:

 - rust-lang#118903 (Improved support of collapse_debuginfo attribute for macros.)
 - rust-lang#119033 (coverage: `llvm-cov` expects column numbers to be bytes, not code points)
 - rust-lang#119598 (Fix a typo in core::ops::Deref's doc)
 - rust-lang#119660 (remove an unnecessary stderr-per-bitwidth)
 - rust-lang#119663 (tests: Normalize `\r\n` to `\n` in some run-make tests)
 - rust-lang#119681 (coverage: Anonymize line numbers in branch views)
 - rust-lang#119704 (Fix two variable binding issues in lint let_underscore)
 - rust-lang#119725 (Add helper for when we want to know if an item has a host param)
 - rust-lang#119738 (Add `riscv32imafc-esp-espidf` tier 3 target for the ESP32-P4.)
 - rust-lang#119740 (Remove crossbeam-channel)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit ee7d4c1 into rust-lang:master Jan 9, 2024
11 checks passed
@rustbot rustbot added this to the 1.77.0 milestone Jan 9, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Jan 9, 2024
Rollup merge of rust-lang#118903 - azhogin:azhogin/skip_second_stmt_debuginfo.rs, r=petrochenkov

Improved support of collapse_debuginfo attribute for macros.

Added walk_chain_collapsed function to consider collapse_debuginfo attribute in parent macros in call chain.
Fixed collapse_debuginfo attribute processing for cranelift (there was if/else branches error swap).

cc rust-lang#100758
bjorn3 pushed a commit to bjorn3/rust that referenced this pull request Jan 26, 2024
…ebuginfo.rs, r=petrochenkov

Improved support of collapse_debuginfo attribute for macros.

Added walk_chain_collapsed function to consider collapse_debuginfo attribute in parent macros in call chain.
Fixed collapse_debuginfo attribute processing for cranelift (there was if/else branches error swap).

cc rust-lang#100758
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants