Repository navigation
Fix missing syntax context in lifetime hygiene debug output - #151817
Conversation
|
rustbot has assigned @jdonszelmann. Use |
This comment has been minimized.
This comment has been minimized.
`-Zunpretty=expanded,hygiene` was not printing the syntax context for lifetimes. For example, two macro-generated lifetimes `'a` with different hygiene would both print as `/* 2538 */` instead of `/* 2538#0 */` and `/* 2538#1 */`, making it impossible to distinguish them. This was fixed by changing `print_lifetime` to call `ann_post()` with the full `Ident`, matching how regular identifiers are handled in `print_ident`.
6bc4b5f to
a333f6f
Compare
|
@bors r+ rollup |
…e, r=jdonszelmann Fix missing syntax context in lifetime hygiene debug output `-Zunpretty=expanded,hygiene` was not printing the syntax context for lifetimes. For example, two macro-generated lifetimes `'a` with different hygiene would both print as `/* 2538 */` instead of `/* 2538#0 */` and `/* 2538#1 */`, making it impossible to distinguish them. This was fixed by changing `print_lifetime` to call `ann_post()` with the full `Ident`, matching how regular identifiers are handled in `print_ident`. Closes: rust-lang#151797
…e, r=jdonszelmann Fix missing syntax context in lifetime hygiene debug output `-Zunpretty=expanded,hygiene` was not printing the syntax context for lifetimes. For example, two macro-generated lifetimes `'a` with different hygiene would both print as `/* 2538 */` instead of `/* 2538#0 */` and `/* 2538#1 */`, making it impossible to distinguish them. This was fixed by changing `print_lifetime` to call `ann_post()` with the full `Ident`, matching how regular identifiers are handled in `print_ident`. Closes: rust-lang#151797
…uwer Rollup of 4 pull requests Successful merges: - #151808 (Document a safety condition for `TypedArena::alloc_raw_slice`) - #151811 (Fix false positive in unused_parens caused by break) - #151817 (Fix missing syntax context in lifetime hygiene debug output) - #151836 (Fix flakyness issue with `tests/rustdoc-gui/globals.goml` test)
…uwer Rollup of 4 pull requests Successful merges: - #151808 (Document a safety condition for `TypedArena::alloc_raw_slice`) - #151811 (Fix false positive in unused_parens caused by break) - #151817 (Fix missing syntax context in lifetime hygiene debug output) - #151836 (Fix flakyness issue with `tests/rustdoc-gui/globals.goml` test)
…e, r=jdonszelmann Fix missing syntax context in lifetime hygiene debug output `-Zunpretty=expanded,hygiene` was not printing the syntax context for lifetimes. For example, two macro-generated lifetimes `'a` with different hygiene would both print as `/* 2538 */` instead of `/* 2538#0 */` and `/* 2538#1 */`, making it impossible to distinguish them. This was fixed by changing `print_lifetime` to call `ann_post()` with the full `Ident`, matching how regular identifiers are handled in `print_ident`. Closes: rust-lang#151797
Rollup of 6 pull requests Successful merges: - #151777 ( Reduce generics use in the query system.) - #151808 (Document a safety condition for `TypedArena::alloc_raw_slice`) - #151811 (Fix false positive in unused_parens caused by break) - #151817 (Fix missing syntax context in lifetime hygiene debug output) - #151836 (Fix flakyness issue with `tests/rustdoc-gui/globals.goml` test) - #151844 (rustc-dev-guide subtree update)
Rollup of 5 pull requests Successful merges: - #151777 ( Reduce generics use in the query system.) - #151808 (Document a safety condition for `TypedArena::alloc_raw_slice`) - #151811 (Fix false positive in unused_parens caused by break) - #151817 (Fix missing syntax context in lifetime hygiene debug output) - #151844 (rustc-dev-guide subtree update)
Rollup merge of #151817 - aytey:fix_lifetime_unpretty_hygiene, r=jdonszelmann Fix missing syntax context in lifetime hygiene debug output `-Zunpretty=expanded,hygiene` was not printing the syntax context for lifetimes. For example, two macro-generated lifetimes `'a` with different hygiene would both print as `/* 2538 */` instead of `/* 2538#0 */` and `/* 2538#1 */`, making it impossible to distinguish them. This was fixed by changing `print_lifetime` to call `ann_post()` with the full `Ident`, matching how regular identifiers are handled in `print_ident`. Closes: #151797
Rollup of 5 pull requests Successful merges: - rust-lang/rust#151777 ( Reduce generics use in the query system.) - rust-lang/rust#151808 (Document a safety condition for `TypedArena::alloc_raw_slice`) - rust-lang/rust#151811 (Fix false positive in unused_parens caused by break) - rust-lang/rust#151817 (Fix missing syntax context in lifetime hygiene debug output) - rust-lang/rust#151844 (rustc-dev-guide subtree update)
|
The test you added here has very strange behavior. Just look at its git history: I think it's because this normalization doesn't normalize away newline differences. |
|
… r=fmease Avoid oscillating line wrapping due to symbol indices A comment against PR rust-lang#151817 mentioned that the test file added in this PR kept causing "arbitrary" test file changes. This is because one line of the expanded output sits *just* at 78 columns, which is the pretty-printer's margin. Adding or removing a symbol shifts every index after it, and when one of those gains or loses a digit, the wrapping moves. We cannot use `normalize-stdout` as the layout is decided before normalization runs. We fix this by avoiding a strict golden comparison, and instead using a regex to directly test that the expected syntax contexts exist in the expanded output. **LLM disclosure**: I used an LLM to help me understand the problem and how the regex would look, which the LLM then actioned. I reviewed the diff and the commit (along with the message) was performed by hand with me (with the LLM checking the content of the commit message, but the commit message was, indeed, written by a human).
… r=fmease Avoid oscillating line wrapping due to symbol indices A comment against PR rust-lang#151817 mentioned that the test file added in this PR kept causing "arbitrary" test file changes. This is because one line of the expanded output sits *just* at 78 columns, which is the pretty-printer's margin. Adding or removing a symbol shifts every index after it, and when one of those gains or loses a digit, the wrapping moves. We cannot use `normalize-stdout` as the layout is decided before normalization runs. We fix this by avoiding a strict golden comparison, and instead using a regex to directly test that the expected syntax contexts exist in the expanded output. **LLM disclosure**: I used an LLM to help me understand the problem and how the regex would look, which the LLM then actioned. I reviewed the diff and the commit (along with the message) was performed by hand with me (with the LLM checking the content of the commit message, but the commit message was, indeed, written by a human).
… r=fmease Avoid oscillating line wrapping due to symbol indices A comment against PR rust-lang#151817 mentioned that the test file added in this PR kept causing "arbitrary" test file changes. This is because one line of the expanded output sits *just* at 78 columns, which is the pretty-printer's margin. Adding or removing a symbol shifts every index after it, and when one of those gains or loses a digit, the wrapping moves. We cannot use `normalize-stdout` as the layout is decided before normalization runs. We fix this by avoiding a strict golden comparison, and instead using a regex to directly test that the expected syntax contexts exist in the expanded output. **LLM disclosure**: I used an LLM to help me understand the problem and how the regex would look, which the LLM then actioned. I reviewed the diff and the commit (along with the message) was performed by hand with me (with the LLM checking the content of the commit message, but the commit message was, indeed, written by a human).
… r=fmease Avoid oscillating line wrapping due to symbol indices A comment against PR rust-lang#151817 mentioned that the test file added in this PR kept causing "arbitrary" test file changes. This is because one line of the expanded output sits *just* at 78 columns, which is the pretty-printer's margin. Adding or removing a symbol shifts every index after it, and when one of those gains or loses a digit, the wrapping moves. We cannot use `normalize-stdout` as the layout is decided before normalization runs. We fix this by avoiding a strict golden comparison, and instead using a regex to directly test that the expected syntax contexts exist in the expanded output. **LLM disclosure**: I used an LLM to help me understand the problem and how the regex would look, which the LLM then actioned. I reviewed the diff and the commit (along with the message) was performed by hand with me (with the LLM checking the content of the commit message, but the commit message was, indeed, written by a human).
… r=fmease Avoid oscillating line wrapping due to symbol indices A comment against PR rust-lang#151817 mentioned that the test file added in this PR kept causing "arbitrary" test file changes. This is because one line of the expanded output sits *just* at 78 columns, which is the pretty-printer's margin. Adding or removing a symbol shifts every index after it, and when one of those gains or loses a digit, the wrapping moves. We cannot use `normalize-stdout` as the layout is decided before normalization runs. We fix this by avoiding a strict golden comparison, and instead using a regex to directly test that the expected syntax contexts exist in the expanded output. **LLM disclosure**: I used an LLM to help me understand the problem and how the regex would look, which the LLM then actioned. I reviewed the diff and the commit (along with the message) was performed by hand with me (with the LLM checking the content of the commit message, but the commit message was, indeed, written by a human).
… r=fmease Avoid oscillating line wrapping due to symbol indices A comment against PR rust-lang#151817 mentioned that the test file added in this PR kept causing "arbitrary" test file changes. This is because one line of the expanded output sits *just* at 78 columns, which is the pretty-printer's margin. Adding or removing a symbol shifts every index after it, and when one of those gains or loses a digit, the wrapping moves. We cannot use `normalize-stdout` as the layout is decided before normalization runs. We fix this by avoiding a strict golden comparison, and instead using a regex to directly test that the expected syntax contexts exist in the expanded output. **LLM disclosure**: I used an LLM to help me understand the problem and how the regex would look, which the LLM then actioned. I reviewed the diff and the commit (along with the message) was performed by hand with me (with the LLM checking the content of the commit message, but the commit message was, indeed, written by a human).
… r=fmease Avoid oscillating line wrapping due to symbol indices A comment against PR rust-lang#151817 mentioned that the test file added in this PR kept causing "arbitrary" test file changes. This is because one line of the expanded output sits *just* at 78 columns, which is the pretty-printer's margin. Adding or removing a symbol shifts every index after it, and when one of those gains or loses a digit, the wrapping moves. We cannot use `normalize-stdout` as the layout is decided before normalization runs. We fix this by avoiding a strict golden comparison, and instead using a regex to directly test that the expected syntax contexts exist in the expanded output. **LLM disclosure**: I used an LLM to help me understand the problem and how the regex would look, which the LLM then actioned. I reviewed the diff and the commit (along with the message) was performed by hand with me (with the LLM checking the content of the commit message, but the commit message was, indeed, written by a human).
… r=fmease Avoid oscillating line wrapping due to symbol indices A comment against PR rust-lang#151817 mentioned that the test file added in this PR kept causing "arbitrary" test file changes. This is because one line of the expanded output sits *just* at 78 columns, which is the pretty-printer's margin. Adding or removing a symbol shifts every index after it, and when one of those gains or loses a digit, the wrapping moves. We cannot use `normalize-stdout` as the layout is decided before normalization runs. We fix this by avoiding a strict golden comparison, and instead using a regex to directly test that the expected syntax contexts exist in the expanded output. **LLM disclosure**: I used an LLM to help me understand the problem and how the regex would look, which the LLM then actioned. I reviewed the diff and the commit (along with the message) was performed by hand with me (with the LLM checking the content of the commit message, but the commit message was, indeed, written by a human).
… r=fmease Avoid oscillating line wrapping due to symbol indices A comment against PR rust-lang#151817 mentioned that the test file added in this PR kept causing "arbitrary" test file changes. This is because one line of the expanded output sits *just* at 78 columns, which is the pretty-printer's margin. Adding or removing a symbol shifts every index after it, and when one of those gains or loses a digit, the wrapping moves. We cannot use `normalize-stdout` as the layout is decided before normalization runs. We fix this by avoiding a strict golden comparison, and instead using a regex to directly test that the expected syntax contexts exist in the expanded output. **LLM disclosure**: I used an LLM to help me understand the problem and how the regex would look, which the LLM then actioned. I reviewed the diff and the commit (along with the message) was performed by hand with me (with the LLM checking the content of the commit message, but the commit message was, indeed, written by a human).
Rollup merge of #162608 - aytey:unpretty-hygiene-test-churn, r=fmease Avoid oscillating line wrapping due to symbol indices A comment against PR #151817 mentioned that the test file added in this PR kept causing "arbitrary" test file changes. This is because one line of the expanded output sits *just* at 78 columns, which is the pretty-printer's margin. Adding or removing a symbol shifts every index after it, and when one of those gains or loses a digit, the wrapping moves. We cannot use `normalize-stdout` as the layout is decided before normalization runs. We fix this by avoiding a strict golden comparison, and instead using a regex to directly test that the expected syntax contexts exist in the expanded output. **LLM disclosure**: I used an LLM to help me understand the problem and how the regex would look, which the LLM then actioned. I reviewed the diff and the commit (along with the message) was performed by hand with me (with the LLM checking the content of the commit message, but the commit message was, indeed, written by a human).
Avoid oscillating line wrapping due to symbol indices A comment against PR rust-lang/rust#151817 mentioned that the test file added in this PR kept causing "arbitrary" test file changes. This is because one line of the expanded output sits *just* at 78 columns, which is the pretty-printer's margin. Adding or removing a symbol shifts every index after it, and when one of those gains or loses a digit, the wrapping moves. We cannot use `normalize-stdout` as the layout is decided before normalization runs. We fix this by avoiding a strict golden comparison, and instead using a regex to directly test that the expected syntax contexts exist in the expanded output. **LLM disclosure**: I used an LLM to help me understand the problem and how the regex would look, which the LLM then actioned. I reviewed the diff and the commit (along with the message) was performed by hand with me (with the LLM checking the content of the commit message, but the commit message was, indeed, written by a human).
-Zunpretty=expanded,hygienewas not printing the syntax context for lifetimes. For example, two macro-generated lifetimes'awith different hygiene would both print as/* 2538 */instead of/* 2538#0 */and/* 2538#1 */, making it impossible to distinguish them.This was fixed by changing
print_lifetimeto callann_post()with the fullIdent, matching how regular identifiers are handled inprint_ident.Closes: #151797