-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Use c"lit" for CStrings without unwrap #133701
Conversation
rustbot has assigned @workingjubilee. Use |
The Miri subtree was changed cc @rust-lang/miri This PR modifies cc @jieyouxu rust-analyzer is developed in its own repository. If possible, consider making this change to rust-lang/rust-analyzer instead. cc @rust-lang/rust-analyzer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 from the rust-analyzer side
This comment has been minimized.
This comment has been minimized.
seems good. r=me with the double-doublequote fixed and tidy appeased. @bors delegate+ |
✌️ @kornelski, you can now approve this pull request! If @workingjubilee told you to " |
rust-analyzer is developed in its own repository. If possible, consider making this change to rust-lang/rust-analyzer instead. cc @rust-lang/rust-analyzer This PR modifies cc @jieyouxu The Miri subtree was changed cc @rust-lang/miri |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Ah, didn't notice the paren was off. Thanks! |
…llaumeGomez Rollup of 10 pull requests Successful merges: - rust-lang#131713 (Stabilize `const_maybe_uninit_write`) - rust-lang#133535 (show forbidden_lint_groups in future-compat reports) - rust-lang#133610 (Move `Const::{from_anon_const,try_from_lit}` to hir_ty_lowering) - rust-lang#133701 (Use c"lit" for CStrings without unwrap) - rust-lang#133704 (fix ICE when promoted has layout size overflow) - rust-lang#133705 (add "profiler" and "optimized-compiler-builtins" option coverage for ci-rustc) - rust-lang#133710 (Reducing `target_feature` check-cfg merge conflicts) - rust-lang#133732 (Fix `-Zdump-mir-dataflow`) - rust-lang#133746 (Change `AttrArgs::Eq` to a struct variant) - rust-lang#133763 (Fix `f16::midpoint` const feature gate) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#133701 - kornelski:c-str, r=workingjubilee Use c"lit" for CStrings without unwrap I've reviewed uses of `CString::new("lit")`. Some could be changed to `c"lit"`. Some could be changed to `c"lit".to_owned()`, avoiding an `unwrap()`. Many `CString` documentation examples could be simplified. I deliberately haven't changed all the examples to use the exact same expression, so that they can demonstrate many ways of creating `CString`s. I've left UI tests mostly unchanged, because `c""` requires edition 2021, but most UI tests use 2015, and I didn't want to accidentally change what the tests are testing.
I've reviewed uses of
CString::new("lit")
.Some could be changed to
c"lit"
. Some could be changed toc"lit".to_owned()
, avoiding anunwrap()
.Many
CString
documentation examples could be simplified. I deliberately haven't changed all the examples to use the exact same expression, so that they can demonstrate many ways of creatingCString
s.I've left UI tests mostly unchanged, because
c""
requires edition 2021, but most UI tests use 2015, and I didn't want to accidentally change what the tests are testing.