Stream: t-compiler

Topic: NOP intrinsic

RalfJ (Dec 27 2018 at 08:43, on Zulip):

I am trying to write an intrinsic panic_if_uninhabited that compiles statically to a panic or a NOP depending on the type argument -- something like a generalization of the panic-on-uninhabited we have for mem::{uninhabited,zeroed}. Based on that existing code, getting the panic path was easy, but I have no idea how to make a NOP path. I have a WIP commit at Any suggestions? Cc @eddyb

oli (Dec 27 2018 at 11:10, on Zulip):

Well... a NOP is just to go to the next block, so I'd presume you'd do the same thing as a goto does:

oli (Dec 27 2018 at 11:12, on Zulip):

where target is replaced with destination.as_ref().map(|(_, bb)| bb) (possibly with an unwrap afterwards)

RalfJ (Dec 27 2018 at 11:16, on Zulip):

hm actually my panic-case is also wrong because it determines the type to check by looking at the return type. I need the first type of the substitution instead.

RalfJ (Dec 27 2018 at 12:06, on Zulip):

that seems to work, superficially:

Last update: Nov 20 2019 at 02:25UTC