diff --git a/CHANGELOG.md b/CHANGELOG.md index 7143fd3d42..c159a079b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed 🛠️ +- Updated toolchain to `nightly-2022-10-15` - Applied workspace inheritance to Cargo.toml files ### Removed 🔥 diff --git a/crates/rustc_codegen_spirv/build.rs b/crates/rustc_codegen_spirv/build.rs index 40e878e94b..43d42a6f84 100644 --- a/crates/rustc_codegen_spirv/build.rs +++ b/crates/rustc_codegen_spirv/build.rs @@ -10,9 +10,9 @@ use std::process::{Command, ExitCode}; /// `cargo publish`. We need to figure out a way to do this properly, but let's hardcode it for now :/ //const REQUIRED_RUST_TOOLCHAIN: &str = include_str!("../../rust-toolchain"); const REQUIRED_RUST_TOOLCHAIN: &str = r#"[toolchain] -channel = "nightly-2022-10-01" +channel = "nightly-2022-10-15" components = ["rust-src", "rustc-dev", "llvm-tools-preview"] -# commit_hash = 8ce3204af9463db3192ea1eb31c45c2f6d4b5ae6"#; +# commit_hash = bf15a9e5263fcea065a7ae9c179b2d24c2deb670"#; fn get_rustc_commit_hash() -> Result> { let rustc = std::env::var("RUSTC").unwrap_or_else(|_| String::from("rustc")); diff --git a/crates/rustc_codegen_spirv/src/attr.rs b/crates/rustc_codegen_spirv/src/attr.rs index 5439eee05f..c6092e1dc6 100644 --- a/crates/rustc_codegen_spirv/src/attr.rs +++ b/crates/rustc_codegen_spirv/src/attr.rs @@ -244,7 +244,7 @@ fn target_from_impl_item<'tcx>(tcx: TyCtxt<'tcx>, impl_item: &hir::ImplItem<'_>) Target::Method(MethodKind::Inherent) } } - hir::ImplItemKind::TyAlias(..) => Target::AssocTy, + hir::ImplItemKind::Type(..) => Target::AssocTy, } } diff --git a/crates/rustc_codegen_spirv/src/builder/builder_methods.rs b/crates/rustc_codegen_spirv/src/builder/builder_methods.rs index 28a538b86d..a9c597cf6a 100644 --- a/crates/rustc_codegen_spirv/src/builder/builder_methods.rs +++ b/crates/rustc_codegen_spirv/src/builder/builder_methods.rs @@ -18,6 +18,7 @@ use rustc_codegen_ssa::MemFlags; use rustc_middle::bug; use rustc_middle::ty::Ty; use rustc_span::Span; +use rustc_target::abi::call::FnAbi; use rustc_target::abi::{Abi, Align, Scalar, Size, WrappingRange}; use std::convert::TryInto; use std::iter::{self, empty}; @@ -795,6 +796,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> { fn invoke( &mut self, llty: Self::Type, + fn_abi: Option<&FnAbi<'tcx, Ty<'tcx>>>, llfn: Self::Value, args: &[Self::Value], then: Self::BasicBlock, @@ -802,7 +804,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> { funclet: Option<&Self::Funclet>, ) -> Self::Value { // Exceptions don't exist, jump directly to then block - let result = self.call(llty, llfn, args, funclet); + let result = self.call(llty, fn_abi, llfn, args, funclet); self.emit().branch(then).unwrap(); result } @@ -1009,13 +1011,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> { result_id.with_type(ptr_ty) } - fn dynamic_alloca(&mut self, ty: Self::Type, align: Align) -> Self::Value { - let result = self.alloca(ty, align); - self.err("dynamic alloca is not supported yet"); - result - } - - fn array_alloca(&mut self, _ty: Self::Type, _len: Self::Value, _align: Align) -> Self::Value { + fn byte_array_alloca(&mut self, _len: Self::Value, _align: Align) -> Self::Value { self.fatal("array alloca not supported yet") } @@ -2293,6 +2289,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> { fn call( &mut self, callee_ty: Self::Type, + _fn_abi: Option<&FnAbi<'tcx, Ty<'tcx>>>, callee: Self::Value, args: &[Self::Value], funclet: Option<&Self::Funclet>, diff --git a/crates/rustc_codegen_spirv/src/builder/mod.rs b/crates/rustc_codegen_spirv/src/builder/mod.rs index a4fb651aff..08b5d3e488 100644 --- a/crates/rustc_codegen_spirv/src/builder/mod.rs +++ b/crates/rustc_codegen_spirv/src/builder/mod.rs @@ -364,8 +364,6 @@ impl<'a, 'tcx> ArgAbiMethods<'tcx> for Builder<'a, 'tcx> { } impl<'a, 'tcx> AbiBuilderMethods<'tcx> for Builder<'a, 'tcx> { - fn apply_attrs_callsite(&mut self, _fn_abi: &FnAbi<'tcx, Ty<'tcx>>, _callsite: Self::Value) {} - fn get_param(&mut self, index: usize) -> Self::Value { self.function_parameter_values.borrow()[&self.current_fn.def(self)][index] } diff --git a/crates/rustc_codegen_spirv/src/codegen_cx/entry.rs b/crates/rustc_codegen_spirv/src/codegen_cx/entry.rs index 7f2062b92f..9a24ddf3e6 100644 --- a/crates/rustc_codegen_spirv/src/codegen_cx/entry.rs +++ b/crates/rustc_codegen_spirv/src/codegen_cx/entry.rs @@ -98,7 +98,7 @@ impl<'tcx> CodegenCx<'tcx> { let fn_id = self.shader_entry_stub( span, entry_func, - &fn_abi.args, + fn_abi, hir_params, name, entry.execution_model, @@ -116,7 +116,7 @@ impl<'tcx> CodegenCx<'tcx> { &self, span: Span, entry_func: SpirvValue, - arg_abis: &[ArgAbi<'tcx, Ty<'tcx>>], + entry_fn_abi: &FnAbi<'tcx, Ty<'tcx>>, hir_params: &[hir::Param<'tcx>], name: String, execution_model: ExecutionModel, @@ -141,7 +141,7 @@ impl<'tcx> CodegenCx<'tcx> { let mut bx = Builder::build(self, Builder::append_block(self, stub_fn, "")); let mut call_args = vec![]; let mut decoration_locations = FxHashMap::default(); - for (entry_arg_abi, hir_param) in arg_abis.iter().zip(hir_params) { + for (entry_arg_abi, hir_param) in entry_fn_abi.args.iter().zip(hir_params) { bx.set_span(hir_param.span); self.declare_shader_interface_for_param( execution_model, @@ -154,7 +154,13 @@ impl<'tcx> CodegenCx<'tcx> { ); } bx.set_span(span); - bx.call(entry_func.ty, entry_func, &call_args, None); + bx.call( + entry_func.ty, + Some(entry_fn_abi), + entry_func, + &call_args, + None, + ); bx.ret_void(); let stub_fn_id = stub_fn.def_cx(self); diff --git a/crates/rustc_codegen_spirv/src/codegen_cx/mod.rs b/crates/rustc_codegen_spirv/src/codegen_cx/mod.rs index 18253e592d..59fae40be2 100644 --- a/crates/rustc_codegen_spirv/src/codegen_cx/mod.rs +++ b/crates/rustc_codegen_spirv/src/codegen_cx/mod.rs @@ -559,14 +559,6 @@ impl<'tcx> MiscMethods<'tcx> for CodegenCx<'tcx> { self.codegen_unit } - fn used_statics(&self) -> &RefCell> { - todo!() - } - - fn compiler_used_statics(&self) -> &RefCell> { - todo!() - } - fn set_frame_pointer_type(&self, _llfn: Self::Function) { todo!() } @@ -575,14 +567,6 @@ impl<'tcx> MiscMethods<'tcx> for CodegenCx<'tcx> { todo!() } - fn create_used_variable(&self) { - todo!() - } - - fn create_compiler_used_variable(&self) { - todo!() - } - fn declare_c_main(&self, _fn_type: Self::Type) -> Option { todo!() } diff --git a/crates/rustc_codegen_spirv/src/lib.rs b/crates/rustc_codegen_spirv/src/lib.rs index dbf5111553..ae2af7d38b 100644 --- a/crates/rustc_codegen_spirv/src/lib.rs +++ b/crates/rustc_codegen_spirv/src/lib.rs @@ -287,7 +287,6 @@ impl WriteBackendMethods for SpirvCodegenBackend { type Module = Vec; type TargetMachine = (); type ModuleBuffer = SpirvModuleBuffer; - type Context = (); type ThinData = (); type ThinBuffer = SpirvThinBuffer; @@ -401,7 +400,7 @@ impl ExtraBackendMethods for SpirvCodegenBackend { ) -> (ModuleCodegen, u64) { let _timer = tcx .prof - .extra_verbose_generic_activity("codegen_module", cgu_name.to_string()); + .verbose_generic_activity_with_arg("codegen_module", cgu_name.to_string()); // TODO: Do dep_graph stuff let cgu = tcx.codegen_unit(cgu_name); @@ -466,14 +465,6 @@ impl ExtraBackendMethods for SpirvCodegenBackend { { Arc::new(|_| Ok(())) } - - fn target_cpu<'b>(&self, _: &'b Session) -> &'b str { - todo!() - } - - fn tune_cpu<'b>(&self, _: &'b Session) -> Option<&'b str> { - None - } } struct DumpModuleOnPanic<'a, 'cx, 'tcx> { diff --git a/crates/rustc_codegen_spirv/src/target.rs b/crates/rustc_codegen_spirv/src/target.rs index 48298dfac1..8b9fdd83a7 100644 --- a/crates/rustc_codegen_spirv/src/target.rs +++ b/crates/rustc_codegen_spirv/src/target.rs @@ -1,5 +1,5 @@ use rspirv::spirv::MemoryModel; -use rustc_target::spec::{LinkerFlavor, PanicStrategy, Target, TargetOptions}; +use rustc_target::spec::{Cc, LinkerFlavor, PanicStrategy, Target, TargetOptions}; use spirv_tools::TargetEnv; const ARCH: &str = "spirv"; @@ -84,7 +84,7 @@ impl SpirvTarget { o.dll_suffix = ".spv".into(); o.dynamic_linking = true; o.emit_debug_gdb_scripts = false; - o.linker_flavor = LinkerFlavor::Ld; + o.linker_flavor = LinkerFlavor::Unix(Cc::No); o.panic_strategy = PanicStrategy::Abort; o.os = "unknown".into(); o.env = self.env.to_string().into(); diff --git a/examples/runners/ash/src/main.rs b/examples/runners/ash/src/main.rs index 055b57eac6..4ec661ee6d 100644 --- a/examples/runners/ash/src/main.rs +++ b/examples/runners/ash/src/main.rs @@ -392,7 +392,7 @@ impl RenderBase { let swapchain_loader = khr::Swapchain::new(&instance, &device); - let present_queue = unsafe { device.get_device_queue(queue_family_index as u32, 0) }; + let present_queue = unsafe { device.get_device_queue(queue_family_index, 0) }; let surface_format = { let acceptable_formats = { @@ -1263,7 +1263,7 @@ unsafe extern "system" fn vulkan_debug_callback( _user_data: *mut std::os::raw::c_void, ) -> vk::Bool32 { let callback_data = *p_callback_data; - let message_id_number: i32 = callback_data.message_id_number as i32; + let message_id_number: i32 = callback_data.message_id_number; let message_id_name = if callback_data.p_message_id_name.is_null() { Cow::from("") diff --git a/examples/runners/cpu/src/main.rs b/examples/runners/cpu/src/main.rs index bc97c9ac9a..7fccbc6975 100644 --- a/examples/runners/cpu/src/main.rs +++ b/examples/runners/cpu/src/main.rs @@ -88,7 +88,7 @@ fn srgb_oetf(x: f32) -> f32 { } fn color_u32_from_vec4(v: Vec4) -> u32 { - let convert = |f: f32| -> u32 { (f.min(1.0).max(0.0) * 255.0).round() as u32 }; + let convert = |f: f32| -> u32 { (f.clamp(0.0, 1.0) * 255.0).round() as u32 }; convert(srgb_oetf(v.z)) | convert(srgb_oetf(v.y)) << 8 diff --git a/examples/shaders/shared/src/lib.rs b/examples/shaders/shared/src/lib.rs index 69b1dd6378..9bb689c12c 100644 --- a/examples/shaders/shared/src/lib.rs +++ b/examples/shaders/shared/src/lib.rs @@ -40,7 +40,7 @@ pub struct ShaderConstants { } pub fn saturate(x: f32) -> f32 { - x.max(0.0).min(1.0) + x.clamp(0.0, 1.0) } pub fn pow(v: Vec3, power: f32) -> Vec3 { diff --git a/rust-toolchain b/rust-toolchain index 4764b329dd..d4559e9fc9 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -5,9 +5,9 @@ # to the user in the error, instead of "error: invalid channel name '[toolchain]'". [toolchain] -channel = "nightly-2022-10-01" +channel = "nightly-2022-10-15" components = ["rust-src", "rustc-dev", "llvm-tools-preview"] -# commit_hash = 8ce3204af9463db3192ea1eb31c45c2f6d4b5ae6 +# commit_hash = bf15a9e5263fcea065a7ae9c179b2d24c2deb670 # Whenever changing the nightly channel, update the commit hash above, and make # sure to change REQUIRED_TOOLCHAIN in crates/rustc_codegen_spirv/src/build.rs also. diff --git a/tests/ui/dis/ptr_read.stderr b/tests/ui/dis/ptr_read.stderr index 7283eb76d5..1138fe40c3 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 1117 8 +OpLine %8 1122 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 7283eb76d5..1138fe40c3 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 1117 8 +OpLine %8 1122 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 8728f227f8..d290c2dda0 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 1310 8 +OpLine %11 1316 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 b1724cc739..0d96a3fc28 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 1310 8 +OpLine %11 1316 8 OpStore %6 %9 OpLine %8 8 1 OpReturn diff --git a/tests/ui/lang/core/unwrap_or.stderr b/tests/ui/lang/core/unwrap_or.stderr index 837ffe53c6..37b092466a 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 800 14 +OpLine %12 803 14 %13 = OpBitcast %14 %8 -OpLine %12 800 8 +OpLine %12 803 8 OpSelectionMerge %15 None OpSwitch %13 %16 0 %17 1 %18 %16 = OpLabel -OpLine %12 800 14 +OpLine %12 803 14 OpUnreachable %17 = OpLabel -OpLine %12 802 20 +OpLine %12 805 20 OpBranch %15 %18 = OpLabel -OpLine %12 801 23 +OpLine %12 804 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 804 4 +OpLine %12 807 4 OpSelectionMerge %26 None OpBranchConditional %19 %27 %28 %27 = OpLabel -OpLine %12 804 4 +OpLine %12 807 4 OpBranch %26 %28 = OpLabel OpBranch %26