Skip to content
This repository was archived by the owner on Oct 31, 2025. It is now read-only.

Commit db5e5fd

Browse files
authored
rustup update and embark standard lints v0.4 (#672)
* rustup update * update to embark standard lints v0.4
1 parent 04dfa80 commit db5e5fd

File tree

37 files changed

+284
-138
lines changed

37 files changed

+284
-138
lines changed

clippy.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
avoid-breaking-exported-api = false

crates/rustc_codegen_spirv/src/attr.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -410,19 +410,19 @@ impl<'tcx> Visitor<'tcx> for CheckSpirvAttrVisitor<'tcx> {
410410
fn visit_item(&mut self, item: &'tcx hir::Item<'tcx>) {
411411
let target = Target::from_item(item);
412412
self.check_spirv_attributes(item.hir_id(), target);
413-
intravisit::walk_item(self, item)
413+
intravisit::walk_item(self, item);
414414
}
415415

416416
fn visit_generic_param(&mut self, generic_param: &'tcx hir::GenericParam<'tcx>) {
417417
let target = Target::from_generic_param(generic_param);
418418
self.check_spirv_attributes(generic_param.hir_id, target);
419-
intravisit::walk_generic_param(self, generic_param)
419+
intravisit::walk_generic_param(self, generic_param);
420420
}
421421

422422
fn visit_trait_item(&mut self, trait_item: &'tcx hir::TraitItem<'tcx>) {
423423
let target = Target::from_trait_item(trait_item);
424424
self.check_spirv_attributes(trait_item.hir_id(), target);
425-
intravisit::walk_trait_item(self, trait_item)
425+
intravisit::walk_trait_item(self, trait_item);
426426
}
427427

428428
fn visit_field_def(&mut self, field: &'tcx hir::FieldDef<'tcx>) {
@@ -438,21 +438,21 @@ impl<'tcx> Visitor<'tcx> for CheckSpirvAttrVisitor<'tcx> {
438438
fn visit_foreign_item(&mut self, f_item: &'tcx hir::ForeignItem<'tcx>) {
439439
let target = Target::from_foreign_item(f_item);
440440
self.check_spirv_attributes(f_item.hir_id(), target);
441-
intravisit::walk_foreign_item(self, f_item)
441+
intravisit::walk_foreign_item(self, f_item);
442442
}
443443

444444
fn visit_impl_item(&mut self, impl_item: &'tcx hir::ImplItem<'tcx>) {
445445
let target = target_from_impl_item(self.tcx, impl_item);
446446
self.check_spirv_attributes(impl_item.hir_id(), target);
447-
intravisit::walk_impl_item(self, impl_item)
447+
intravisit::walk_impl_item(self, impl_item);
448448
}
449449

450450
fn visit_stmt(&mut self, stmt: &'tcx hir::Stmt<'tcx>) {
451451
// When checking statements ignore expressions, they will be checked later.
452452
if let hir::StmtKind::Local(l) = stmt.kind {
453453
self.check_spirv_attributes(l.hir_id, Target::Statement);
454454
}
455-
intravisit::walk_stmt(self, stmt)
455+
intravisit::walk_stmt(self, stmt);
456456
}
457457

458458
fn visit_expr(&mut self, expr: &'tcx hir::Expr<'tcx>) {
@@ -462,7 +462,7 @@ impl<'tcx> Visitor<'tcx> for CheckSpirvAttrVisitor<'tcx> {
462462
};
463463

464464
self.check_spirv_attributes(expr.hir_id, target);
465-
intravisit::walk_expr(self, expr)
465+
intravisit::walk_expr(self, expr);
466466
}
467467

468468
fn visit_variant(
@@ -472,7 +472,7 @@ impl<'tcx> Visitor<'tcx> for CheckSpirvAttrVisitor<'tcx> {
472472
item_id: HirId,
473473
) {
474474
self.check_spirv_attributes(variant.id, Target::Variant);
475-
intravisit::walk_variant(self, variant, generics, item_id)
475+
intravisit::walk_variant(self, variant, generics, item_id);
476476
}
477477

478478
fn visit_macro_def(&mut self, macro_def: &'tcx hir::MacroDef<'tcx>) {
@@ -528,7 +528,7 @@ pub(crate) fn provide(providers: &mut Providers) {
528528
check_mod_attrs: |tcx, def_id| {
529529
// Run both the default checks, and our `#[spirv(...)]` ones.
530530
(rustc_interface::DEFAULT_QUERY_PROVIDERS.check_mod_attrs)(tcx, def_id);
531-
check_mod_attrs(tcx, def_id)
531+
check_mod_attrs(tcx, def_id);
532532
},
533533
..*providers
534534
};

crates/rustc_codegen_spirv/src/builder/builder_methods.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
550550
}
551551

552552
fn br(&mut self, dest: Self::BasicBlock) {
553-
self.emit().branch(dest).unwrap()
553+
self.emit().branch(dest).unwrap();
554554
}
555555

556556
fn cond_br(
@@ -561,7 +561,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
561561
) {
562562
self.emit()
563563
.branch_conditional(cond.def(self), then_llbb, else_llbb, empty())
564-
.unwrap()
564+
.unwrap();
565565
}
566566

567567
fn switch(
@@ -638,7 +638,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
638638
let cases = cases
639639
.map(|(i, b)| (construct_case(self, signed, i), b))
640640
.collect::<Vec<_>>();
641-
self.emit().switch(v.def(self), else_llbb, cases).unwrap()
641+
self.emit().switch(v.def(self), else_llbb, cases).unwrap();
642642
}
643643

644644
fn invoke(
@@ -656,7 +656,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
656656
}
657657

658658
fn unreachable(&mut self) {
659-
self.emit().unreachable().unwrap()
659+
self.emit().unreachable().unwrap();
660660
}
661661

662662
simple_op! {add, i_add}
@@ -1281,12 +1281,12 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
12811281
self.zombie(
12821282
result.def(self),
12831283
"OpBitcast between ptr and non-ptr without AddressingModel != Logical",
1284-
)
1284+
);
12851285
} else {
12861286
self.struct_err("Cannot cast between pointer and non-pointer types")
12871287
.note(&format!("from: {}", self.debug_type(val.ty)))
12881288
.note(&format!("to: {}", self.debug_type(dest_ty)))
1289-
.emit()
1289+
.emit();
12901290
}
12911291
}
12921292

@@ -1717,7 +1717,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
17171717
self.zombie(
17181718
dst.def(self),
17191719
"OpCopyMemorySized without OpCapability Addresses",
1720-
)
1720+
);
17211721
}
17221722
}
17231723
}
@@ -1731,7 +1731,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
17311731
size: Self::Value,
17321732
flags: MemFlags,
17331733
) {
1734-
self.memcpy(dst, dst_align, src, src_align, size, flags)
1734+
self.memcpy(dst, dst_align, src, src_align, size, flags);
17351735
}
17361736

17371737
fn memset(
@@ -1858,7 +1858,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
18581858
fn insert_value(&mut self, agg_val: Self::Value, elt: Self::Value, idx: u64) -> Self::Value {
18591859
match self.lookup_type(agg_val.ty) {
18601860
SpirvType::Adt { field_types, .. } => {
1861-
assert_ty_eq!(self, field_types[idx as usize], elt.ty)
1861+
assert_ty_eq!(self, field_types[idx as usize], elt.ty);
18621862
}
18631863
other => self.fatal(&format!("insert_value not implemented on type {:?}", other)),
18641864
};

crates/rustc_codegen_spirv/src/builder/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,9 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
7676

7777
pub fn err(&self, msg: &str) {
7878
if let Some(current_span) = self.current_span {
79-
self.tcx.sess.span_err(current_span, msg)
79+
self.tcx.sess.span_err(current_span, msg);
8080
} else {
81-
self.tcx.sess.err(msg)
81+
self.tcx.sess.err(msg);
8282
}
8383
}
8484

@@ -286,7 +286,7 @@ impl<'a, 'tcx> ArgAbiMethods<'tcx> for Builder<'a, 'tcx> {
286286
match arg_abi.mode {
287287
PassMode::Ignore => (),
288288
PassMode::Pair(..) => {
289-
OperandValue::Pair(next(self, idx), next(self, idx)).store(self, dst)
289+
OperandValue::Pair(next(self, idx), next(self, idx)).store(self, dst);
290290
}
291291
PassMode::Indirect {
292292
extra_attrs: Some(_),
@@ -303,7 +303,7 @@ impl<'a, 'tcx> ArgAbiMethods<'tcx> for Builder<'a, 'tcx> {
303303
}
304304
| PassMode::Cast(_) => {
305305
let next_arg = next(self, idx);
306-
self.store_arg(arg_abi, next_arg, dst)
306+
self.store_arg(arg_abi, next_arg, dst);
307307
}
308308
}
309309
}

crates/rustc_codegen_spirv/src/builder/spirv_asm.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ impl<'a, 'tcx> AsmBuilderMethods<'tcx> for Builder<'a, 'tcx> {
121121
match typeof_kind {
122122
Some(kind) => {
123123
*line.last_mut().unwrap() =
124-
Token::Typeof(&operands[operand_idx], span, kind)
124+
Token::Typeof(&operands[operand_idx], span, kind);
125125
}
126126
None => match &operands[operand_idx] {
127127
InlineAsmOperandRef::Const { string } => line.push(Token::Word(string)),
@@ -992,21 +992,21 @@ impl<'cx, 'tcx> Builder<'cx, 'tcx> {
992992
};
993993
match (kind, word) {
994994
(OperandKind::IdResultType | OperandKind::IdResult, _) => {
995-
bug!("should be handled by parse_operands")
995+
bug!("should be handled by parse_operands");
996996
}
997997
(OperandKind::IdMemorySemantics, _) => {
998998
if let Some(id) = self.parse_id_in(id_map, token) {
999-
inst.operands.push(dr::Operand::IdMemorySemantics(id))
999+
inst.operands.push(dr::Operand::IdMemorySemantics(id));
10001000
}
10011001
}
10021002
(OperandKind::IdScope, _) => {
10031003
if let Some(id) = self.parse_id_in(id_map, token) {
1004-
inst.operands.push(dr::Operand::IdScope(id))
1004+
inst.operands.push(dr::Operand::IdScope(id));
10051005
}
10061006
}
10071007
(OperandKind::IdRef, _) => {
10081008
if let Some(id) = self.parse_id_in(id_map, token) {
1009-
inst.operands.push(dr::Operand::IdRef(id))
1009+
inst.operands.push(dr::Operand::IdRef(id));
10101010
}
10111011
}
10121012

@@ -1079,7 +1079,7 @@ impl<'cx, 'tcx> Builder<'cx, 'tcx> {
10791079
}
10801080
}
10811081
(OperandKind::PairLiteralIntegerIdRef, _) => {
1082-
self.err("PairLiteralIntegerIdRef not supported yet")
1082+
self.err("PairLiteralIntegerIdRef not supported yet");
10831083
}
10841084
(OperandKind::PairIdRefLiteralInteger, _) => {
10851085
if let Some(id) = self.parse_id_in(id_map, token) {

crates/rustc_codegen_spirv/src/builder_spirv.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,14 +177,14 @@ impl SpirvValue {
177177
zombie_target_undef,
178178
span,
179179
"OpBitcast on ptr without AddressingModel != Logical",
180-
)
180+
);
181181
} else {
182182
cx.tcx
183183
.sess
184184
.struct_span_err(span, "Cannot cast between pointer types")
185185
.note(&format!("from: *{}", cx.debug_type(original_pointee_ty)))
186186
.note(&format!("to: {}", cx.debug_type(self.ty)))
187-
.emit()
187+
.emit();
188188
}
189189

190190
zombie_target_undef

crates/rustc_codegen_spirv/src/codegen_cx/declare.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ use super::CodegenCx;
22
use crate::abi::ConvSpirvType;
33
use crate::attr::AggregatedSpirvAttributes;
44
use crate::builder_spirv::{SpirvConst, SpirvValue, SpirvValueExt};
5-
use crate::decorations::UnrollLoopsDecoration;
65
use crate::spirv_type::SpirvType;
76
use rspirv::spirv::{FunctionControl, LinkageType, StorageClass, Word};
87
use rustc_attr::InlineAttr;
@@ -25,10 +24,10 @@ fn attrs_to_spirv(attrs: &CodegenFnAttrs) -> FunctionControl {
2524
InlineAttr::Never => control.insert(FunctionControl::DONT_INLINE),
2625
}
2726
if attrs.flags.contains(CodegenFnAttrFlags::FFI_PURE) {
28-
control.insert(FunctionControl::PURE)
27+
control.insert(FunctionControl::PURE);
2928
}
3029
if attrs.flags.contains(CodegenFnAttrFlags::FFI_CONST) {
31-
control.insert(FunctionControl::CONST)
30+
control.insert(FunctionControl::CONST);
3231
}
3332
control
3433
}
@@ -117,12 +116,10 @@ impl<'tcx> CodegenCx<'tcx> {
117116
.as_ref()
118117
.map(ToString::to_string)
119118
.unwrap_or_else(|| instance.to_string());
120-
self.entry_stub(&instance, &fn_abi, declared, entry_name, entry)
119+
self.entry_stub(&instance, &fn_abi, declared, entry_name, entry);
121120
}
122121
if attrs.unroll_loops.is_some() {
123-
self.unroll_loops_decorations
124-
.borrow_mut()
125-
.insert(fn_id, UnrollLoopsDecoration {});
122+
self.unroll_loops_decorations.borrow_mut().insert(fn_id);
126123
}
127124
if attrs.internal_buffer_load.is_some() {
128125
self.internal_buffer_load_id.borrow_mut().insert(fn_id);

crates/rustc_codegen_spirv/src/codegen_cx/entry.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ impl<'tcx> CodegenCx<'tcx> {
8383
"PassMode {:?} invalid for entry point return type",
8484
fn_abi.ret.mode
8585
),
86-
)
86+
);
8787
}
8888
let execution_model = entry.execution_model;
8989
let fn_id = if execution_model == ExecutionModel::Kernel {
@@ -306,7 +306,7 @@ impl<'tcx> CodegenCx<'tcx> {
306306
&mut bx,
307307
&mut call_args,
308308
&mut decoration_locations,
309-
)
309+
);
310310
}
311311
bx.set_span(span);
312312
bx.call(entry_func, &call_args, None);
@@ -540,15 +540,15 @@ impl<'tcx> CodegenCx<'tcx> {
540540
self.tcx.sess.span_err(
541541
hir_param.ty_span,
542542
"uniform_constant must use &RuntimeArray<T>, not &[T]",
543-
)
543+
);
544544
}
545545
}
546546
_ => {
547547
if is_unsized {
548548
self.tcx.sess.span_err(
549549
hir_param.ty_span,
550550
"only plain slices are supported as unsized types",
551-
)
551+
);
552552
}
553553
}
554554
}
@@ -686,11 +686,11 @@ impl<'tcx> CodegenCx<'tcx> {
686686
var,
687687
Decoration::InputAttachmentIndex,
688688
std::iter::once(Operand::LiteralInt32(attachment_index.value)),
689-
)
689+
);
690690
} else if is_subpass_input {
691691
self.tcx
692692
.sess
693-
.span_err(hir_param.ty_span, "Missing capability InputAttachment")
693+
.span_err(hir_param.ty_span, "Missing capability InputAttachment");
694694
} else {
695695
self.tcx.sess.span_err(
696696
attachment_index.span,
@@ -702,7 +702,7 @@ impl<'tcx> CodegenCx<'tcx> {
702702
self.tcx.sess.span_err(
703703
hir_param.ty_span,
704704
"Image types with dim = SubpassData require #[spirv(input_attachment_index)] decoration",
705-
)
705+
);
706706
}
707707

708708
// Assign locations from left to right, incrementing each storage class

0 commit comments

Comments
 (0)