Skip to content

MIR inliner not inlining through is_some_and sometimes #137901

Closed
@scottmcm

Description

@scottmcm

Noticed in 2025-03-01 (which at time of writing isn't on godbolt yet) that the MIR for <= for a generated type still contains

    bb1: {
        _4 = move ((_3 as Some).0: std::cmp::Ordering);
        StorageLive(_5);
        _5 = (copy _4,);
        _0 = <fn(std::cmp::Ordering) -> bool {std::cmp::Ordering::is_le} as FnOnce<(std::cmp::Ordering,)>>::call_once(std::cmp::Ordering::is_le, move _5) -> [return: bb2, unwind continue];
    }

https://play.rust-lang.org/?version=nightly&mode=release&edition=2024&gist=57c2829c1cf0a8778926bd87a0378feb

I can workaround that particular case, but calls to trivial functions like is_le really ought to MIR-inline, even if done through the voldemort function item like this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions