Skip to content

Fix the glossary definition of codegen - #3065

Closed
isHeSatoshi wants to merge 1 commit into
rust-lang:mainfrom
isHeSatoshi:fix-codegen-glossary-definition
Closed

isHeSatoshi wants to merge 1 commit into
rust-lang:mainfrom
isHeSatoshi:fix-codegen-glossary-definition

Conversation

@isHeSatoshi

@isHeSatoshi isHeSatoshi commented Oct 19, 2026 •

Copy link
Copy Markdown

The glossary defined codegen as "the code to translate MIR into LLVM IR", and the trans entry repeated that wording. That describes the input to codegen rather than codegen itself, and it reads as if rustc emitted LLVM IR as its final step.

The [codegen chapter] already says it the other way round:

Code generation (or "codegen") is the part of the compiler that actually generates an executable binary. Usually, rustc uses LLVM for code generation, but there is also support for Cranelift and GCC. The key is that rustc doesn't implement codegen itself. It's worth noting, though, that in the Rust source code, many parts of the backend have codegen in their names (there are no hard boundaries).

So the glossary entry now matches the chapter, keeps the point that the boundary is not sharp (the reason the old wording was half right), and links to the chapter. The trans entry no longer repeats the definition; it just points at codegen.

Verified: the link target ../backend/codegen.md resolves, and the anchor #codegen is unchanged, so existing links to it keep working.

Fixes #637.

@rustbot

rustbot commented Oct 19, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the PR. If you have write access, feel free to merge this PR if it does not need reviews. You can request a review using r? rustc-dev-guide or r? <username>.

@rustbot rustbot added the S-waiting-on-review Status: this PR is waiting for a reviewer to verify its content label Oct 19, 2026
@isHeSatoshi

This comment was marked as low quality.

Comment thread src/appendix/glossary.md Outdated
<span id="tls">[TLS]</span> | _Thread-local storage_. Variables may be defined so that each thread has its own copy (rather than all threads sharing the variable). This has some interactions with LLVM. Not all platforms support TLS.
<span id="trait-ref">trait reference, trait ref </span> | The name of a trait along with a suitable list of generic arguments. ([see more](../traits/goals-and-clauses.md#trait-ref))
<span id="trans">trans 👎</span> | Short for _translation_, the code to translate MIR into LLVM IR. **Renamed to** [codegen](#codegen).
<span id="trans">trans 👎</span> | Short for _translation_, the old name for [codegen](#codegen). **Renamed to** [codegen](#codegen).

@fmease fmease Oct 19, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The following sentence already states that the term trans was "renamed" (replaced) with "codegen", so one of the two clauses is redundant.

View changes since the review

This comment was marked as low quality.

The glossary said codegen is "the code to translate MIR into LLVM IR", which
describes rustc's own work rather than what codegen is: rustc does not implement
code generation, it hands that to LLVM or to another backend.

The codegen chapter already puts it the other way round ("the part of the
compiler that actually generates an executable binary ... rustc doesn't
implement codegen itself ... there are no hard boundaries"), so the glossary now
agrees with it and links there.

The `trans` entry repeated the same wording. It now follows the shape of the
`LTA` entry instead: the expansion of the abbreviation, then the term it was
renamed to, without restating the rename twice.
@BoxyUwU BoxyUwU closed this Oct 19, 2026
@rustbot rustbot removed the S-waiting-on-review Status: this PR is waiting for a reviewer to verify its content label Oct 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

improve/fix "codegen" definition

5 participants