Skip to content

Commit 564224b

Browse files
Fix new function_casts_as_integer lint errors in std
1 parent 22ea47b commit 564224b

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

compiler/rustc_lint/src/function_cast_as_integer.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ declare_lint! {
2323
/// You should never cast a function directly into an integer but go through
2424
/// a cast as `fn` first to make it obvious what's going on. It also allows
2525
/// to prevent confusion with (associated) constants.
26-
/// ```
2726
pub FUNCTION_CASTS_AS_INTEGER,
2827
Warn,
2928
"Casting a function into an integer",

library/std/src/backtrace.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ impl Backtrace {
293293
if !Backtrace::enabled() {
294294
return Backtrace { inner: Inner::Disabled };
295295
}
296-
Backtrace::create(Backtrace::capture as usize)
296+
Backtrace::create(Backtrace::capture as fn() -> Backtrace as usize)
297297
}
298298

299299
/// Forcibly captures a full backtrace, regardless of environment variable
@@ -309,7 +309,7 @@ impl Backtrace {
309309
#[stable(feature = "backtrace", since = "1.65.0")]
310310
#[inline(never)] // want to make sure there's a frame here to remove
311311
pub fn force_capture() -> Backtrace {
312-
Backtrace::create(Backtrace::force_capture as usize)
312+
Backtrace::create(Backtrace::force_capture as fn() -> Backtrace as usize)
313313
}
314314

315315
/// Forcibly captures a disabled backtrace, regardless of environment

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,9 @@ mod imp {
169169
}
170170

171171
action.sa_flags = SA_SIGINFO | SA_ONSTACK;
172-
action.sa_sigaction = signal_handler as sighandler_t;
172+
action.sa_sigaction = signal_handler
173+
as unsafe extern "C" fn(i32, *mut libc::siginfo_t, *mut libc::c_void)
174+
as sighandler_t;
173175
// SAFETY: only overriding signals if the default is set
174176
unsafe { sigaction(signal, &action, ptr::null_mut()) };
175177
}

0 commit comments

Comments
 (0)