Skip to content

Commit bd20486

Browse files
borsgitbot
authored and
gitbot
committed
Auto merge of rust-lang#136851 - jhpratt:rollup-ftijn95, r=jhpratt
Rollup of 11 pull requests Successful merges: - rust-lang#136606 (Fix long lines which rustfmt fails to format) - rust-lang#136663 (Stabilize `NonZero::count_ones`) - rust-lang#136672 (library: doc: core::alloc::Allocator: trivial typo fix) - rust-lang#136704 (Improve examples for file locking) - rust-lang#136721 (cg_llvm: Reduce visibility of some items outside the `llvm` module) - rust-lang#136813 (rustc_target: Add the fp16 target feature for AArch32) - rust-lang#136830 (fix i686-unknown-hurd-gnu x87 footnote) - rust-lang#136832 (Fix platform support table for i686-unknown-uefi) - rust-lang#136835 (Stop using span hack for contracts feature gating) - rust-lang#136837 (Overhaul how contracts are lowered on fn-like bodies) - rust-lang#136839 (fix ensure_monomorphic_enough) r? `@ghost` `@rustbot` modify labels: rollup
2 parents bdd68ec + 3dad72c commit bd20486

File tree

4 files changed

+50
-112
lines changed

4 files changed

+50
-112
lines changed

Diff for: core/src/alloc/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ impl fmt::Display for AllocError {
9494
/// - the memory block is deallocated, or
9595
/// - the allocator is dropped.
9696
///
97-
/// Copying, cloning, or moving the allocator must not invalidate memory blocks returned from it
97+
/// Copying, cloning, or moving the allocator must not invalidate memory blocks returned from it.
9898
/// A copied or cloned allocator must behave like the original allocator.
9999
///
100100
/// A memory block which is [*currently allocated*] may be passed to

Diff for: core/src/num/nonzero.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -612,8 +612,6 @@ macro_rules! nonzero_integer {
612612
/// Basic usage:
613613
///
614614
/// ```
615-
/// #![feature(non_zero_count_ones)]
616-
///
617615
/// # use std::num::NonZero;
618616
/// #
619617
/// # fn main() { test().unwrap(); }
@@ -627,7 +625,8 @@ macro_rules! nonzero_integer {
627625
/// # }
628626
/// ```
629627
///
630-
#[unstable(feature = "non_zero_count_ones", issue = "120287")]
628+
#[stable(feature = "non_zero_count_ones", since = "CURRENT_RUSTC_VERSION")]
629+
#[rustc_const_stable(feature = "non_zero_count_ones", since = "CURRENT_RUSTC_VERSION")]
631630
#[doc(alias = "popcount")]
632631
#[doc(alias = "popcnt")]
633632
#[must_use = "this returns the result of the operation, \

Diff for: std/src/fs.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,7 @@ impl File {
664664
/// use std::fs::File;
665665
///
666666
/// fn main() -> std::io::Result<()> {
667-
/// let f = File::open("foo.txt")?;
667+
/// let f = File::create("foo.txt")?;
668668
/// f.lock()?;
669669
/// Ok(())
670670
/// }
@@ -767,7 +767,7 @@ impl File {
767767
/// use std::fs::File;
768768
///
769769
/// fn main() -> std::io::Result<()> {
770-
/// let f = File::open("foo.txt")?;
770+
/// let f = File::create("foo.txt")?;
771771
/// f.try_lock()?;
772772
/// Ok(())
773773
/// }

Diff for: std/src/sys/pal/uefi/os.rs

+45-106
Original file line numberDiff line numberDiff line change
@@ -17,111 +17,50 @@ pub fn errno() -> RawOsError {
1717
pub fn error_string(errno: RawOsError) -> String {
1818
// Keep the List in Alphabetical Order
1919
// The Messages are taken from UEFI Specification Appendix D - Status Codes
20-
match r_efi::efi::Status::from_usize(errno) {
21-
Status::ABORTED => "The operation was aborted.".to_owned(),
22-
Status::ACCESS_DENIED => "Access was denied.".to_owned(),
23-
Status::ALREADY_STARTED => "The protocol has already been started.".to_owned(),
24-
Status::BAD_BUFFER_SIZE => "The buffer was not the proper size for the request.".to_owned(),
25-
Status::BUFFER_TOO_SMALL => {
26-
"The buffer is not large enough to hold the requested data. The required buffer size is returned in the appropriate parameter when this error occurs.".to_owned()
27-
}
28-
Status::COMPROMISED_DATA => {
29-
"The security status of the data is unknown or compromised and the data must be updated or replaced to restore a valid security status.".to_owned()
30-
}
31-
Status::CONNECTION_FIN => {
32-
"The receiving operation fails because the communication peer has closed the connection and there is no more data in the receive buffer of the instance.".to_owned()
33-
}
34-
Status::CONNECTION_REFUSED => {
35-
"The receiving or transmission operation fails because this connection is refused.".to_owned()
36-
}
37-
Status::CONNECTION_RESET => {
38-
"The connect fails because the connection is reset either by instance itself or the communication peer.".to_owned()
39-
}
40-
Status::CRC_ERROR => "A CRC error was detected.".to_owned(),
41-
Status::DEVICE_ERROR => "The physical device reported an error while attempting the operation.".to_owned()
42-
,
43-
Status::END_OF_FILE => {
44-
"The end of the file was reached.".to_owned()
45-
}
46-
Status::END_OF_MEDIA => {
47-
"Beginning or end of media was reached".to_owned()
48-
}
49-
Status::HOST_UNREACHABLE => {
50-
"The remote host is not reachable.".to_owned()
51-
}
52-
Status::HTTP_ERROR => {
53-
"A HTTP error occurred during the network operation.".to_owned()
54-
}
55-
Status::ICMP_ERROR => {
56-
"An ICMP error occurred during the network operation.".to_owned()
57-
}
58-
Status::INCOMPATIBLE_VERSION => {
59-
"The function encountered an internal version that was incompatible with a version requested by the caller.".to_owned()
60-
}
61-
Status::INVALID_LANGUAGE => {
62-
"The language specified was invalid.".to_owned()
63-
}
64-
Status::INVALID_PARAMETER => {
65-
"A parameter was incorrect.".to_owned()
66-
}
67-
Status::IP_ADDRESS_CONFLICT => {
68-
"There is an address conflict address allocation".to_owned()
69-
}
70-
Status::LOAD_ERROR => {
71-
"The image failed to load.".to_owned()
72-
}
73-
Status::MEDIA_CHANGED => {
74-
"The medium in the device has changed since the last access.".to_owned()
75-
}
76-
Status::NETWORK_UNREACHABLE => {
77-
"The network containing the remote host is not reachable.".to_owned()
78-
}
79-
Status::NO_MAPPING => {
80-
"A mapping to a device does not exist.".to_owned()
81-
}
82-
Status::NO_MEDIA => {
83-
"The device does not contain any medium to perform the operation.".to_owned()
84-
}
85-
Status::NO_RESPONSE => {
86-
"The server was not found or did not respond to the request.".to_owned()
87-
}
88-
Status::NOT_FOUND => "The item was not found.".to_owned(),
89-
Status::NOT_READY => {
90-
"There is no data pending upon return.".to_owned()
91-
}
92-
Status::NOT_STARTED => {
93-
"The protocol has not been started.".to_owned()
94-
}
95-
Status::OUT_OF_RESOURCES => {
96-
"A resource has run out.".to_owned()
97-
}
98-
Status::PROTOCOL_ERROR => {
99-
"A protocol error occurred during the network operation.".to_owned()
100-
}
101-
Status::PROTOCOL_UNREACHABLE => {
102-
"An ICMP protocol unreachable error is received.".to_owned()
103-
}
104-
Status::SECURITY_VIOLATION => {
105-
"The function was not performed due to a security violation.".to_owned()
106-
}
107-
Status::TFTP_ERROR => {
108-
"A TFTP error occurred during the network operation.".to_owned()
109-
}
110-
Status::TIMEOUT => "The timeout time expired.".to_owned(),
111-
Status::UNSUPPORTED => {
112-
"The operation is not supported.".to_owned()
113-
}
114-
Status::VOLUME_FULL => {
115-
"There is no more space on the file system.".to_owned()
116-
}
117-
Status::VOLUME_CORRUPTED => {
118-
"An inconstancy was detected on the file system causing the operating to fail.".to_owned()
119-
}
120-
Status::WRITE_PROTECTED => {
121-
"The device cannot be written to.".to_owned()
122-
}
123-
_ => format!("Status: {}", errno),
124-
}
20+
#[rustfmt::skip]
21+
let msg = match r_efi::efi::Status::from_usize(errno) {
22+
Status::ABORTED => "The operation was aborted.",
23+
Status::ACCESS_DENIED => "Access was denied.",
24+
Status::ALREADY_STARTED => "The protocol has already been started.",
25+
Status::BAD_BUFFER_SIZE => "The buffer was not the proper size for the request.",
26+
Status::BUFFER_TOO_SMALL => "The buffer is not large enough to hold the requested data. The required buffer size is returned in the appropriate parameter when this error occurs.",
27+
Status::COMPROMISED_DATA => "The security status of the data is unknown or compromised and the data must be updated or replaced to restore a valid security status.",
28+
Status::CONNECTION_FIN => "The receiving operation fails because the communication peer has closed the connection and there is no more data in the receive buffer of the instance.",
29+
Status::CONNECTION_REFUSED => "The receiving or transmission operation fails because this connection is refused.",
30+
Status::CONNECTION_RESET => "The connect fails because the connection is reset either by instance itself or the communication peer.",
31+
Status::CRC_ERROR => "A CRC error was detected.",
32+
Status::DEVICE_ERROR => "The physical device reported an error while attempting the operation.",
33+
Status::END_OF_FILE => "The end of the file was reached.",
34+
Status::END_OF_MEDIA => "Beginning or end of media was reached",
35+
Status::HOST_UNREACHABLE => "The remote host is not reachable.",
36+
Status::HTTP_ERROR => "A HTTP error occurred during the network operation.",
37+
Status::ICMP_ERROR => "An ICMP error occurred during the network operation.",
38+
Status::INCOMPATIBLE_VERSION => "The function encountered an internal version that was incompatible with a version requested by the caller.",
39+
Status::INVALID_LANGUAGE => "The language specified was invalid.",
40+
Status::INVALID_PARAMETER => "A parameter was incorrect.",
41+
Status::IP_ADDRESS_CONFLICT => "There is an address conflict address allocation",
42+
Status::LOAD_ERROR => "The image failed to load.",
43+
Status::MEDIA_CHANGED => "The medium in the device has changed since the last access.",
44+
Status::NETWORK_UNREACHABLE => "The network containing the remote host is not reachable.",
45+
Status::NO_MAPPING => "A mapping to a device does not exist.",
46+
Status::NO_MEDIA => "The device does not contain any medium to perform the operation.",
47+
Status::NO_RESPONSE => "The server was not found or did not respond to the request.",
48+
Status::NOT_FOUND => "The item was not found.",
49+
Status::NOT_READY => "There is no data pending upon return.",
50+
Status::NOT_STARTED => "The protocol has not been started.",
51+
Status::OUT_OF_RESOURCES => "A resource has run out.",
52+
Status::PROTOCOL_ERROR => "A protocol error occurred during the network operation.",
53+
Status::PROTOCOL_UNREACHABLE => "An ICMP protocol unreachable error is received.",
54+
Status::SECURITY_VIOLATION => "The function was not performed due to a security violation.",
55+
Status::TFTP_ERROR => "A TFTP error occurred during the network operation.",
56+
Status::TIMEOUT => "The timeout time expired.",
57+
Status::UNSUPPORTED => "The operation is not supported.",
58+
Status::VOLUME_FULL => "There is no more space on the file system.",
59+
Status::VOLUME_CORRUPTED => "An inconstancy was detected on the file system causing the operating to fail.",
60+
Status::WRITE_PROTECTED => "The device cannot be written to.",
61+
_ => return format!("Status: {errno}"),
62+
};
63+
msg.to_owned()
12564
}
12665

12766
pub fn getcwd() -> io::Result<PathBuf> {
@@ -314,7 +253,7 @@ mod uefi_env {
314253

315254
let mut start = 0;
316255

317-
// UEFI Shell returns all keys seperated by NULL.
256+
// UEFI Shell returns all keys separated by NULL.
318257
// End of string is denoted by two NULLs
319258
for i in 0.. {
320259
if unsafe { *val.add(i) } == 0 {

0 commit comments

Comments
 (0)