Skip to content

Commit f951203

Browse files
committed
Add test accounting for rust-lang/rust#87723.
1 parent 340816a commit f951203

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Test that using `(a..b).contains(&x)`, which is starting to get used
2+
// in `core` (see https://github.com/rust-lang/rust/pull/87723), cannot
3+
// cause a fatal error, but at most a zombie or SPIR-V validation error.
4+
5+
// build-fail
6+
7+
// HACK(eddyb) this allows CI (older?) `spirv-val` output to also work.
8+
// normalize-stderr-test " %\d+ = OpVariable %\w+ Function\n\n" -> ""
9+
10+
use spirv_std as _;
11+
12+
fn has_two_decimal_digits(x: u32) -> bool {
13+
(10..100).contains(&x)
14+
}
15+
16+
#[spirv(fragment)]
17+
pub fn main(i: u32, o: &mut bool) {
18+
*o = has_two_decimal_digits(i);
19+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
error: error:0:0 - In Logical addressing, variables may not allocate a pointer type
2+
|
3+
= note: spirv-val failed
4+
= note: module `$TEST_BUILD_DIR/lang/core/ops/range-contains.stage-id.spv.dir/module`
5+
6+
error: aborting due to previous error
7+

0 commit comments

Comments
 (0)