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 9, 2021
1 parent e1e6e4f commit dfefaaa
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/ui/lang/core/ops/range-contains.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// 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

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);
}
9 changes: 9 additions & 0 deletions tests/ui/lang/core/ops/range-contains.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
error: error:0:0 - In Logical addressing, variables may not allocate a pointer type
%49 = OpVariable %_ptr_Function__ptr_Function_uint Function

|
= 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 dfefaaa

Please sign in to comment.