Skip to content

Commit 48fef73

Browse files
committed
Auto merge of #133770 - GuillaumeGomez:rollup-l62iyyx, r=GuillaumeGomez
Rollup of 10 pull requests Successful merges: - #131713 (Stabilize `const_maybe_uninit_write`) - #133535 (show forbidden_lint_groups in future-compat reports) - #133610 (Move `Const::{from_anon_const,try_from_lit}` to hir_ty_lowering) - #133701 (Use c"lit" for CStrings without unwrap) - #133704 (fix ICE when promoted has layout size overflow) - #133705 (add "profiler" and "optimized-compiler-builtins" option coverage for ci-rustc) - #133710 (Reducing `target_feature` check-cfg merge conflicts) - #133732 (Fix `-Zdump-mir-dataflow`) - #133746 (Change `AttrArgs::Eq` to a struct variant) - #133763 (Fix `f16::midpoint` const feature gate) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 80c2e8b + 1b46d2d commit 48fef73

File tree

3 files changed

+7
-10
lines changed

3 files changed

+7
-10
lines changed

tests/pass-dep/libc/libc-fs-symlink.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,8 @@ fn test_readlink() {
4747
assert_eq!(res, small_buf.len() as isize);
4848

4949
// Test that we report a proper error for a missing path.
50-
let bad_path = CString::new("MIRI_MISSING_FILE_NAME").unwrap();
5150
let res = unsafe {
52-
libc::readlink(bad_path.as_ptr(), small_buf.as_mut_ptr().cast(), small_buf.len())
51+
libc::readlink(c"MIRI_MISSING_FILE_NAME".as_ptr(), small_buf.as_mut_ptr().cast(), small_buf.len())
5352
};
5453
assert_eq!(res, -1);
5554
assert_eq!(Error::last_os_error().kind(), ErrorKind::NotFound);

tests/pass-dep/libc/libc-fs-with-isolation.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
//@compile-flags: -Zmiri-isolation-error=warn-nobacktrace
33
//@normalize-stderr-test: "(stat(x)?)" -> "$$STAT"
44

5-
use std::ffi::CString;
65
use std::fs;
76
use std::io::{Error, ErrorKind};
87

@@ -13,10 +12,9 @@ fn main() {
1312
}
1413

1514
// test `readlink`
16-
let symlink_c_str = CString::new("foo.txt").unwrap();
1715
let mut buf = vec![0; "foo_link.txt".len() + 1];
1816
unsafe {
19-
assert_eq!(libc::readlink(symlink_c_str.as_ptr(), buf.as_mut_ptr(), buf.len()), -1);
17+
assert_eq!(libc::readlink(c"foo.txt".as_ptr(), buf.as_mut_ptr(), buf.len()), -1);
2018
assert_eq!(Error::last_os_error().raw_os_error(), Some(libc::EACCES));
2119
}
2220

tests/pass-dep/libc/libc-mem.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,12 @@ fn test_memcpy() {
5555
}
5656

5757
fn test_strcpy() {
58-
use std::ffi::{CStr, CString};
58+
use std::ffi::CStr;
5959

6060
// case: src_size equals dest_size
6161
unsafe {
62-
let src = CString::new("rust").unwrap();
63-
let size = src.as_bytes_with_nul().len();
62+
let src = c"rust";
63+
let size = src.to_bytes_with_nul().len();
6464
let dest = libc::malloc(size);
6565
libc::strcpy(dest as *mut libc::c_char, src.as_ptr());
6666
assert_eq!(CStr::from_ptr(dest as *const libc::c_char), src.as_ref());
@@ -69,8 +69,8 @@ fn test_strcpy() {
6969

7070
// case: src_size is less than dest_size
7171
unsafe {
72-
let src = CString::new("rust").unwrap();
73-
let size = src.as_bytes_with_nul().len();
72+
let src = c"rust";
73+
let size = src.to_bytes_with_nul().len();
7474
let dest = libc::malloc(size + 1);
7575
libc::strcpy(dest as *mut libc::c_char, src.as_ptr());
7676
assert_eq!(CStr::from_ptr(dest as *const libc::c_char), src.as_ref());

0 commit comments

Comments
 (0)