Skip to content

Commit

Permalink
Add test accounting for rust-lang/rust#87723.
Browse files Browse the repository at this point in the history
  • Loading branch information
eddyb committed Aug 10, 2021
1 parent 340816a commit f951203
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/ui/lang/core/ops/range-contains.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Test that using `(a..b).contains(&x)`, which is starting to get used
// in `core` (see https://github.com/rust-lang/rust/pull/87723), cannot
// cause a fatal error, but at most a zombie or SPIR-V validation error.

// build-fail

// HACK(eddyb) this allows CI (older?) `spirv-val` output to also work.
// normalize-stderr-test " %\d+ = OpVariable %\w+ Function\n\n" -> ""

use spirv_std as _;

fn has_two_decimal_digits(x: u32) -> bool {
(10..100).contains(&x)
}

#[spirv(fragment)]
pub fn main(i: u32, o: &mut bool) {
*o = has_two_decimal_digits(i);
}
7 changes: 7 additions & 0 deletions tests/ui/lang/core/ops/range-contains.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
error: error:0:0 - In Logical addressing, variables may not allocate a pointer type
|
= note: spirv-val failed
= note: module `$TEST_BUILD_DIR/lang/core/ops/range-contains.stage-id.spv.dir/module`

error: aborting due to previous error

0 comments on commit f951203

Please sign in to comment.