const
| #![crate_type = "lib"] | |
| #![feature(const_fn)] | |
| const fn foo() -> usize { | |
| 10 | |
| } | |
| // Ends up as simply return 25 in the mir output. | |
| pub fn test1<T>() -> usize { | |
| if true { | |
| 25 | |
| } else { | |
| 99 | |
| } | |
| } | |
| // This does not. | |
| pub fn test2<T>() -> usize { | |
| if foo() < 32 { | |
| 25 | |
| } else { | |
| 99 | |
| } | |
| } | |
| // Neither does this. | |
| pub fn test3<T>() -> usize { | |
| if 10 < 32 { | |
| 25 | |
| } else { | |
| 99 | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment