Skip to content

Commit 37e4c89

Browse files
committed
allow integer literals to have a suffix
1 parent 688103f commit 37e4c89

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

crates/rustc_codegen_spirv/src/symbols.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use crate::attr::{Entry, ExecutionModeExtra, IntrinsicType, SpecConstant, SpirvAttribute};
22
use crate::builder::libm_intrinsics;
33
use rspirv::spirv::{BuiltIn, ExecutionMode, ExecutionModel, StorageClass};
4-
use rustc_ast::ast::{LitIntType, LitKind, MetaItemInner, MetaItemLit};
4+
use rustc_ast::ast::{LitKind, MetaItemInner, MetaItemLit};
55
use rustc_data_structures::fx::FxHashMap;
66
use rustc_hir::Attribute;
77
use rustc_span::Span;
@@ -563,7 +563,7 @@ fn parse_attr_int_value(arg: &MetaItemInner) -> Result<u32, ParseAttrError> {
563563
};
564564
match arg.name_value_literal() {
565565
Some(&MetaItemLit {
566-
kind: LitKind::Int(x, LitIntType::Unsuffixed),
566+
kind: LitKind::Int(x, ..),
567567
..
568568
}) if x <= u32::MAX as u128 => Ok(x.get() as u32),
569569
_ => Err((arg.span, "attribute value must be integer".to_string())),
@@ -581,7 +581,7 @@ fn parse_local_size_attr(arg: &MetaItemInner) -> Result<[u32; 3], ParseAttrError
581581
for (idx, lit) in tuple.iter().enumerate() {
582582
match lit {
583583
MetaItemInner::Lit(MetaItemLit {
584-
kind: LitKind::Int(x, LitIntType::Unsuffixed),
584+
kind: LitKind::Int(x, ..),
585585
..
586586
}) if *x <= u32::MAX as u128 => local_size[idx] = x.get() as u32,
587587
_ => return Err((lit.span(), "must be a u32 literal".to_string())),
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// build-pass
2+
use spirv_std::spirv;
3+
4+
#[spirv(compute(1, 2u32, 3i128))]
5+
pub fn main(#[spirv(storage_buffer, descriptor_set = 42u8, binding = 69u64)] value: &mut f32) {
6+
*value = *value + 1.;
7+
}

0 commit comments

Comments
 (0)