adjust isomorphicCast to be Nim 2.2-compatible (#6633)
This commit is contained in:
parent
8a91d91b0d
commit
9ba31fb5e6
|
@ -891,8 +891,9 @@ func getSizeofSig(x: auto, n: int = 0): seq[(string, int, int)] =
|
||||||
##
|
##
|
||||||
## These SHOULD be used in function calls to avoid expensive temporary.
|
## These SHOULD be used in function calls to avoid expensive temporary.
|
||||||
## see https://github.com/status-im/nimbus-eth2/pull/2250#discussion_r562010679
|
## see https://github.com/status-im/nimbus-eth2/pull/2250#discussion_r562010679
|
||||||
template isomorphicCast*[T, U](x: U): T =
|
template isomorphicCast*[T](x: auto): T =
|
||||||
# Each of these pairs of types has ABI-compatible memory representations.
|
# Each of these pairs of types has ABI-compatible memory representations.
|
||||||
|
type U = typeof(x)
|
||||||
static: doAssert (T is ref) == (U is ref)
|
static: doAssert (T is ref) == (U is ref)
|
||||||
when T is ref:
|
when T is ref:
|
||||||
type
|
type
|
||||||
|
|
Loading…
Reference in New Issue