rustdoc: Avoid ICE on unevaluated type const projections in array lengths#158171
Conversation
|
r? @camelid rustbot has assigned @camelid. Use Why was this reviewer chosen?The reviewer was selected based on:
|
This comment has been minimized.
This comment has been minimized.
c256212 to
7a6277d
Compare
There was a problem hiding this comment.
Could you move this test to the rustdoc-html directory, and then you can add @has checks to make sure the HTML output is actually correct? Currently this test just makes sure rustdoc doesn't crash, but not that the output looks right. So basically for both your new test case and the existing one in the file, add a check that the type renders correctly as [(); <T as Tr>::SIZE].
You can see examples of how @has checks look in the other tests in rustdoc-html, or the docs for it here. Feel free to ask me here or on Zulip if you need help!
There was a problem hiding this comment.
Thanks, updated the test. Additionally, when actually adding the @has check, I found that the previous fix alone result in the HTML displaying [(); const SIZE: usize;]. This issue occurred because print_inlined_const() was displaying the definition side for assoc const projections without bodies, so I've included a corresponding fix for this as well.
7a6277d to
c503572
Compare
0b9758a to
a616db3
Compare
|
@rustbot ready |
|
@bors r+ rollup |
…uwer Rollup of 8 pull requests Successful merges: - #158242 (Fix linking for wasm with crate metadata included) - #157978 (Avoid `&raw` recovery ICE after trailing comma) - #158119 (Refactor `proc_macro_decls_static`) - #158171 (rustdoc: Avoid ICE on unevaluated `type const` projections in array lengths) - #158172 (update `asm_experimental_reg` comments) - #158230 (Include `Item::stability` info in rustdoc JSON.) - #158258 (Use an unexpanded span for actually written down opt out params) - #158262 (Change compiler leads in triagebot.toml)
…uwer Rollup of 8 pull requests Successful merges: - #158242 (Fix linking for wasm with crate metadata included) - #157978 (Avoid `&raw` recovery ICE after trailing comma) - #158119 (Refactor `proc_macro_decls_static`) - #158171 (rustdoc: Avoid ICE on unevaluated `type const` projections in array lengths) - #158172 (update `asm_experimental_reg` comments) - #158230 (Include `Item::stability` info in rustdoc JSON.) - #158258 (Use an unexpanded span for actually written down opt out params) - #158262 (Change compiler leads in triagebot.toml)
…uwer Rollup of 8 pull requests Successful merges: - #158242 (Fix linking for wasm with crate metadata included) - #157978 (Avoid `&raw` recovery ICE after trailing comma) - #158119 (Refactor `proc_macro_decls_static`) - #158171 (rustdoc: Avoid ICE on unevaluated `type const` projections in array lengths) - #158172 (update `asm_experimental_reg` comments) - #158230 (Include `Item::stability` info in rustdoc JSON.) - #158258 (Use an unexpanded span for actually written down opt out params) - #158262 (Change compiler leads in triagebot.toml)
…uwer Rollup of 8 pull requests Successful merges: - #158242 (Fix linking for wasm with crate metadata included) - #157978 (Avoid `&raw` recovery ICE after trailing comma) - #158119 (Refactor `proc_macro_decls_static`) - #158171 (rustdoc: Avoid ICE on unevaluated `type const` projections in array lengths) - #158172 (update `asm_experimental_reg` comments) - #158230 (Include `Item::stability` info in rustdoc JSON.) - #158258 (Use an unexpanded span for actually written down opt out params) - #158262 (Change compiler leads in triagebot.toml)
Rollup merge of #158171 - lapla-cogito:issue_158155, r=camelid rustdoc: Avoid ICE on unevaluated `type const` projections in array lengths `clean_middle_ty` used `normalize_erasing_regions` when rendering array lengths, which panics on unevaluatable associated const projections such as `<T as Trait>::ASSOC` under mGCA. Fixes #158155
…camelid rustdoc: Show use-site paths for unevaluated const array lengths After rust-lang#158171, I noticed a few additional issues with the rendering of consts in rustdoc. This PR fixes them. When rendering array lengths, avoid inlining the full definition of unevaluated constants via `print_inlined_const`. Instead, fall back to `Const::to_string()` for use-site rendering, matching the behavior already used for projections without bodies. r? camelid
Rollup merge of #158334 - lapla-cogito:rustdoc_typeconst, r=camelid rustdoc: Show use-site paths for unevaluated const array lengths After #158171, I noticed a few additional issues with the rendering of consts in rustdoc. This PR fixes them. When rendering array lengths, avoid inlining the full definition of unevaluated constants via `print_inlined_const`. Instead, fall back to `Const::to_string()` for use-site rendering, matching the behavior already used for projections without bodies. r? camelid
clean_middle_tyusednormalize_erasing_regionswhen rendering array lengths, which panics on unevaluatable associated const projections such as<T as Trait>::ASSOCunder mGCA.Fixes #158155