Skip to content

unstable-book: Add stubs for environment variables; document some of the important ones #141624

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jyn514
Copy link
Member

@jyn514 jyn514 commented May 27, 2025

This uses a very hacky regex that will probably miss some variables. But having some docs seems better than none at all.

In particular, this documents the following env vars explicitly (cc @madsmtm @flba-eb - do the docs for SDKROOT and QNX_TARGET look right?):

  • COLORTERM
  • QNX_TARGET
  • SDKROOT
  • TERM

and generates stubs for the following env vars:

  • RUST_BACKTRACE
  • RUSTC_BLESS
  • RUSTC_BREAK_ON_ICE
  • RUSTC_CTFE_BACKTRACE
  • RUSTC_FORCE_RUSTC_VERSION
  • RUSTC_GRAPHVIZ_FONT
  • RUSTC_ICE
  • RUSTC_LOG
  • RUSTC_RETRY_LINKER_ON_SEGFAULT
  • RUSTC_TRANSLATION_NO_DEBUG_ASSERT
  • RUST_DEP_GRAPH_FILTER
  • RUST_DEP_GRAPH
  • RUST_FORBID_DEP_GRAPH_EDGE
  • RUST_MIN_STACK
  • RUST_TARGET_PATH
  • UNSTABLE_RUSTDOC_TEST_LINE
  • UNSTABLE_RUSTDOC_TEST_PATH

rendered: screenshot of unstable-book running locally, with 14 environment variables shown in the sidebar

@rustbot
Copy link
Collaborator

rustbot commented May 27, 2025

r? @BoxyUwU

rustbot has assigned @BoxyUwU.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added A-tidy Area: The tidy tool S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels May 27, 2025
This uses a very hacky regex that will probably miss some variables. But
having some docs seems better than none at all.

This uses a very hacky regex that will probably miss some variables. But having some docs seems better than none at all.

In particular, this generates stubs for the following env vars:

- COLORTERM
- QNX_TARGET
- RUST_BACKTRACE
- RUSTC_BLESS
- RUSTC_BOOTSTRAP
- RUSTC_BREAK_ON_ICE
- RUSTC_CTFE_BACKTRACE
- RUSTC_FORCE_RUSTC_VERSION
- RUSTC_GRAPHVIZ_FONT
- RUSTC_ICE
- RUSTC_LOG
- RUSTC_OVERRIDE_VERSION_STRING
- RUSTC_RETRY_LINKER_ON_SEGFAULT
- RUSTC_TRANSLATION_NO_DEBUG_ASSERT
- RUST_DEP_GRAPH_FILTER
- RUST_DEP_GRAPH
- RUST_FORBID_DEP_GRAPH_EDGE
- RUST_MIN_STACK
- RUST_TARGET_PATH
- SDKROOT
- TERM
- UNSTABLE_RUSTDOC_TEST_LINE
- UNSTABLE_RUSTDOC_TEST_PATH

[rendered](![screenshot of unstable-book running locally, with 14 environment variables shown in the sidebar](https://github.com/user-attachments/assets/8238d094-fb7a-456f-ad43-7c07aa2c44dd))
Copy link
Member

@BoxyUwU BoxyUwU left a comment

Choose a reason for hiding this comment

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

u said you'd get someone else to review the hand written documentation

@BoxyUwU BoxyUwU added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 8, 2025
Copy link
Contributor

@madsmtm madsmtm left a comment

Choose a reason for hiding this comment

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

SDKROOT docs look good with nits applied (sorry, forgot about the PR until the ping)

@@ -0,0 +1,6 @@
# `SDKROOT`

This environment variable is used on MacOS targets.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
This environment variable is used on MacOS targets.
This environment variable is used on Apple targets.

# `SDKROOT`

This environment variable is used on MacOS targets.
It is passed through to the linker (either as `-isysroot` or `-syslibroot`) without changes.
Copy link
Contributor

Choose a reason for hiding this comment

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

I still plan to change this in #131477 (though if you want, you can keep the text as-is for now).

Suggested change
It is passed through to the linker (either as `-isysroot` or `-syslibroot`) without changes.
It is passed through to the linker (currently either as `-isysroot` or `-syslibroot`).

See [the QNX docs] for more background information.

[set this variable]: https://www.qnx.com/developers/docs/qsc/com.qnx.doc.qsc.inst_larg_org/topic/build_server_developer_steps.html
[the QNX docs]: https://www.qnx.com/developers/docs/7.1/index.html#com.qnx.doc.neutrino.io_sock/topic/migrate_app.html.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
[the QNX docs]: https://www.qnx.com/developers/docs/7.1/index.html#com.qnx.doc.neutrino.io_sock/topic/migrate_app.html.
[the QNX docs]: https://www.qnx.com/developers/docs/7.1/#com.qnx.doc.neutrino.io_sock/topic/migrate_app.html.

Blackberry changed the link. Would be great if you could also update the link in compiler/rustc_target/src/spec/base/nto_qnx.rs!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tidy Area: The tidy tool S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants