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 to_c_str_opt/with_c_str_opt functions and fix an ICE #17435

Closed
wants to merge 1 commit into from
Closed

Add to_c_str_opt/with_c_str_opt functions and fix an ICE #17435

wants to merge 1 commit into from

Conversation

kaseyc
Copy link
Contributor

@kaseyc kaseyc commented Sep 22, 2014

Add to_c_str_opt and with_c_str_opt functions to the ToCStr trait. These functions return an Option if the string they are passed contains a null byte, rather than failing the task like to_c_str/with_c_str.

Updated get_item_val in middle/trans/base to use these functions to fix the ICE in issue #16478.

Fixes #16478

…ese functions return an Option if

the string they are passed contains a null byte, rather than failing the task like to_c_str/with_c_str.

Updated get_item_val in middle/trans/base to use these functions to fix the ICE in issue #16478
@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @aturon (or someone else) soon.

@rust-highfive
Copy link
Collaborator

warning Warning warning

  • These commits modify unsafe code. Please review it carefully!

@aturon
Copy link
Member

aturon commented Sep 22, 2014

@kaseyc Thanks for this PR! Unfortunately, the question of whether/when to provide such _opt variants is still under debate.

For the time being, could you instead fix the ICE by having the rustc code check for nulls itself, in advance of calling with_c_str etc?

@kaseyc
Copy link
Contributor Author

kaseyc commented Sep 22, 2014

Not a problem. Thanks!

@kaseyc kaseyc closed this Sep 22, 2014
lnicola pushed a commit to lnicola/rust that referenced this pull request Jun 23, 2024
…ykril

docs: fix manual generation instructions

To generate all the requisite files, you need to run `cargo xtask codegen` not `cargo test -p xtask`.
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.

ICE from c_str with null character
3 participants