Skip to content

Instantly share code, notes, and snippets.

@xacrimon
Last active January 30, 2025 08:42
with my rustc patch that's almost ready for review
const STANDARD_BASE: &[u8] = {
let mut _0: &[u8];
let mut _1: &[u8; 27];
let _2: &[u8; 27];
bb0: {
StorageLive(_1);
StorageLive(_2);
_2 = const b"org.freedesktop.DBus.Error.";
_1 = &(*_2);
_0 = move _1 as &[u8] (PointerCoercion(Unsize, Implicit));
StorageDead(_2);
StorageDead(_1);
return;
}
}
alloc1 (size: 27, align: 1) {
0x00 │ 6f 72 67 2e 66 72 65 65 64 65 73 6b 74 6f 70 2e │ org.freedesktop.
0x10 │ 44 42 75 73 2e 45 72 72 6f 72 2e │ DBus.Error.
}
fn to_errno(_1: &CStr) -> Option<NonZero<i32>> {
debug s => _1;
let mut _0: std::option::Option<std::num::NonZero<i32>>;
let _2: &[u8];
let _3: &[u8];
let mut _4: std::ops::ControlFlow<std::option::Option<std::convert::Infallible>, (&[u8], &[u8])>;
let mut _5: std::option::Option<(&[u8], &[u8])>;
let _6: &[u8];
let mut _7: usize;
let mut _8: &[u8];
let mut _9: isize;
let _10: (&[u8], &[u8]);
let mut _11: bool;
let mut _12: &&[u8];
let mut _13: &&[u8];
let mut _14: &[u8];
let mut _15: bool;
let mut _16: &[u8];
let mut _17: bool;
let mut _18: &[u8];
let mut _19: bool;
let mut _20: &[u8];
let mut _21: bool;
let mut _22: &[u8];
let mut _23: bool;
let mut _24: &[u8];
let mut _25: bool;
let mut _26: &[u8];
let mut _27: bool;
let mut _28: &[u8];
let mut _29: bool;
let mut _30: &[u8];
let mut _31: bool;
let mut _32: &[u8];
let mut _33: bool;
let mut _34: &[u8];
let mut _35: bool;
let mut _36: &[u8];
let mut _37: bool;
let mut _38: &[u8];
let mut _39: bool;
let mut _40: &[u8];
let mut _41: bool;
let mut _42: &[u8];
let mut _43: bool;
let mut _44: &[u8];
let mut _45: bool;
let mut _46: &[u8];
let mut _47: bool;
let mut _48: &[u8];
let mut _49: bool;
let mut _50: usize;
let mut _51: usize;
let mut _52: usize;
let mut _53: usize;
let mut _54: usize;
let mut _55: usize;
let mut _56: usize;
let mut _57: usize;
let mut _58: usize;
let mut _59: usize;
let mut _60: usize;
scope 1 {
debug pfx => _2;
debug sfx => _3;
}
scope 2 {
debug residual => const Option::<Infallible>::None;
scope 3 {
}
}
scope 4 {
debug val => _10;
scope 5 {
}
}
bb0: {
_6 = CStr::to_bytes(copy _1) -> [return: bb1, unwind continue];
}
bb1: {
_8 = const STANDARD_BASE;
_7 = PtrMetadata(move _8);
_5 = core::slice::<impl [u8]>::split_at_checked(copy _6, move _7) -> [return: bb2, unwind continue];
}
bb2: {
_4 = <Option<(&[u8], &[u8])> as Try>::branch(move _5) -> [return: bb3, unwind continue];
}
bb3: {
_9 = discriminant(_4);
switchInt(move _9) -> [0: bb5, 1: bb6, otherwise: bb4];
}
bb4: {
unreachable;
}
bb5: {
_10 = copy ((_4 as Continue).0: (&[u8], &[u8]));
_2 = copy (_10.0: &[u8]);
_3 = copy (_10.1: &[u8]);
_12 = &_2;
_13 = const to_errno::promoted[0];
_11 = <&[u8] as PartialEq>::ne(move _12, move _13) -> [return: bb7, unwind continue];
}
bb6: {
_0 = <Option<NonZero<i32>> as FromResidual<Option<Infallible>>>::from_residual(const Option::<Infallible>::None) -> [return: bb65, unwind continue];
}
bb7: {
switchInt(move _11) -> [0: bb9, otherwise: bb8];
}
bb8: {
_0 = Option::<NonZero<i32>>::None;
goto -> bb65;
}
bb9: {
_60 = Len((*_3));
switchInt(move _60) -> [8: bb11, otherwise: bb16];
}
bb10: {
_0 = Option::<NonZero<i32>>::None;
goto -> bb65;
}
bb11: {
_16 = const &*b"NoMemory" as &[u8] (PointerCoercion(Unsize, Implicit));
_17 = <[u8] as std::cmp::pattern::PatternConstEq>::eq(copy _3, copy _16) -> [return: bb15, unwind continue];
}
bb12: {
_0 = NonZero::<i32>::new(const 1_i32) -> [return: bb65, unwind continue];
}
bb13: {
_14 = const &*b"TimedOut" as &[u8] (PointerCoercion(Unsize, Implicit));
_15 = <[u8] as std::cmp::pattern::PatternConstEq>::eq(copy _3, copy _14) -> [return: bb14, unwind continue];
}
bb14: {
switchInt(move _15) -> [0: bb10, otherwise: bb62];
}
bb15: {
switchInt(move _17) -> [0: bb13, otherwise: bb12];
}
bb16: {
_59 = Len((*_3));
switchInt(move _59) -> [14: bb17, otherwise: bb24];
}
bb17: {
_22 = const &*b"ServiceUnknown" as &[u8] (PointerCoercion(Unsize, Implicit));
_23 = <[u8] as std::cmp::pattern::PatternConstEq>::eq(copy _3, copy _22) -> [return: bb23, unwind continue];
}
bb18: {
_20 = const &*b"NameHasNoOwner" as &[u8] (PointerCoercion(Unsize, Implicit));
_21 = <[u8] as std::cmp::pattern::PatternConstEq>::eq(copy _3, copy _20) -> [return: bb22, unwind continue];
}
bb19: {
_18 = const &*b"LimitsExceeded" as &[u8] (PointerCoercion(Unsize, Implicit));
_19 = <[u8] as std::cmp::pattern::PatternConstEq>::eq(copy _3, copy _18) -> [return: bb21, unwind continue];
}
bb20: {
_0 = NonZero::<i32>::new(const 9_i32) -> [return: bb65, unwind continue];
}
bb21: {
switchInt(move _19) -> [0: bb10, otherwise: bb20];
}
bb22: {
switchInt(move _21) -> [0: bb19, otherwise: bb64];
}
bb23: {
switchInt(move _23) -> [0: bb18, otherwise: bb64];
}
bb24: {
_58 = Len((*_3));
switchInt(move _58) -> [13: bb25, otherwise: bb29];
}
bb25: {
_26 = const &*b"UnknownObject" as &[u8] (PointerCoercion(Unsize, Implicit));
_27 = <[u8] as std::cmp::pattern::PatternConstEq>::eq(copy _3, copy _26) -> [return: bb28, unwind continue];
}
bb26: {
_24 = const &*b"UnknownMethod" as &[u8] (PointerCoercion(Unsize, Implicit));
_25 = <[u8] as std::cmp::pattern::PatternConstEq>::eq(copy _3, copy _24) -> [return: bb27, unwind continue];
}
bb27: {
switchInt(move _25) -> [0: bb10, otherwise: bb64];
}
bb28: {
switchInt(move _27) -> [0: bb26, otherwise: bb64];
}
bb29: {
_57 = Len((*_3));
switchInt(move _57) -> [16: bb30, otherwise: bb32];
}
bb30: {
_28 = const &*b"UnknownInterface" as &[u8] (PointerCoercion(Unsize, Implicit));
_29 = <[u8] as std::cmp::pattern::PatternConstEq>::eq(copy _3, copy _28) -> [return: bb31, unwind continue];
}
bb31: {
switchInt(move _29) -> [0: bb10, otherwise: bb64];
}
bb32: {
_56 = Len((*_3));
switchInt(move _56) -> [15: bb33, otherwise: bb35];
}
bb33: {
_30 = const &*b"UnknownProperty" as &[u8] (PointerCoercion(Unsize, Implicit));
_31 = <[u8] as std::cmp::pattern::PatternConstEq>::eq(copy _3, copy _30) -> [return: bb34, unwind continue];
}
bb34: {
switchInt(move _31) -> [0: bb10, otherwise: bb64];
}
bb35: {
_55 = Len((*_3));
switchInt(move _55) -> [12: bb36, otherwise: bb43];
}
bb36: {
_36 = const &*b"AccessDenied" as &[u8] (PointerCoercion(Unsize, Implicit));
_37 = <[u8] as std::cmp::pattern::PatternConstEq>::eq(copy _3, copy _36) -> [return: bb42, unwind continue];
}
bb37: {
_34 = const &*b"NotSupported" as &[u8] (PointerCoercion(Unsize, Implicit));
_35 = <[u8] as std::cmp::pattern::PatternConstEq>::eq(copy _3, copy _34) -> [return: bb41, unwind continue];
}
bb38: {
_0 = NonZero::<i32>::new(const 228_i32) -> [return: bb65, unwind continue];
}
bb39: {
_32 = const &*b"AddressInUse" as &[u8] (PointerCoercion(Unsize, Implicit));
_33 = <[u8] as std::cmp::pattern::PatternConstEq>::eq(copy _3, copy _32) -> [return: bb40, unwind continue];
}
bb40: {
switchInt(move _33) -> [0: bb10, otherwise: bb61];
}
bb41: {
switchInt(move _35) -> [0: bb39, otherwise: bb38];
}
bb42: {
switchInt(move _37) -> [0: bb37, otherwise: bb63];
}
bb43: {
_54 = Len((*_3));
switchInt(move _54) -> [10: bb44, otherwise: bb46];
}
bb44: {
_38 = const &*b"AuthFailed" as &[u8] (PointerCoercion(Unsize, Implicit));
_39 = <[u8] as std::cmp::pattern::PatternConstEq>::eq(copy _3, copy _38) -> [return: bb45, unwind continue];
}
bb45: {
switchInt(move _39) -> [0: bb10, otherwise: bb63];
}
bb46: {
_53 = Len((*_3));
switchInt(move _53) -> [32: bb47, otherwise: bb49];
}
bb47: {
_40 = const &*b"InteractiveAuthorizationRequired" as &[u8] (PointerCoercion(Unsize, Implicit));
_41 = <[u8] as std::cmp::pattern::PatternConstEq>::eq(copy _3, copy _40) -> [return: bb48, unwind continue];
}
bb48: {
switchInt(move _41) -> [0: bb10, otherwise: bb63];
}
bb49: {
_52 = Len((*_3));
switchInt(move _52) -> [7: bb50, otherwise: bb54];
}
bb50: {
_44 = const &*b"Timeout" as &[u8] (PointerCoercion(Unsize, Implicit));
_45 = <[u8] as std::cmp::pattern::PatternConstEq>::eq(copy _3, copy _44) -> [return: bb53, unwind continue];
}
bb51: {
_42 = const &*b"IOError" as &[u8] (PointerCoercion(Unsize, Implicit));
_43 = <[u8] as std::cmp::pattern::PatternConstEq>::eq(copy _3, copy _42) -> [return: bb52, unwind continue];
}
bb52: {
switchInt(move _43) -> [0: bb10, otherwise: bb61];
}
bb53: {
switchInt(move _45) -> [0: bb51, otherwise: bb62];
}
bb54: {
_51 = Len((*_3));
switchInt(move _51) -> [20: bb55, otherwise: bb58];
}
bb55: {
_46 = const &*b"UnixProcessIdUnknown" as &[u8] (PointerCoercion(Unsize, Implicit));
_47 = <[u8] as std::cmp::pattern::PatternConstEq>::eq(copy _3, copy _46) -> [return: bb57, unwind continue];
}
bb56: {
_0 = NonZero::<i32>::new(const 69_i32) -> [return: bb65, unwind continue];
}
bb57: {
switchInt(move _47) -> [0: bb10, otherwise: bb56];
}
bb58: {
_50 = Len((*_3));
switchInt(move _50) -> [9: bb59, otherwise: bb10];
}
bb59: {
_48 = const &*b"NoNetwork" as &[u8] (PointerCoercion(Unsize, Implicit));
_49 = <[u8] as std::cmp::pattern::PatternConstEq>::eq(copy _3, copy _48) -> [return: bb60, unwind continue];
}
bb60: {
switchInt(move _49) -> [0: bb10, otherwise: bb61];
}
bb61: {
_0 = NonZero::<i32>::new(const 100500_i32) -> [return: bb65, unwind continue];
}
bb62: {
_0 = NonZero::<i32>::new(const 420_i32) -> [return: bb65, unwind continue];
}
bb63: {
_0 = NonZero::<i32>::new(const 1245_i32) -> [return: bb65, unwind continue];
}
bb64: {
_0 = NonZero::<i32>::new(const 18_i32) -> [return: bb65, unwind continue];
}
bb65: {
return;
}
}
const to_errno::promoted[0]: &&[u8] = {
let mut _0: &&[u8];
let mut _1: &[u8];
bb0: {
_1 = const STANDARD_BASE;
_0 = &_1;
return;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment