Skip to content

Refactor rendering with RenderCtx #1796

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

Merged
merged 1 commit into from
Apr 17, 2025
Merged

Conversation

traviscross
Copy link
Contributor

We thread certain contextual information through to most of our rendering functions. Currently this information includes whether the rendering is for the summary page and the two link maps. Adding new information to thread through, or changing something that was only using a subset to use more of the context, requires touching a lot of places.

Let's improve this by refactoring these details into a RenderCtx that we'll thread through everywhere instead. In this way, new details can simply be added to this struct, and callees can use whatever details are needed.

@rustbot rustbot added the S-waiting-on-review Status: The marked PR is awaiting review from a maintainer label Apr 17, 2025
Copy link
Contributor

@ehuss ehuss left a comment

Choose a reason for hiding this comment

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

Seems good to me.

We thread certain contextual information through to most of our rendering
functions.  Currently this information includes whether the rendering
is for the summary page and the two link maps.  Adding new information
to thread through, or changing something that was only using a subset
to use more of the context, requires touching a lot of places.

Let's improve this by refactoring these details into a `RenderCtx`
that we'll thread through everywhere instead.  In this way, new
details can simply be added to this struct, and callees can use
whatever details are needed.
@traviscross traviscross force-pushed the TC/refactor-with-renderctx branch from 662dd5d to 57ea6a8 Compare April 17, 2025 22:52
@traviscross traviscross marked this pull request as ready for review April 17, 2025 22:58
@traviscross traviscross added this pull request to the merge queue Apr 17, 2025
Merged via the queue into master with commit f313a01 Apr 17, 2025
5 checks passed
ChrisDenton added a commit to ChrisDenton/rust that referenced this pull request Apr 22, 2025
Update books

## rust-lang/nomicon

1 commits in 0c10c30cc54736c5c194ce98c50e2de84eeb6e79..c76a20f0d987145dcedf05c5c073ce8d91f2e82a
2025-04-15 20:54:57 UTC to 2025-04-15 20:54:57 UTC

- Say that dereferencing a pointer to a ZST is no longer undefined (rust-lang/nomicon#467)

## rust-lang/reference

7 commits in 3340922df189bddcbaad17dc3927d51a76bcd5ed..3bf3402aea982b876eb56c87da17b0685c6461d5
2025-04-18 13:44:45 UTC to 2025-04-17 17:27:01 UTC

- Use `cfg(false)` instead of `cfg(FALSE)` (rust-lang/reference#1763)
-     Add `cfg(true)` and `cfg(false)` to conditional compilation (RFC 3695) (rust-lang/reference#1762)
- Refactor rendering with `RenderCtx` (rust-lang/reference#1796)
- attributes/codegen: update aarch64 features (rust-lang/reference#1791)
- Simplify GenericParams grammar (rust-lang/reference#1795)
- Add rule identifiers for the ABI chapter (rust-lang/reference#1793)
- Remove broken footnote links from grammar summary (rust-lang/reference#1794)
ChrisDenton added a commit to ChrisDenton/rust that referenced this pull request Apr 22, 2025
Update books

## rust-lang/nomicon

1 commits in 0c10c30cc54736c5c194ce98c50e2de84eeb6e79..c76a20f0d987145dcedf05c5c073ce8d91f2e82a
2025-04-15 20:54:57 UTC to 2025-04-15 20:54:57 UTC

- Say that dereferencing a pointer to a ZST is no longer undefined (rust-lang/nomicon#467)

## rust-lang/reference

7 commits in 3340922df189bddcbaad17dc3927d51a76bcd5ed..3bf3402aea982b876eb56c87da17b0685c6461d5
2025-04-18 13:44:45 UTC to 2025-04-17 17:27:01 UTC

- Use `cfg(false)` instead of `cfg(FALSE)` (rust-lang/reference#1763)
-     Add `cfg(true)` and `cfg(false)` to conditional compilation (RFC 3695) (rust-lang/reference#1762)
- Refactor rendering with `RenderCtx` (rust-lang/reference#1796)
- attributes/codegen: update aarch64 features (rust-lang/reference#1791)
- Simplify GenericParams grammar (rust-lang/reference#1795)
- Add rule identifiers for the ABI chapter (rust-lang/reference#1793)
- Remove broken footnote links from grammar summary (rust-lang/reference#1794)
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Apr 23, 2025
Rollup merge of rust-lang#140124 - rustbot:docs-update, r=ehuss

Update books

## rust-lang/nomicon

1 commits in 0c10c30cc54736c5c194ce98c50e2de84eeb6e79..c76a20f0d987145dcedf05c5c073ce8d91f2e82a
2025-04-15 20:54:57 UTC to 2025-04-15 20:54:57 UTC

- Say that dereferencing a pointer to a ZST is no longer undefined (rust-lang/nomicon#467)

## rust-lang/reference

7 commits in 3340922df189bddcbaad17dc3927d51a76bcd5ed..3bf3402aea982b876eb56c87da17b0685c6461d5
2025-04-18 13:44:45 UTC to 2025-04-17 17:27:01 UTC

- Use `cfg(false)` instead of `cfg(FALSE)` (rust-lang/reference#1763)
-     Add `cfg(true)` and `cfg(false)` to conditional compilation (RFC 3695) (rust-lang/reference#1762)
- Refactor rendering with `RenderCtx` (rust-lang/reference#1796)
- attributes/codegen: update aarch64 features (rust-lang/reference#1791)
- Simplify GenericParams grammar (rust-lang/reference#1795)
- Add rule identifiers for the ABI chapter (rust-lang/reference#1793)
- Remove broken footnote links from grammar summary (rust-lang/reference#1794)
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Apr 23, 2025
Update books

## rust-lang/nomicon

1 commits in 0c10c30cc54736c5c194ce98c50e2de84eeb6e79..c76a20f0d987145dcedf05c5c073ce8d91f2e82a
2025-04-15 20:54:57 UTC to 2025-04-15 20:54:57 UTC

- Say that dereferencing a pointer to a ZST is no longer undefined (rust-lang/nomicon#467)

## rust-lang/reference

7 commits in 3340922df189bddcbaad17dc3927d51a76bcd5ed..3bf3402aea982b876eb56c87da17b0685c6461d5
2025-04-18 13:44:45 UTC to 2025-04-17 17:27:01 UTC

- Use `cfg(false)` instead of `cfg(FALSE)` (rust-lang/reference#1763)
-     Add `cfg(true)` and `cfg(false)` to conditional compilation (RFC 3695) (rust-lang/reference#1762)
- Refactor rendering with `RenderCtx` (rust-lang/reference#1796)
- attributes/codegen: update aarch64 features (rust-lang/reference#1791)
- Simplify GenericParams grammar (rust-lang/reference#1795)
- Add rule identifiers for the ABI chapter (rust-lang/reference#1793)
- Remove broken footnote links from grammar summary (rust-lang/reference#1794)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: The marked PR is awaiting review from a maintainer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants