diff options
| author | Bastian Kauschke <bastian_kauschke@hotmail.de> | 2020-03-10 12:46:22 +0100 |
|---|---|---|
| committer | Bastian Kauschke <bastian_kauschke@hotmail.de> | 2020-03-10 12:46:22 +0100 |
| commit | 7b3e3ff39aa45103a6f8432466f8078970866142 (patch) | |
| tree | e21fa96a574d47cb47fd0b07b67f757bd6e47e26 | |
| parent | 314da73797ede5da3ed658208aa31d6aab9cfbf0 (diff) | |
| download | rust-7b3e3ff39aa45103a6f8432466f8078970866142.tar.gz rust-7b3e3ff39aa45103a6f8432466f8078970866142.zip | |
explain the use of a custom identity function
| -rw-r--r-- | src/test/ui/consts/const_discriminant.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/test/ui/consts/const_discriminant.rs b/src/test/ui/consts/const_discriminant.rs index 55e2918c85f..1ad5134e71c 100644 --- a/src/test/ui/consts/const_discriminant.rs +++ b/src/test/ui/consts/const_discriminant.rs @@ -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 } |
