-
Notifications
You must be signed in to change notification settings - Fork 540
as
cast improvements
#1732
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
as
cast improvements
#1732
Conversation
`&m1 T -> *m2 T` is not specific to `as` casts (it's a coercion!), but `*[T; N]` -> `*T` is! (previously only the reference source version was documented)
Am I reading the CI failure correctly? It seems to imply that footnotes are global and you can't have |
Because all pages are concatenated together to generate the print page. mdbook currently doesn't have the ability to rewrite the markdown to make the footnotes unique. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Will merge with the footnote labels fixed (probably can pick some short words for those?).
I suppose eventually we should be a little clearer about the normative nature of whether or not a footnote counts.
apparently mdbook requires them to have globally unique identifiers (but they are still rendered as ^1, ^2, ...)
01a5356
to
39d94e1
Compare
@ehuss fixed 👍🏻 |
Update books ## rust-lang/book 1 commits in e2fa4316c5a7c0d2499c5d6b799adcfad6ef7a45..d4d2c18cbd20876b2130a546e790446a8444cb32 2025-02-12 16:22:54 UTC to 2025-02-12 16:22:54 UTC - Fix example for `cargo fix` (rust-lang/book#4226) ## rust-lang/reference 3 commits in de2d5289e45506b11dd652bef4f99de64be70e1c..6195dbd70fc6f0980c314b4d23875ac570d8253a 2025-02-12 15:40:30 UTC to 2025-02-11 20:35:17 UTC - Revert "Update function-pointer.md for stabilization of `extended_varargs_abi_support`" (rust-lang/reference#1734) - Rework error handling in mdbook-spec (rust-lang/reference#1733) - `as` cast improvements (rust-lang/reference#1732)
Update books ## rust-lang/book 1 commits in e2fa4316c5a7c0d2499c5d6b799adcfad6ef7a45..d4d2c18cbd20876b2130a546e790446a8444cb32 2025-02-12 16:22:54 UTC to 2025-02-12 16:22:54 UTC - Fix example for `cargo fix` (rust-lang/book#4226) ## rust-lang/reference 3 commits in de2d5289e45506b11dd652bef4f99de64be70e1c..6195dbd70fc6f0980c314b4d23875ac570d8253a 2025-02-12 15:40:30 UTC to 2025-02-11 20:35:17 UTC - Revert "Update function-pointer.md for stabilization of `extended_varargs_abi_support`" (rust-lang/reference#1734) - Rework error handling in mdbook-spec (rust-lang/reference#1733) - `as` cast improvements (rust-lang/reference#1732)
Rollup merge of rust-lang#136937 - rustbot:docs-update, r=ehuss Update books ## rust-lang/book 1 commits in e2fa4316c5a7c0d2499c5d6b799adcfad6ef7a45..d4d2c18cbd20876b2130a546e790446a8444cb32 2025-02-12 16:22:54 UTC to 2025-02-12 16:22:54 UTC - Fix example for `cargo fix` (rust-lang/book#4226) ## rust-lang/reference 3 commits in de2d5289e45506b11dd652bef4f99de64be70e1c..6195dbd70fc6f0980c314b4d23875ac570d8253a 2025-02-12 15:40:30 UTC to 2025-02-11 20:35:17 UTC - Revert "Update function-pointer.md for stabilization of `extended_varargs_abi_support`" (rust-lang/reference#1734) - Rework error handling in mdbook-spec (rust-lang/reference#1733) - `as` cast improvements (rust-lang/reference#1732)
Update books ## rust-lang/book 1 commits in e2fa4316c5a7c0d2499c5d6b799adcfad6ef7a45..d4d2c18cbd20876b2130a546e790446a8444cb32 2025-02-12 16:22:54 UTC to 2025-02-12 16:22:54 UTC - Fix example for `cargo fix` (rust-lang/book#4226) ## rust-lang/reference 3 commits in de2d5289e45506b11dd652bef4f99de64be70e1c..6195dbd70fc6f0980c314b4d23875ac570d8253a 2025-02-12 15:40:30 UTC to 2025-02-11 20:35:17 UTC - Revert "Update function-pointer.md for stabilization of `extended_varargs_abi_support`" (rust-lang/reference#1734) - Rework error handling in mdbook-spec (rust-lang/reference#1733) - `as` cast improvements (rust-lang/reference#1732)
| [Function pointer] | Integer | Function pointer to address cast | | ||
| Closure [^no-capture] | Function pointer | Closure to function pointer cast | | ||
|
||
[^meta-compat]: where `T` and `V` have compatible metadata: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This being a footnote makes it really difficult to actually find this information. Why is it not just present in the pointer-to-pointer cast section as proper text?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you expand on this being difficult to find? You can just click the footnote link, right?
The reason it's not in pointer-to-pointer cast section is that it's a requirement, rather than effect.
I wish footnotes would be rendered where they are defined, rather than at the bottom. And if it's impossible I suppose we could refactor this so it doesn't use footnotes...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know or expect to have to click the footnote to find fundamental information about how the cast behaves, especially when there's already a non-footnote section about the behaviour of the cast. Footnotes are for "unimportant" extra bits of important information, not main parts of the text.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The little footnote indicator is also just really easy to miss as part of a big table of information. (But even if I had noticed it I would not have clicked on it to try and find this information)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Honestly I could still imagine missing it, when I see that table my first instinct is to click on the "Pointer to pointer casts" header to see all information about pointer to pointer casts. Having the footnotes right below would definitely be an improvement though
Improve the description of
as
casts, see individual commits for more info.