Skip to content

Commit

Permalink
explain the use of a custom identity function
Browse files Browse the repository at this point in the history
  • Loading branch information
lcnr committed Mar 10, 2020
1 parent 314da73 commit 7b3e3ff
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/test/ui/consts/const_discriminant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 }

Expand Down

0 comments on commit 7b3e3ff

Please sign in to comment.