From 20431706a863f92cb37dc512fef6e48d192aaf2c Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:11:38 +0200 Subject: Merging upstream version 1.66.0+dfsg1. Signed-off-by: Daniel Baumann --- compiler/rustc_serialize/src/lib.rs | 1 - compiler/rustc_serialize/src/opaque.rs | 4 +++- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'compiler/rustc_serialize') diff --git a/compiler/rustc_serialize/src/lib.rs b/compiler/rustc_serialize/src/lib.rs index fa9c7bd54..1f8d2336c 100644 --- a/compiler/rustc_serialize/src/lib.rs +++ b/compiler/rustc_serialize/src/lib.rs @@ -14,7 +14,6 @@ Core encoding and decoding interfaces. #![feature(min_specialization)] #![feature(core_intrinsics)] #![feature(maybe_uninit_slice)] -#![cfg_attr(bootstrap, feature(let_else))] #![feature(new_uninit)] #![feature(allocator_api)] #![cfg_attr(test, feature(test))] diff --git a/compiler/rustc_serialize/src/opaque.rs b/compiler/rustc_serialize/src/opaque.rs index 5c17ef6ac..f35cc08f4 100644 --- a/compiler/rustc_serialize/src/opaque.rs +++ b/compiler/rustc_serialize/src/opaque.rs @@ -193,7 +193,9 @@ impl FileEncoder { // shaves an instruction off those code paths (on x86 at least). assert!(capacity <= usize::MAX - max_leb128_len()); - let file = File::create(path)?; + // Create the file for reading and writing, because some encoders do both + // (e.g. the metadata encoder when -Zmeta-stats is enabled) + let file = File::options().read(true).write(true).create(true).truncate(true).open(path)?; Ok(FileEncoder { buf: Box::new_uninit_slice(capacity), -- cgit v1.2.3