Skip to content

Commit 33a01e2

Browse files
committed
Auto merge of #110027 - nbdd0121:dieting, r=m-ou-se
Add `#[inline]` to functions that are never called This makes libcore binary size reduce by ~300 bytes. Not much, but these functions are never called so it doesn't make sense for them to get into the binary anyway.
2 parents 90c02c1 + 8bafcde commit 33a01e2

File tree

6 files changed

+9
-0
lines changed

6 files changed

+9
-0
lines changed

Diff for: library/core/src/cmp.rs

+3
Original file line numberDiff line numberDiff line change
@@ -1412,6 +1412,7 @@ mod impls {
14121412

14131413
#[unstable(feature = "never_type", issue = "35121")]
14141414
impl PartialEq for ! {
1415+
#[inline]
14151416
fn eq(&self, _: &!) -> bool {
14161417
*self
14171418
}
@@ -1422,13 +1423,15 @@ mod impls {
14221423

14231424
#[unstable(feature = "never_type", issue = "35121")]
14241425
impl PartialOrd for ! {
1426+
#[inline]
14251427
fn partial_cmp(&self, _: &!) -> Option<Ordering> {
14261428
*self
14271429
}
14281430
}
14291431

14301432
#[unstable(feature = "never_type", issue = "35121")]
14311433
impl Ord for ! {
1434+
#[inline]
14321435
fn cmp(&self, _: &!) -> Ordering {
14331436
*self
14341437
}

Diff for: library/core/src/convert/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -915,6 +915,7 @@ impl Ord for Infallible {
915915

916916
#[stable(feature = "convert_infallible", since = "1.34.0")]
917917
impl From<!> for Infallible {
918+
#[inline]
918919
fn from(x: !) -> Self {
919920
x
920921
}

Diff for: library/core/src/fmt/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -2267,13 +2267,15 @@ fmt_refs! { Debug, Display, Octal, Binary, LowerHex, UpperHex, LowerExp, UpperEx
22672267

22682268
#[unstable(feature = "never_type", issue = "35121")]
22692269
impl Debug for ! {
2270+
#[inline]
22702271
fn fmt(&self, _: &mut Formatter<'_>) -> Result {
22712272
*self
22722273
}
22732274
}
22742275

22752276
#[unstable(feature = "never_type", issue = "35121")]
22762277
impl Display for ! {
2278+
#[inline]
22772279
fn fmt(&self, _: &mut Formatter<'_>) -> Result {
22782280
*self
22792281
}

Diff for: library/core/src/intrinsics.rs

+1
Original file line numberDiff line numberDiff line change
@@ -2523,6 +2523,7 @@ macro_rules! assert_unsafe_precondition {
25232523
}
25242524
}
25252525
#[allow(non_snake_case)]
2526+
#[inline]
25262527
const fn comptime$(<$($tt)*>)?($(_:$ty),*) {}
25272528

25282529
::core::intrinsics::const_eval_select(($($i,)*), comptime, runtime);

Diff for: library/core/src/intrinsics/mir.rs

+1
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@ pub struct BasicBlock;
263263
macro_rules! define {
264264
($name:literal, $( #[ $meta:meta ] )* fn $($sig:tt)*) => {
265265
#[rustc_diagnostic_item = $name]
266+
#[inline]
266267
$( #[ $meta ] )*
267268
pub fn $($sig)* { panic!() }
268269
}

Diff for: library/core/src/num/error.rs

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ impl From<Infallible> for TryFromIntError {
3434

3535
#[unstable(feature = "never_type", issue = "35121")]
3636
impl From<!> for TryFromIntError {
37+
#[inline]
3738
fn from(never: !) -> TryFromIntError {
3839
// Match rather than coerce to make sure that code like
3940
// `From<Infallible> for TryFromIntError` above will keep working

0 commit comments

Comments
 (0)