Skip to content

Commit 04826c2

Browse files
committed
Add workaround for MaybeUninit::uninit and bless tests
1 parent 5796ebc commit 04826c2

File tree

3 files changed

+21
-18
lines changed

3 files changed

+21
-18
lines changed

crates/rustc_codegen_spirv/src/builder/builder_methods.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3383,6 +3383,12 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
33833383
}
33843384
}
33853385

3386+
// HACK(fee1-dead): `MaybeUninit` uses a union which we don't have very good support yet. Replacing all calls to it
3387+
// with an `Undef` serves the same purpose and fixes compiler errors
3388+
if instance_def_id.is_some_and(|did| self.tcx.is_diagnostic_item(rustc_span::sym::maybe_uninit_uninit, did)) {
3389+
return self.undef(result_type);
3390+
}
3391+
33863392
// Default: emit a regular function call
33873393
let args = args.iter().map(|arg| arg.def(self)).collect::<Vec<_>>();
33883394
self.emit()

tests/compiletests/ui/arch/subgroup/subgroup_composite_enum_err.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ LL + #[repr(crate::NoFrom)]
4343
LL - #[repr(C)]
4444
LL + #[repr(crate::NoRepr)]
4545
|
46-
and 2 other candidates
46+
= and 2 other candidates
4747
help: a type parameter with a similar name exists
4848
|
4949
LL - #[repr(C)]
Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,20 @@
11
%1 = OpFunction %2 None %3
22
%4 = OpLabel
3-
OpLine %5 13 11
4-
%6 = OpCompositeInsert %7 %8 %9 0
5-
%10 = OpCompositeExtract %11 %6 1
6-
OpLine %12 1026 14
7-
%13 = OpBitcast %14 %8
8-
OpLine %12 1026 8
9-
%15 = OpINotEqual %16 %13 %17
3+
OpLine %5 1035 14
4+
%6 = OpBitcast %7 %8
5+
OpLine %5 1035 8
6+
%9 = OpINotEqual %10 %6 %11
107
OpNoLine
11-
OpSelectionMerge %18 None
12-
OpBranchConditional %15 %19 %20
13-
%19 = OpLabel
14-
OpBranch %18
15-
%20 = OpLabel
16-
OpBranch %18
17-
%18 = OpLabel
18-
%21 = OpPhi %11 %10 %19 %22 %20
19-
OpLine %5 13 4
20-
OpStore %23 %21
8+
OpSelectionMerge %12 None
9+
OpBranchConditional %9 %13 %14
10+
%13 = OpLabel
11+
OpBranch %12
12+
%14 = OpLabel
13+
OpBranch %12
14+
%12 = OpLabel
15+
%15 = OpPhi %16 %17 %13 %18 %14
16+
OpLine %19 13 4
17+
OpStore %20 %15
2118
OpNoLine
2219
OpReturn
2320
OpFunctionEnd

0 commit comments

Comments
 (0)