Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 2120459

Browse files
committedMar 23, 2025
Auto merge of rust-lang#138866 - compiler-errors:rollup-9d8v3mz, r=compiler-errors
Rollup of 12 pull requests Successful merges: - rust-lang#136040 (Remove unused trait BoundedSize) - rust-lang#138236 (uefi: Add OwnedEvent abstraction) - rust-lang#138293 (rustdoc: Gate unstable `doc(cfg())` predicates) - rust-lang#138509 (Add test to ensure no index out of bounds panic (rust-lang#135474)) - rust-lang#138545 (Add MIR pre-codegen tests to track rust-lang#138544) - rust-lang#138631 (Update test for SGX now implementing `read_buf`) - rust-lang#138641 (Add unstable `--print=supported-crate-types` option) - rust-lang#138667 (std: uefi: fs: Implement mkdir) - rust-lang#138849 (doc: rename reference #create-a-configtoml to #create-a-bootstraptoml) - rust-lang#138854 (Fix ICE rust-lang#138415 for invalid extern function body) - rust-lang#138858 (Say which test failed the `COMPILETEST_REQUIRE_ALL_LLVM_COMPONENTS` assertion) - rust-lang#138861 (Tweak type flags, fix missing flags from coroutine kind ty) Failed merges: - rust-lang#138755 ([rustdoc] Remove duplicated loop when computing doc cfgs) r? `@ghost` `@rustbot` modify labels: rollup
2 parents aa8f0fd + 045a1c7 commit 2120459

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+673
-222
lines changed
 

‎library/std/src/net/tcp/tests.rs

+2-6
Original file line numberDiff line numberDiff line change
@@ -315,12 +315,8 @@ fn read_buf() {
315315
let mut buf = BorrowedBuf::from(buf.as_mut_slice());
316316
t!(s.read_buf(buf.unfilled()));
317317
assert_eq!(buf.filled(), &[1, 2, 3, 4]);
318-
319-
// FIXME: sgx uses default_read_buf that initializes the buffer.
320-
if cfg!(not(target_env = "sgx")) {
321-
// TcpStream::read_buf should omit buffer initialization.
322-
assert_eq!(buf.init_len(), 4);
323-
}
318+
// TcpStream::read_buf should omit buffer initialization.
319+
assert_eq!(buf.init_len(), 4);
324320

325321
t.join().ok().expect("thread panicked");
326322
})

‎library/std/src/sys/fs/uefi.rs

+30-4
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ pub struct FilePermissions(bool);
3636
pub struct FileType(bool);
3737

3838
#[derive(Debug)]
39-
pub struct DirBuilder {}
39+
pub struct DirBuilder;
4040

4141
impl FileAttr {
4242
pub fn size(&self) -> u64 {
@@ -248,11 +248,11 @@ impl File {
248248

249249
impl DirBuilder {
250250
pub fn new() -> DirBuilder {
251-
DirBuilder {}
251+
DirBuilder
252252
}
253253

254-
pub fn mkdir(&self, _p: &Path) -> io::Result<()> {
255-
unsupported()
254+
pub fn mkdir(&self, p: &Path) -> io::Result<()> {
255+
uefi_fs::mkdir(p)
256256
}
257257
}
258258

@@ -452,4 +452,30 @@ mod uefi_fs {
452452
}
453453
}
454454
}
455+
456+
/// An implementation of mkdir to allow creating new directory without having to open the
457+
/// volume twice (once for checking and once for creating)
458+
pub(crate) fn mkdir(path: &Path) -> io::Result<()> {
459+
let absolute = crate::path::absolute(path)?;
460+
461+
let p = helpers::OwnedDevicePath::from_text(absolute.as_os_str())?;
462+
let (vol, mut path_remaining) = File::open_volume_from_device_path(p.borrow())?;
463+
464+
// Check if file exists
465+
match vol.open(&mut path_remaining, file::MODE_READ, 0) {
466+
Ok(_) => {
467+
return Err(io::Error::new(io::ErrorKind::AlreadyExists, "Path already exists"));
468+
}
469+
Err(e) if e.kind() == io::ErrorKind::NotFound => {}
470+
Err(e) => return Err(e),
471+
}
472+
473+
let _ = vol.open(
474+
&mut path_remaining,
475+
file::MODE_READ | file::MODE_WRITE | file::MODE_CREATE,
476+
file::DIRECTORY,
477+
)?;
478+
479+
Ok(())
480+
}
455481
}
There was a problem loading the remainder of the diff.

0 commit comments

Comments
 (0)
Failed to load comments.