diff --git a/crates/rustc_codegen_spirv/src/abi.rs b/crates/rustc_codegen_spirv/src/abi.rs index 622c1f59ee..f3559d6fa9 100644 --- a/crates/rustc_codegen_spirv/src/abi.rs +++ b/crates/rustc_codegen_spirv/src/abi.rs @@ -408,7 +408,7 @@ impl<'tcx> ConvSpirvType<'tcx> for TyAndLayout<'tcx> { // Note: We can't use auto_struct_layout here because the spirv types here might be undefined due to // recursive pointer types. let a_offset = Size::ZERO; - let b_offset = a.value.size(cx).align_to(b.value.align(cx).abi); + let b_offset = a.primitive().size(cx).align_to(b.primitive().align(cx).abi); let a = trans_scalar(cx, span, *self, a, a_offset); let b = trans_scalar(cx, span, *self, b, b_offset); let size = if self.is_unsized() { @@ -470,7 +470,7 @@ pub fn scalar_pair_element_backend_type<'tcx>( }; let offset = match index { 0 => Size::ZERO, - 1 => a.value.size(cx).align_to(b.value.align(cx).abi), + 1 => a.primitive().size(cx).align_to(b.primitive().align(cx).abi), _ => unreachable!(), }; trans_scalar(cx, span, ty, [a, b][index], offset) @@ -494,7 +494,7 @@ fn trans_scalar<'tcx>( return SpirvType::Bool.def(span, cx); } - match scalar.value { + match scalar.primitive() { Primitive::Int(width, signedness) => { SpirvType::Integer(width.size().bits() as u32, signedness).def(span, cx) } diff --git a/crates/rustc_codegen_spirv/src/builder/builder_methods.rs b/crates/rustc_codegen_spirv/src/builder/builder_methods.rs index 822bbce5b7..c32985572e 100644 --- a/crates/rustc_codegen_spirv/src/builder/builder_methods.rs +++ b/crates/rustc_codegen_spirv/src/builder/builder_methods.rs @@ -918,7 +918,10 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> { ); OperandValue::Immediate(self.to_immediate(llval, place.layout)) } else if let Abi::ScalarPair(a, b) = place.layout.abi { - let b_offset = a.value.size(self).align_to(b.value.align(self).abi); + let b_offset = a + .primitive() + .size(self) + .align_to(b.primitive().align(self).abi); let pair_ty = place.layout.spirv_type(self.span(), self); let mut load = |i, scalar: Scalar, align| { diff --git a/crates/rustc_codegen_spirv/src/codegen_cx/constant.rs b/crates/rustc_codegen_spirv/src/codegen_cx/constant.rs index 55facd2f60..b75f928eba 100644 --- a/crates/rustc_codegen_spirv/src/codegen_cx/constant.rs +++ b/crates/rustc_codegen_spirv/src/codegen_cx/constant.rs @@ -20,6 +20,11 @@ impl<'tcx> CodegenCx<'tcx> { self.builder.def_constant(ty, SpirvConst::U32(val as u32)) } + pub fn constant_i16(&self, span: Span, val: i16) -> SpirvValue { + let ty = SpirvType::Integer(16, true).def(span, self); + self.builder.def_constant(ty, SpirvConst::U32(val as u32)) + } + pub fn constant_u16(&self, span: Span, val: u16) -> SpirvValue { let ty = SpirvType::Integer(16, false).def(span, self); self.builder.def_constant(ty, SpirvConst::U32(val as u32)) @@ -139,6 +144,9 @@ impl<'tcx> ConstMethods<'tcx> for CodegenCx<'tcx> { fn const_bool(&self, val: bool) -> Self::Value { self.constant_bool(DUMMY_SP, val) } + fn const_i16(&self, i: i16) -> Self::Value { + self.constant_i16(DUMMY_SP, i) + } fn const_i32(&self, i: i32) -> Self::Value { self.constant_i32(DUMMY_SP, i) } @@ -213,10 +221,10 @@ impl<'tcx> ConstMethods<'tcx> for CodegenCx<'tcx> { ) -> Self::Value { match scalar { Scalar::Int(int) => { - assert_eq!(int.size(), layout.value.size(self)); + assert_eq!(int.size(), layout.primitive().size(self)); let data = int.to_bits(int.size()).unwrap(); - match layout.value { + match layout.primitive() { Primitive::Int(int_size, int_signedness) => match self.lookup_type(ty) { SpirvType::Integer(width, spirv_signedness) => { assert_eq!(width as u64, int_size.size().bits()); @@ -297,7 +305,7 @@ impl<'tcx> ConstMethods<'tcx> for CodegenCx<'tcx> { // let offset = self.constant_u64(ptr.offset.bytes()); // self.gep(base_addr, once(offset)) }; - if layout.value != Primitive::Pointer { + if layout.primitive() != Primitive::Pointer { self.tcx .sess .fatal("Non-pointer-typed scalar_to_backend Scalar::Ptr not supported"); @@ -347,7 +355,7 @@ impl<'tcx> CodegenCx<'tcx> { pub fn primitive_to_scalar(&self, value: Primitive) -> abi::Scalar { let bits = value.size(self.data_layout()).bits(); assert!(bits <= 128); - abi::Scalar { + abi::Scalar::Initialized { value, valid_range: abi::WrappingRange { start: 0, diff --git a/crates/rustc_codegen_spirv/src/lib.rs b/crates/rustc_codegen_spirv/src/lib.rs index abaffd56f0..ce97afb9d4 100644 --- a/crates/rustc_codegen_spirv/src/lib.rs +++ b/crates/rustc_codegen_spirv/src/lib.rs @@ -224,7 +224,7 @@ fn is_blocklisted_fn<'tcx>( return true; } - if tcx.opt_item_name(def.did).map(|i| i.name) == Some(sym.fmt_decimal) { + if tcx.opt_item_ident(def.did).map(|i| i.name) == Some(sym.fmt_decimal) { if let Some(parent_def_id) = tcx.parent(def.did) { if is_debug_fmt_method(parent_def_id) { return true; @@ -308,7 +308,7 @@ impl CodegenBackend for SpirvCodegenBackend { .cg .target_cpu .clone() - .unwrap_or_else(|| tcx.sess.target.cpu.clone()), + .unwrap_or_else(|| tcx.sess.target.cpu.to_string()), metadata, need_metadata_module, )) diff --git a/crates/rustc_codegen_spirv/src/target.rs b/crates/rustc_codegen_spirv/src/target.rs index 6b3f8dfe0b..1f68b5e8a1 100644 --- a/crates/rustc_codegen_spirv/src/target.rs +++ b/crates/rustc_codegen_spirv/src/target.rs @@ -77,23 +77,23 @@ impl SpirvTarget { pub fn rustc_target(&self) -> Target { Target { - llvm_target: self.to_string(), + llvm_target: self.to_string().into(), pointer_width: 32, - data_layout: "e-m:e-p:32:32:32-i64:64-n8:16:32:64".to_string(), - arch: String::from(ARCH), + data_layout: "e-m:e-p:32:32:32-i64:64-n8:16:32:64".into(), + arch: ARCH.into(), options: TargetOptions { simd_types_indirect: false, allows_weak_linkage: false, crt_static_allows_dylibs: true, - dll_prefix: "".to_string(), - dll_suffix: ".spv".to_string(), + dll_prefix: "".into(), + dll_suffix: ".spv".into(), dynamic_linking: true, emit_debug_gdb_scripts: false, linker_flavor: LinkerFlavor::Ld, panic_strategy: PanicStrategy::Abort, - os: "unknown".to_string(), - env: self.env.to_string(), - vendor: self.vendor.clone(), + os: "unknown".into(), + env: self.env.to_string().into(), + vendor: self.vendor.clone().into(), // TODO: Investigate if main_needs_argc_argv is useful (for building exes) main_needs_argc_argv: false, ..Default::default() diff --git a/rust-toolchain b/rust-toolchain index 9f910a8c97..508709959b 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -5,5 +5,5 @@ # to the user in the error, instead of "error: invalid channel name '[toolchain]'". [toolchain] -channel = "nightly-2022-04-01" +channel = "nightly-2022-04-11" components = ["rust-src", "rustc-dev", "llvm-tools-preview"] diff --git a/tests/ui/arch/debug_printf_type_checking.stderr b/tests/ui/arch/debug_printf_type_checking.stderr index dbd657a8de..f719d0abaa 100644 --- a/tests/ui/arch/debug_printf_type_checking.stderr +++ b/tests/ui/arch/debug_printf_type_checking.stderr @@ -89,6 +89,16 @@ error[E0277]: the trait bound `{float}: Vector` is not satisfied | | the trait `Vector` is not implemented for `{float}` | required by a bound introduced by this call | + = help: the following other types implement trait `Vector`: + > + > + > + > + > + > + > + > + and 9 others note: required by a bound in `debug_printf_assert_is_vector` --> $SPIRV_STD_SRC/lib.rs:144:8 | diff --git a/tests/ui/dis/ptr_copy.normal.stderr b/tests/ui/dis/ptr_copy.normal.stderr index 456e4027f0..4a231613fd 100644 --- a/tests/ui/dis/ptr_copy.normal.stderr +++ b/tests/ui/dis/ptr_copy.normal.stderr @@ -1,8 +1,8 @@ error: Cannot memcpy dynamically sized data - --> $CORE_SRC/intrinsics.rs:2193:14 + --> $CORE_SRC/intrinsics.rs:2210:9 | -2193 | unsafe { copy(src, dst, count) } - | ^^^^^^^^^^^^^^^^^^^^^ +2210 | copy(src, dst, count) + | ^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/tests/ui/dis/ptr_read.stderr b/tests/ui/dis/ptr_read.stderr index b9bc2769f4..4c0d5a11e6 100644 --- a/tests/ui/dis/ptr_read.stderr +++ b/tests/ui/dis/ptr_read.stderr @@ -2,7 +2,7 @@ %4 = OpFunctionParameter %5 %6 = OpFunctionParameter %5 %7 = OpLabel -OpLine %8 971 8 +OpLine %8 1096 8 %9 = OpLoad %10 %4 OpLine %11 7 13 OpStore %6 %9 diff --git a/tests/ui/dis/ptr_read_method.stderr b/tests/ui/dis/ptr_read_method.stderr index b9bc2769f4..4c0d5a11e6 100644 --- a/tests/ui/dis/ptr_read_method.stderr +++ b/tests/ui/dis/ptr_read_method.stderr @@ -2,7 +2,7 @@ %4 = OpFunctionParameter %5 %6 = OpFunctionParameter %5 %7 = OpLabel -OpLine %8 971 8 +OpLine %8 1096 8 %9 = OpLoad %10 %4 OpLine %11 7 13 OpStore %6 %9 diff --git a/tests/ui/dis/ptr_write.stderr b/tests/ui/dis/ptr_write.stderr index 8421e351d5..e6c664af59 100644 --- a/tests/ui/dis/ptr_write.stderr +++ b/tests/ui/dis/ptr_write.stderr @@ -4,7 +4,7 @@ %7 = OpLabel OpLine %8 7 35 %9 = OpLoad %10 %4 -OpLine %11 1162 8 +OpLine %11 1287 8 OpStore %6 %9 OpLine %8 8 1 OpReturn diff --git a/tests/ui/dis/ptr_write_method.stderr b/tests/ui/dis/ptr_write_method.stderr index ce31917168..fb2b4814d2 100644 --- a/tests/ui/dis/ptr_write_method.stderr +++ b/tests/ui/dis/ptr_write_method.stderr @@ -4,7 +4,7 @@ %7 = OpLabel OpLine %8 7 37 %9 = OpLoad %10 %4 -OpLine %11 1162 8 +OpLine %11 1287 8 OpStore %6 %9 OpLine %8 8 1 OpReturn diff --git a/tests/ui/image/gather_err.stderr b/tests/ui/image/gather_err.stderr index fe11b158f4..008830b756 100644 --- a/tests/ui/image/gather_err.stderr +++ b/tests/ui/image/gather_err.stderr @@ -4,10 +4,10 @@ error[E0277]: the trait bound `Image` | - = help: the following implementations were found: - as HasGather> - as HasGather> - as HasGather> + = help: the following other types implement trait `HasGather`: + Image + Image + Image note: required by a bound in `Image::::gather` --> $SPIRV_STD_SRC/image.rs:164:15 | @@ -20,10 +20,10 @@ error[E0277]: the trait bound `Image` | - = help: the following implementations were found: - as HasGather> - as HasGather> - as HasGather> + = help: the following other types implement trait `HasGather`: + Image + Image + Image note: required by a bound in `Image::::gather` --> $SPIRV_STD_SRC/image.rs:164:15 | diff --git a/tests/ui/image/query/query_levels_err.stderr b/tests/ui/image/query/query_levels_err.stderr index 35bf895547..d07ecad4f2 100644 --- a/tests/ui/image/query/query_levels_err.stderr +++ b/tests/ui/image/query/query_levels_err.stderr @@ -4,11 +4,11 @@ error[E0277]: the trait bound `Image` | - = help: the following implementations were found: - as HasQueryLevels> - as HasQueryLevels> - as HasQueryLevels> - as HasQueryLevels> + = help: the following other types implement trait `HasQueryLevels`: + Image + Image + Image + Image note: required by a bound in `Image::::query_levels` --> $SPIRV_STD_SRC/image.rs:821:15 | diff --git a/tests/ui/image/query/query_lod_err.stderr b/tests/ui/image/query/query_lod_err.stderr index 9d849dfbce..b439d09ac8 100644 --- a/tests/ui/image/query/query_lod_err.stderr +++ b/tests/ui/image/query/query_lod_err.stderr @@ -4,11 +4,11 @@ error[E0277]: the trait bound `Image` | - = help: the following implementations were found: - as HasQueryLevels> - as HasQueryLevels> - as HasQueryLevels> - as HasQueryLevels> + = help: the following other types implement trait `HasQueryLevels`: + Image + Image + Image + Image note: required by a bound in `Image::::query_lod` --> $SPIRV_STD_SRC/image.rs:847:15 | diff --git a/tests/ui/image/query/query_size_err.stderr b/tests/ui/image/query/query_size_err.stderr index 310990aa75..71aa4c107f 100644 --- a/tests/ui/image/query/query_size_err.stderr +++ b/tests/ui/image/query/query_size_err.stderr @@ -4,12 +4,16 @@ error[E0277]: the trait bound `Image` | - = help: the following implementations were found: - as HasQuerySize> - as HasQuerySize> - as HasQuerySize> - as HasQuerySize> - and 10 others + = help: the following other types implement trait `HasQuerySize`: + Image + Image + Image + Image + Image + Image + Image + Image + and 6 others note: required by a bound in `Image::::query_size` --> $SPIRV_STD_SRC/image.rs:878:15 | diff --git a/tests/ui/image/query/query_size_lod_err.stderr b/tests/ui/image/query/query_size_lod_err.stderr index e74f3a386a..1341d6610b 100644 --- a/tests/ui/image/query/query_size_lod_err.stderr +++ b/tests/ui/image/query/query_size_lod_err.stderr @@ -4,11 +4,11 @@ error[E0277]: the trait bound `Image` | - = help: the following implementations were found: - as HasQuerySizeLod> - as HasQuerySizeLod> - as HasQuerySizeLod> - as HasQuerySizeLod> + = help: the following other types implement trait `HasQuerySizeLod`: + Image + Image + Image + Image note: required by a bound in `Image::::query_size_lod` --> $SPIRV_STD_SRC/image.rs:911:15 | diff --git a/tests/ui/lang/core/unwrap_or.stderr b/tests/ui/lang/core/unwrap_or.stderr index bb29238506..f1ee7d7291 100644 --- a/tests/ui/lang/core/unwrap_or.stderr +++ b/tests/ui/lang/core/unwrap_or.stderr @@ -4,30 +4,30 @@ OpLine %5 11 11 %6 = OpCompositeInsert %7 %8 %9 0 OpLine %5 11 11 %10 = OpCompositeExtract %11 %6 1 -OpLine %12 781 14 +OpLine %12 780 14 %13 = OpBitcast %14 %8 -OpLine %12 781 8 +OpLine %12 780 8 OpSelectionMerge %15 None OpSwitch %13 %16 0 %17 1 %18 %16 = OpLabel -OpLine %12 781 14 +OpLine %12 780 14 OpUnreachable %17 = OpLabel -OpLine %12 783 20 +OpLine %12 782 20 OpBranch %15 %18 = OpLabel -OpLine %12 782 23 +OpLine %12 781 23 OpBranch %15 %15 = OpLabel %19 = OpPhi %20 %21 %17 %22 %18 %23 = OpPhi %11 %24 %17 %10 %18 OpBranch %25 %25 = OpLabel -OpLine %12 785 4 +OpLine %12 784 4 OpSelectionMerge %26 None OpBranchConditional %19 %27 %28 %27 = OpLabel -OpLine %12 785 4 +OpLine %12 784 4 OpBranch %26 %28 = OpLabel OpBranch %26