Skip to content

Add immutability as a string_view invariant and remove unsafe#621

Merged
copybara-service[bot] merged 1 commit intomainfrom
test_879103684
Mar 6, 2026
Merged

Add immutability as a string_view invariant and remove unsafe#621
copybara-service[bot] merged 1 commit intomainfrom
test_879103684

Conversation

@copybara-service
Copy link

Add immutability as a string_view invariant and remove unsafe

Mutating data while it is pointed to by a string_view is
prohibitively weird and nonstandard behavior in C++. APIs that
traffic in string_view come with a standard expectation that the
underlying data is immutable for the lifetime of the string_view.

Therefore, we should not push meaningless unsafe to Rust users in order
to justify a standard invariant.

Mutating data while it is pointed to by a `string_view` is
prohibitively weird and nonstandard behavior in C++. APIs that
traffic in `string_view` come with a standard expectation that the
underlying data is immutable for the lifetime of the `string_view`.

Therefore, we should not push meaningless `unsafe` to Rust users in order
to justify a standard invariant.

PiperOrigin-RevId: 879785327
@copybara-service copybara-service bot merged commit a02a069 into main Mar 6, 2026
@copybara-service copybara-service bot deleted the test_879103684 branch March 6, 2026 21:14
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.

1 participant