]> git.lizzy.rs Git - rust.git/blob - src/test/codegen/bool-cmp.rs
Rollup merge of #67595 - ohadravid:impl-trait-does-not-live-long-enough, r=estebank
[rust.git] / src / test / codegen / bool-cmp.rs
1 // This is a test for optimal Ord trait implementation for bool.
2 // See <https://github.com/rust-lang/rust/issues/66780> for more info.
3
4 // compile-flags: -C opt-level=3
5
6 #![crate_type = "lib"]
7
8 use std::cmp::Ordering;
9
10 // CHECK-LABEL: @cmp_bool
11 #[no_mangle]
12 pub fn cmp_bool(a: bool, b: bool) -> Ordering {
13 // CHECK: zext i1
14 // CHECK: zext i1
15 // CHECK: sub nsw
16     a.cmp(&b)
17 }