Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit a28b35e

Browse files
committed
Auto merge of rust-lang#127840 - tgross35:rollup-jfkg1dq, r=tgross35
Rollup of 9 pull requests Successful merges: - rust-lang#125206 (Simplify environment variable examples) - rust-lang#126271 (Skip fast path for dec2flt when optimize_for_size) - rust-lang#126776 (Clean up more comments near use declarations) - rust-lang#127444 (`impl Send + Sync` and override `count` for the `CStr::bytes` iterator) - rust-lang#127512 (Terminate `--print link-args` output with newline) - rust-lang#127792 (std: Use `read_unaligned` for reads from DWARF) - rust-lang#127807 (Use futex.rs for Windows thread parking) - rust-lang#127833 (zkvm: add `#[forbid(unsafe_op_in_unsafe_fn)]` in `stdlib`) - rust-lang#127836 (std: Forbid unwrapped unsafe ops in xous and uefi modules) Failed merges: - rust-lang#127813 (Prevent double reference in generic futex) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 1a6e777 + 1a1b44f commit a28b35e

File tree

38 files changed

+127
-98
lines changed

38 files changed

+127
-98
lines changed

compiler/rustc_codegen_ssa/src/back/link.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -750,7 +750,7 @@ fn link_natively(
750750

751751
for print in &sess.opts.prints {
752752
if print.kind == PrintKind::LinkArgs {
753-
let content = format!("{cmd:?}");
753+
let content = format!("{cmd:?}\n");
754754
print.out.overwrite(&content, sess);
755755
}
756756
}

compiler/rustc_const_eval/src/interpret/validity.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ use super::{
3434
Pointer, Projectable, Scalar, ValueVisitor,
3535
};
3636

37-
// for the validation errors
3837
use super::InterpError::UndefinedBehavior as Ub;
3938
use super::InterpError::Unsupported as Unsup;
4039
use super::UndefinedBehaviorInfo::*;

compiler/rustc_lint/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,6 @@ use types::*;
120120
use unit_bindings::*;
121121
use unused::*;
122122

123-
/// Useful for other parts of the compiler / Clippy.
124123
pub use builtin::{MissingDoc, SoftLints};
125124
pub use context::{CheckLintNameResult, FindLintError, LintStore};
126125
pub use context::{EarlyContext, LateContext, LintContext};

compiler/rustc_pattern_analysis/src/lib.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@ rustc_fluent_macro::fluent_messages! { "../messages.ftl" }
2121

2222
use std::fmt;
2323

24-
// Re-exports to avoid rustc_index version issues.
25-
pub use rustc_index::Idx;
26-
pub use rustc_index::IndexVec;
24+
pub use rustc_index::{Idx, IndexVec}; // re-exported to avoid rustc_index version issues
2725

2826
#[cfg(feature = "rustc")]
2927
use rustc_middle::ty::Ty;

compiler/rustc_smir/src/rustc_internal/internal.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
//! due to incomplete stable coverage.
55
66
// Prefer importing stable_mir over internal rustc constructs to make this file more readable.
7+
78
use crate::rustc_smir::Tables;
89
use rustc_middle::ty::{self as rustc_ty, Const as InternalConst, Ty as InternalTy, TyCtxt};
910
use rustc_span::Symbol;

library/alloc/src/testing/crash_test.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
// We avoid relying on anything else in the crate, apart from the `Debug` trait.
2-
use crate::fmt::Debug;
1+
use crate::fmt::Debug; // the `Debug` trait is the only thing we use from `crate::fmt`
32
use std::cmp::Ordering;
43
use std::sync::atomic::{AtomicUsize, Ordering::SeqCst};
54

library/core/src/char/mod.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,17 @@ mod convert;
2424
mod decode;
2525
mod methods;
2626

27-
// stable re-exports
2827
#[stable(feature = "try_from", since = "1.34.0")]
2928
pub use self::convert::CharTryFromError;
3029
#[stable(feature = "char_from_str", since = "1.20.0")]
3130
pub use self::convert::ParseCharError;
3231
#[stable(feature = "decode_utf16", since = "1.9.0")]
3332
pub use self::decode::{DecodeUtf16, DecodeUtf16Error};
3433

35-
// perma-unstable re-exports
3634
#[unstable(feature = "char_internals", reason = "exposed only for libstd", issue = "none")]
37-
pub use self::methods::encode_utf16_raw;
35+
pub use self::methods::encode_utf16_raw; // perma-unstable
3836
#[unstable(feature = "char_internals", reason = "exposed only for libstd", issue = "none")]
39-
pub use self::methods::encode_utf8_raw;
37+
pub use self::methods::encode_utf8_raw; // perma-unstable
4038

4139
use crate::ascii;
4240
use crate::error::Error;

library/core/src/ffi/c_str.rs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -781,8 +781,15 @@ const unsafe fn strlen(ptr: *const c_char) -> usize {
781781
pub struct Bytes<'a> {
782782
// since we know the string is nul-terminated, we only need one pointer
783783
ptr: NonNull<u8>,
784-
phantom: PhantomData<&'a u8>,
784+
phantom: PhantomData<&'a [c_char]>,
785785
}
786+
787+
#[unstable(feature = "cstr_bytes", issue = "112115")]
788+
unsafe impl Send for Bytes<'_> {}
789+
790+
#[unstable(feature = "cstr_bytes", issue = "112115")]
791+
unsafe impl Sync for Bytes<'_> {}
792+
786793
impl<'a> Bytes<'a> {
787794
#[inline]
788795
fn new(s: &'a CStr) -> Self {
@@ -815,7 +822,7 @@ impl Iterator for Bytes<'_> {
815822
if ret == 0 {
816823
None
817824
} else {
818-
self.ptr = self.ptr.offset(1);
825+
self.ptr = self.ptr.add(1);
819826
Some(ret)
820827
}
821828
}
@@ -825,6 +832,12 @@ impl Iterator for Bytes<'_> {
825832
fn size_hint(&self) -> (usize, Option<usize>) {
826833
if self.is_empty() { (0, Some(0)) } else { (1, None) }
827834
}
835+
836+
#[inline]
837+
fn count(self) -> usize {
838+
// SAFETY: We always hold a valid pointer to a C string
839+
unsafe { strlen(self.ptr.as_ptr().cast()) }
840+
}
828841
}
829842

830843
#[unstable(feature = "cstr_bytes", issue = "112115")]

library/core/src/num/dec2flt/mod.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,8 +250,10 @@ pub fn dec2flt<F: RawFloat>(s: &str) -> Result<F, ParseFloatError> {
250250
None => return Err(pfe_invalid()),
251251
};
252252
num.negative = negative;
253-
if let Some(value) = num.try_fast_path::<F>() {
254-
return Ok(value);
253+
if !cfg!(feature = "optimize_for_size") {
254+
if let Some(value) = num.try_fast_path::<F>() {
255+
return Ok(value);
256+
}
255257
}
256258

257259
// If significant digits were truncated, then we can have rounding error

library/core/src/prelude/common.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
//!
33
//! See the [module-level documentation](super) for more.
44
5+
// No formatting: this file is nothing but re-exports, and their order is worth preserving.
6+
#![cfg_attr(rustfmt, rustfmt::skip)]
7+
58
// Re-exported core operators
69
#[stable(feature = "core_prelude", since = "1.4.0")]
710
#[doc(no_inline)]
@@ -33,10 +36,7 @@ pub use crate::convert::{AsMut, AsRef, From, Into};
3336
pub use crate::default::Default;
3437
#[stable(feature = "core_prelude", since = "1.4.0")]
3538
#[doc(no_inline)]
36-
pub use crate::iter::{DoubleEndedIterator, ExactSizeIterator};
37-
#[stable(feature = "core_prelude", since = "1.4.0")]
38-
#[doc(no_inline)]
39-
pub use crate::iter::{Extend, IntoIterator, Iterator};
39+
pub use crate::iter::{DoubleEndedIterator, ExactSizeIterator, Extend, IntoIterator, Iterator};
4040
#[stable(feature = "core_prelude", since = "1.4.0")]
4141
#[doc(no_inline)]
4242
pub use crate::option::Option::{self, None, Some};

0 commit comments

Comments
 (0)