Skip to content

Commit 9702ad9

Browse files
committed
Auto merge of rust-lang#94372 - erikdesjardins:asrefinl, r=dtolnay
Add #[inline] to trivial AsRef/AsMut impls These appeared uninlined in some perf runs, but they're trivial. r? `@ghost`
2 parents e2b05ea + 1a65fcf commit 9702ad9

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

core/src/convert/mod.rs

+3
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,7 @@ impl<T: ?Sized, U: ?Sized> const AsRef<U> for &T
487487
where
488488
T: ~const AsRef<U>,
489489
{
490+
#[inline]
490491
fn as_ref(&self) -> &U {
491492
<T as AsRef<U>>::as_ref(*self)
492493
}
@@ -499,6 +500,7 @@ impl<T: ?Sized, U: ?Sized> const AsRef<U> for &mut T
499500
where
500501
T: ~const AsRef<U>,
501502
{
503+
#[inline]
502504
fn as_ref(&self) -> &U {
503505
<T as AsRef<U>>::as_ref(*self)
504506
}
@@ -519,6 +521,7 @@ impl<T: ?Sized, U: ?Sized> const AsMut<U> for &mut T
519521
where
520522
T: ~const AsMut<U>,
521523
{
524+
#[inline]
522525
fn as_mut(&mut self) -> &mut U {
523526
(*self).as_mut()
524527
}

0 commit comments

Comments
 (0)