In #148725 I tried to use rustc_force_inline (cc #134082) on the following
/// Used in `try {}` blocks so the type produced in the `?` desugaring
/// depends on the residual type `R` and the output type of the block `O`,
/// but importantly not on the contextual type the way it would be if
/// we called `<_ as FromResidual>::from_residual(r)` directly.
#[unstable(feature = "try_trait_v2_residual", issue = "91285")]
// needs to be `pub` to avoid `private type` errors
#[expect(unreachable_pub)]
#[rustc_force_inline]
#[lang = "into_try_type"]
pub fn residual_into_try_type<R: Residual<O>, O>(r: R) -> <R as Residual<O>>::TryType {
FromResidual::from_residual(r)
}
since it's only called directly to constrain type inference, and is never allowed to be called by users.
However, it failed in CI because https://triage.rust-lang.org/gha-logs/rust-lang/rust/55265405601
[TIMING:start] check::PrepareStdRmetaSysroot { build_compiler: Compiler { stage: 1, host: x86_64-unknown-linux-gnu, forced_compiler: false }, target: i686-pc-windows-gnu }
[TIMING:start] check::Std { build_compiler: Compiler { stage: 1, host: x86_64-unknown-linux-gnu, forced_compiler: false }, target: i686-pc-windows-gnu, crates: [] }
##[group]Checking stage1 library artifacts (stage1:x86_64-unknown-linux-gnu -> stage1:i686-pc-windows-gnu)
[...]
error: `ops::try_trait::residual_into_try_type` could not be inlined into `Box::<T>::try_map` but is required to be inlined
--> library/alloc/src/boxed.rs:462:21
|
462 | f(value)?,
| ^^^^^^^^^ ...`ops::try_trait::residual_into_try_type` called here
|
= note: could not be inlined due to: implementation limitation -- MIR unavailable
error: `ops::try_trait::residual_into_try_type` could not be inlined into `Box::<T>::try_map` but is required to be inlined
--> library/alloc/src/boxed.rs:466:28
|
466 | try { Box::new(f(*this)?) }
| ^^^^^^^^^ ...`ops::try_trait::residual_into_try_type` called here
|
= note: could not be inlined due to: implementation limitation -- MIR unavailable
error: `ops::try_trait::residual_into_try_type` could not be inlined into `Rc::<T>::try_map` but is required to be inlined
--> library/alloc/src/rc.rs:728:27
|
728 | try { Rc::new(f(&*this)?) }
| ^^^^^^^^^^ ...`ops::try_trait::residual_into_try_type` called here
|
= note: could not be inlined due to: implementation limitation -- MIR unavailable
I would have expected this to work -- why wouldn't we have MIR for core when compiling alloc? -- so figured I'd file the bug even though it's an internal feature. This is the kind of place where I'd really like to use the feature in core, after all.
Makes me wonder if there's something odd about cycle checking going on, or similar?
In #148725 I tried to use
rustc_force_inline(cc #134082) on the followingsince it's only called directly to constrain type inference, and is never allowed to be called by users.
However, it failed in CI because https://triage.rust-lang.org/gha-logs/rust-lang/rust/55265405601
I would have expected this to work -- why wouldn't we have MIR for
corewhen compilingalloc? -- so figured I'd file the bug even though it's an internal feature. This is the kind of place where I'd really like to use the feature incore, after all.Makes me wonder if there's something odd about cycle checking going on, or similar?