Skip to content

Clarify std::env::args encoding requirements - #4800

Open
coyaSONG wants to merge 1 commit into
rust-lang:mainfrom
coyaSONG:docs/clarify-args-encoding
Open

Clarify std::env::args encoding requirements#4800
coyaSONG wants to merge 1 commit into
rust-lang:mainfrom
coyaSONG:docs/clarify-args-encoding

Conversation

@coyaSONG

Copy link
Copy Markdown

Closes #4796.

Clarifies that std::env::args panics when an operating-system argument cannot be represented as a Rust String. The text now calls out the platform-specific cases: invalid UTF-8 on Unix and invalid UTF-16 on Windows.

This avoids implying that Unicode itself is invalid while remaining accurate across platforms.

Tested with:

  • npx --yes dprint check src/ch12-01-accepting-command-line-arguments.md
  • mdbook build using the CI version, 0.5.1
  • bash ci/validate.sh
  • cargo run --bin lfp src

AI-assisted: Codex. I verified the wording against the official std::env::args and OsString documentation and reviewed the generated HTML.

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.

Ch12: Clarification that std::env::args panics on invalid UTF-8 instead of "invalid Unicode"

1 participant