Made fail_bounds_check more careful with strings.#12357
Made fail_bounds_check more careful with strings.#12357bors merged 1 commit intorust-lang:masterfrom chromatic:gh_11976_fail_bounds_check_str
Conversation
src/libstd/unstable/lang.rs
Outdated
There was a problem hiding this comment.
Why does this need a separate function? Can't it be
let file_str = match unsafe {CString::new(file as *c_char, false)}.as_str() {
Some(s) => ...,
None => ...
};There was a problem hiding this comment.
Oh, that's much better! (Thanks for teaching me a new idiom.)
|
General question (not necessarily to @chromatic): is there a reason we can't emit the file names as |
src/libstd/unstable/lang.rs
Outdated
There was a problem hiding this comment.
Can you add a comment for why this transmute is safe? Something along the lines of how the file is stored in rodata which is indeed static.
We could certainly do that, I thought we had an issue open on that, but I can't seem to find it... |
|
(I opened #12378 about avoiding |
fix: When reference searching macro inputs, don't search everything that was downmapped Fixes rust-lang/rust-analyzer#11668
… `.clone()` (rust-lang#14174) fixes rust-lang#12357 changelog: [`useless_asref`]: don't suggest to use `.clone()` if the target type doesn't implement the `Clone` trait
Fixes #11976.