explain the use of a custom identity function

This commit is contained in:
Bastian Kauschke 2020-03-10 12:46:22 +01:00
parent 314da73797
commit 7b3e3ff39a

View File

@ -4,6 +4,9 @@
use std::mem::{discriminant, Discriminant};
// `discriminant(const_expr)` may get const-propagated.
// As we want to check that const-eval is equal to ordinary exection,
// we wrap `const_expr` with a function which is not const to prevent this.
#[inline(never)]
fn identity<T>(x: T) -> T { x }