Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 445c9d8

Browse files
authoredAug 8, 2024··
Unrolled build for rust-lang#128749
Rollup merge of rust-lang#128749 - tgross35:float-inline, r=scottmcm Mark `{f32,f64}::{next_up,next_down,midpoint}` inline Most float functions are marked `#[inline]` so any float symbols used by these functions only need to be provided if the function itself is used. RFL recently noticed that `next_up`, `next_down`, and `midpoint` for `f32` and `f64` are not inline, which causes linker errors when building with certain configurations <https://lore.kernel.org/all/20240806150619.192882-1-ojeda@kernel.org/>. Add the missing attributes so the symbols should no longer be required.
2 parents 2048386 + 6b3feb4 commit 445c9d8

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed
 

‎library/core/src/num/f32.rs

+3
Original file line numberDiff line numberDiff line change
@@ -797,6 +797,7 @@ impl f32 {
797797
/// [`INFINITY`]: Self::INFINITY
798798
/// [`MIN`]: Self::MIN
799799
/// [`MAX`]: Self::MAX
800+
#[inline]
800801
#[unstable(feature = "float_next_up_down", issue = "91399")]
801802
#[rustc_const_unstable(feature = "float_next_up_down", issue = "91399")]
802803
pub const fn next_up(self) -> Self {
@@ -845,6 +846,7 @@ impl f32 {
845846
/// [`INFINITY`]: Self::INFINITY
846847
/// [`MIN`]: Self::MIN
847848
/// [`MAX`]: Self::MAX
849+
#[inline]
848850
#[unstable(feature = "float_next_up_down", issue = "91399")]
849851
#[rustc_const_unstable(feature = "float_next_up_down", issue = "91399")]
850852
pub const fn next_down(self) -> Self {
@@ -1042,6 +1044,7 @@ impl f32 {
10421044
/// assert_eq!(1f32.midpoint(4.0), 2.5);
10431045
/// assert_eq!((-5.5f32).midpoint(8.0), 1.25);
10441046
/// ```
1047+
#[inline]
10451048
#[unstable(feature = "num_midpoint", issue = "110840")]
10461049
pub fn midpoint(self, other: f32) -> f32 {
10471050
cfg_if! {

‎library/core/src/num/f64.rs

+3
Original file line numberDiff line numberDiff line change
@@ -805,6 +805,7 @@ impl f64 {
805805
/// [`INFINITY`]: Self::INFINITY
806806
/// [`MIN`]: Self::MIN
807807
/// [`MAX`]: Self::MAX
808+
#[inline]
808809
#[unstable(feature = "float_next_up_down", issue = "91399")]
809810
#[rustc_const_unstable(feature = "float_next_up_down", issue = "91399")]
810811
pub const fn next_up(self) -> Self {
@@ -853,6 +854,7 @@ impl f64 {
853854
/// [`INFINITY`]: Self::INFINITY
854855
/// [`MIN`]: Self::MIN
855856
/// [`MAX`]: Self::MAX
857+
#[inline]
856858
#[unstable(feature = "float_next_up_down", issue = "91399")]
857859
#[rustc_const_unstable(feature = "float_next_up_down", issue = "91399")]
858860
pub const fn next_down(self) -> Self {
@@ -1051,6 +1053,7 @@ impl f64 {
10511053
/// assert_eq!(1f64.midpoint(4.0), 2.5);
10521054
/// assert_eq!((-5.5f64).midpoint(8.0), 1.25);
10531055
/// ```
1056+
#[inline]
10541057
#[unstable(feature = "num_midpoint", issue = "110840")]
10551058
pub fn midpoint(self, other: f64) -> f64 {
10561059
const LO: f64 = f64::MIN_POSITIVE * 2.;

0 commit comments

Comments
 (0)
Please sign in to comment.