Skip to content

Commit 5431177

Browse files
committed
Auto merge of rust-lang#135906 - matthiaskrgr:rollup-k08iwsq, r=matthiaskrgr
Rollup of 8 pull requests Successful merges: - rust-lang#131282 (std: detect stack overflows in TLS destructors on UNIX) - rust-lang#134746 (Don't ICE in coerce when autoderef fails to structurally normalize non-WF type in new solver) - rust-lang#135790 (Update windows-gnu targets to set `DebuginfoKind::DWARF`) - rust-lang#135878 (ci: use 8 core arm runner for dist-aarch64-linux) - rust-lang#135879 (fix outdated file path ref in llvm) - rust-lang#135883 (Remove erroneous `unsafe` in `BTreeSet::upper_bound_mut`) - rust-lang#135884 (remove implied end of slice) - rust-lang#135898 (rustdoc-json-types: Finalize dyn compatibility renaming) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 3cd8fcb + caaeb22 commit 5431177

40 files changed

+414
-187
lines changed

compiler/rustc_hir_typeck/src/coercion.rs

+11-3
Original file line numberDiff line numberDiff line change
@@ -461,9 +461,17 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
461461
// to the target type), since that should be the least
462462
// confusing.
463463
let Some(InferOk { value: ty, mut obligations }) = found else {
464-
let err = first_error.expect("coerce_borrowed_pointer had no error");
465-
debug!("coerce_borrowed_pointer: failed with err = {:?}", err);
466-
return Err(err);
464+
if let Some(first_error) = first_error {
465+
debug!("coerce_borrowed_pointer: failed with err = {:?}", first_error);
466+
return Err(first_error);
467+
} else {
468+
// This may happen in the new trait solver since autoderef requires
469+
// the pointee to be structurally normalizable, or else it'll just bail.
470+
// So when we have a type like `&<not well formed>`, then we get no
471+
// autoderef steps (even though there should be at least one). That means
472+
// we get no type mismatches, since the loop above just exits early.
473+
return Err(TypeError::Mismatch);
474+
}
467475
};
468476

469477
if ty == a && mt_a.mutbl.is_not() && autoderef.step_count() == 1 {

compiler/rustc_parse_format/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,7 @@ impl<'a> Parser<'a> {
545545
}
546546
}
547547
}
548-
&self.input[start..self.input.len()]
548+
&self.input[start..]
549549
}
550550

551551
/// Parses an `Argument` structure, or what's contained within braces inside the format string.

compiler/rustc_target/src/spec/base/windows_gnu.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,9 @@ pub(crate) fn opts() -> TargetOptions {
9797
emit_debug_gdb_scripts: false,
9898
requires_uwtable: true,
9999
eh_frame_header: false,
100+
debuginfo_kind: DebuginfoKind::Dwarf,
100101
// FIXME(davidtwco): Support Split DWARF on Windows GNU - may require LLVM changes to
101102
// output DWO, despite using DWARF, doesn't use ELF..
102-
debuginfo_kind: DebuginfoKind::Pdb,
103103
supported_split_debuginfo: Cow::Borrowed(&[SplitDebuginfo::Off]),
104104
..Default::default()
105105
}

compiler/rustc_target/src/spec/base/windows_gnullvm.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ pub(crate) fn opts() -> TargetOptions {
4444
has_thread_local: true,
4545
crt_static_allows_dylibs: true,
4646
crt_static_respected: true,
47+
debuginfo_kind: DebuginfoKind::Dwarf,
4748
// FIXME(davidtwco): Support Split DWARF on Windows GNU - may require LLVM changes to
4849
// output DWO, despite using DWARF, doesn't use ELF..
49-
debuginfo_kind: DebuginfoKind::Pdb,
5050
supported_split_debuginfo: Cow::Borrowed(&[SplitDebuginfo::Off]),
5151
..Default::default()
5252
}

library/alloc/src/collections/btree/set.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1442,20 +1442,20 @@ impl<T, A: Allocator + Clone> BTreeSet<T, A> {
14421442
///
14431443
/// let mut set = BTreeSet::from([1, 2, 3, 4]);
14441444
///
1445-
/// let mut cursor = unsafe { set.upper_bound_mut(Bound::Included(&3)) };
1445+
/// let mut cursor = set.upper_bound_mut(Bound::Included(&3));
14461446
/// assert_eq!(cursor.peek_prev(), Some(&3));
14471447
/// assert_eq!(cursor.peek_next(), Some(&4));
14481448
///
1449-
/// let mut cursor = unsafe { set.upper_bound_mut(Bound::Excluded(&3)) };
1449+
/// let mut cursor = set.upper_bound_mut(Bound::Excluded(&3));
14501450
/// assert_eq!(cursor.peek_prev(), Some(&2));
14511451
/// assert_eq!(cursor.peek_next(), Some(&3));
14521452
///
1453-
/// let mut cursor = unsafe { set.upper_bound_mut(Bound::Unbounded) };
1453+
/// let mut cursor = set.upper_bound_mut(Bound::Unbounded);
14541454
/// assert_eq!(cursor.peek_prev(), Some(&4));
14551455
/// assert_eq!(cursor.peek_next(), None);
14561456
/// ```
14571457
#[unstable(feature = "btree_cursors", issue = "107540")]
1458-
pub unsafe fn upper_bound_mut<Q: ?Sized>(&mut self, bound: Bound<&Q>) -> CursorMut<'_, T, A>
1458+
pub fn upper_bound_mut<Q: ?Sized>(&mut self, bound: Bound<&Q>) -> CursorMut<'_, T, A>
14591459
where
14601460
T: Borrow<Q> + Ord,
14611461
Q: Ord,

library/std/src/rt.rs

+1
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ pub(crate) fn thread_cleanup() {
122122
// print a nice message.
123123
panic::catch_unwind(|| {
124124
crate::thread::drop_current();
125+
crate::sys::thread_cleanup();
125126
})
126127
.unwrap_or_else(handle_rt_panic);
127128
}

library/std/src/sys/pal/hermit/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ pub unsafe fn init(argc: isize, argv: *const *const u8, _sigpipe: u8) {
6969
}
7070
}
7171

72+
pub fn thread_cleanup() {}
73+
7274
// SAFETY: must be called only once during runtime cleanup.
7375
// NOTE: this is not guaranteed to run, for example when the program aborts.
7476
pub unsafe fn cleanup() {}

library/std/src/sys/pal/sgx/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ pub unsafe fn init(argc: isize, argv: *const *const u8, _sigpipe: u8) {
3737
}
3838
}
3939

40+
pub fn thread_cleanup() {}
41+
4042
// SAFETY: must be called only once during runtime cleanup.
4143
// NOTE: this is not guaranteed to run, for example when the program aborts.
4244
pub unsafe fn cleanup() {}

library/std/src/sys/pal/solid/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ pub mod time;
3838
// NOTE: this is not guaranteed to run, for example when Rust code is called externally.
3939
pub unsafe fn init(_argc: isize, _argv: *const *const u8, _sigpipe: u8) {}
4040

41+
pub fn thread_cleanup() {}
42+
4143
// SAFETY: must be called only once during runtime cleanup.
4244
pub unsafe fn cleanup() {}
4345

library/std/src/sys/pal/teeos/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ pub fn abort_internal() -> ! {
4545
// so this should never be called.
4646
pub fn init(argc: isize, argv: *const *const u8, sigpipe: u8) {}
4747

48+
pub fn thread_cleanup() {}
49+
4850
// SAFETY: must be called only once during runtime cleanup.
4951
// this is not guaranteed to run, for example when the program aborts.
5052
pub unsafe fn cleanup() {

library/std/src/sys/pal/uefi/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ pub(crate) unsafe fn init(argc: isize, argv: *const *const u8, _sigpipe: u8) {
7676
}
7777
}
7878

79+
pub fn thread_cleanup() {}
80+
7981
/// # SAFETY
8082
/// this is not guaranteed to run, for example when the program aborts.
8183
/// - must be called only once during runtime cleanup.

library/std/src/sys/pal/unix/mod.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ pub unsafe fn init(argc: isize, argv: *const *const u8, sigpipe: u8) {
5555
// behavior.
5656
reset_sigpipe(sigpipe);
5757

58-
stack_overflow::init();
58+
stack_overflow::protect(true);
5959
args::init(argc, argv);
6060

6161
// Normally, `thread::spawn` will call `Thread::set_name` but since this thread
@@ -229,12 +229,14 @@ pub(crate) fn on_broken_pipe_flag_used() -> bool {
229229
ON_BROKEN_PIPE_FLAG_USED.load(crate::sync::atomic::Ordering::Relaxed)
230230
}
231231

232-
// SAFETY: must be called only once during runtime cleanup.
233-
// NOTE: this is not guaranteed to run, for example when the program aborts.
234-
pub unsafe fn cleanup() {
232+
pub fn thread_cleanup() {
235233
stack_overflow::cleanup();
236234
}
237235

236+
// SAFETY: must be called only once during runtime cleanup.
237+
// NOTE: this is not guaranteed to run, for example when the program aborts.
238+
pub unsafe fn cleanup() {}
239+
238240
#[allow(unused_imports)]
239241
pub use libc::signal;
240242

0 commit comments

Comments
 (0)