Skip to content

Commit 7b3e3ff

Browse files
committed
explain the use of a custom identity function
1 parent 314da73 commit 7b3e3ff

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Diff for: src/test/ui/consts/const_discriminant.rs

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44

55
use std::mem::{discriminant, Discriminant};
66

7+
// `discriminant(const_expr)` may get const-propagated.
8+
// As we want to check that const-eval is equal to ordinary exection,
9+
// we wrap `const_expr` with a function which is not const to prevent this.
710
#[inline(never)]
811
fn identity<T>(x: T) -> T { x }
912

0 commit comments

Comments
 (0)