Skip to content
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

Add unstable option to nul-terminate location strings #135240

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Darksonn
Copy link
Contributor

@Darksonn Darksonn commented Jan 8, 2025

This is an alternative to #135054 for the ACP rust-lang/libs-team#466 that provides a compiler flag for adding a nul-terminator to filename strings.

Personally I still prefer adding a dedicated method to avoid provenance crimes, but this approach allows users to avoid increasing the binary size.

One potential way to avoid provenance questions is to add a Location::file_ptr method that returns a *const u8 pointer to the filename. This raw pointer can have provenance to access the nul-terminator even if the &str doesn't.

The new option is added to -Zlocation-detail instead of adding a new flag. This seems to be the simplest way to provide the option. Since -Zlocation-detail is unstable, this does not commit to supporting the feature.

@rustbot
Copy link
Collaborator

rustbot commented Jan 8, 2025

r? @fmease

rustbot has assigned @fmease.
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 S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jan 8, 2025
@rustbot
Copy link
Collaborator

rustbot commented Jan 8, 2025

Some changes occurred to the CTFE machinery

cc @rust-lang/wg-const-eval

@oli-obk oli-obk assigned oli-obk and unassigned fmease Jan 8, 2025
@oli-obk oli-obk added I-needs-decision Issue: In need of a decision. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-needs-decision Issue: In need of a decision. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants