Skip to content

Conversation

scintillavoy
Copy link

@scintillavoy scintillavoy commented Aug 7, 2025

This PR updates the documentation under "Compiling protoc from source" to avoid using unsafe std::env::set_var.

std::env::set_var becomes unsafe in Rust 2024 unless certain strict single-threaded conditions are met. While we could wrap the call in an unsafe block, introducing unsafe just for setting an environment variable isn't worth the added complexity. Instead, the example now uses the prost_build::Config::protoc_executable method to directly set the path to the protoc binary.

Copy link
Contributor

@caspermeijn caspermeijn left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution

@caspermeijn caspermeijn changed the title Update protobuf-src example to avoid unsafe set_var docs: Update protobuf-src example to avoid unsafe set_var Oct 6, 2025
@caspermeijn caspermeijn enabled auto-merge October 6, 2025 08:02
@caspermeijn
Copy link
Contributor

@scintillavoy Please rebase to latest main. Some changes were made to our CI.

auto-merge was automatically disabled October 6, 2025 08:06

Head branch was pushed to by a user without write access

@scintillavoy scintillavoy force-pushed the update-protobuf-src-example branch from b378bf8 to a0feaf4 Compare October 6, 2025 08:06
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.

2 participants