rustup: update to nightly-2023-04-15.

This commit is contained in:
Eduard-Mihai Burtescu 2023-06-02 01:40:38 +03:00 committed by Eduard-Mihai Burtescu
parent 87b7d135ab
commit e9cdb9666b
20 changed files with 93 additions and 85 deletions

View File

@ -36,6 +36,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
(using ranges instead of just the starting position, and tracking inlined calls) (using ranges instead of just the starting position, and tracking inlined calls)
### Changed 🛠 ### Changed 🛠
- [PR#1067](https://github.com/EmbarkStudios/rust-gpu/pull/1067) updated toolchain to `nightly-2023-04-15`
- [PR#1038](https://github.com/EmbarkStudios/rust-gpu/pull/1038) relaxed `glam` version requirements (from only `0.22`, to `>=0.22, <=0.24`) - [PR#1038](https://github.com/EmbarkStudios/rust-gpu/pull/1038) relaxed `glam` version requirements (from only `0.22`, to `>=0.22, <=0.24`)
### Removed 🔥 ### Removed 🔥
@ -66,7 +67,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
(see also [the `--no-early-report-zombies` codegen args docs](docs/src/codegen-args.md#--no-early-report-zombies)) (see also [the `--no-early-report-zombies` codegen args docs](docs/src/codegen-args.md#--no-early-report-zombies))
- [PR#1035](https://github.com/EmbarkStudios/rust-gpu/pull/1035) reduced the number of CGUs ("codegen units") used by `spirv-builder` to just `1` - [PR#1035](https://github.com/EmbarkStudios/rust-gpu/pull/1035) reduced the number of CGUs ("codegen units") used by `spirv-builder` to just `1`
- [PR#1011](https://github.com/EmbarkStudios/rust-gpu/pull/1011) made `NonWritable` all read-only storage buffers (i.e. those typed `&T`, where `T` doesn't have interior mutability) - [PR#1011](https://github.com/EmbarkStudios/rust-gpu/pull/1011) made `NonWritable` all read-only storage buffers (i.e. those typed `&T`, where `T` doesn't have interior mutability)
- [PR#1029](https://github.com/EmbarkStudios/rust-gpu/pull/1029) fixed SampledImage::sample() fns being unnecessarily marked as unsafe - [PR#1029](https://github.com/EmbarkStudios/rust-gpu/pull/1029) fixed `SampledImage::sample` `fn`s being unnecessarily marked as `unsafe`
- [PR#1005](https://github.com/EmbarkStudios/rust-gpu/pull/1005) updated toolchain to `nightly-2023-03-04`
### Fixed 🩹 ### Fixed 🩹
- [PR#1041](https://github.com/EmbarkStudios/rust-gpu/pull/1041) fixed `Image::gather()` not always returning a `Vec4`. - [PR#1041](https://github.com/EmbarkStudios/rust-gpu/pull/1041) fixed `Image::gather()` not always returning a `Vec4`.

View File

@ -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 :/ /// `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 = include_str!("../../rust-toolchain");
const REQUIRED_RUST_TOOLCHAIN: &str = r#"[toolchain] const REQUIRED_RUST_TOOLCHAIN: &str = r#"[toolchain]
channel = "nightly-2023-03-04" channel = "nightly-2023-04-15"
components = ["rust-src", "rustc-dev", "llvm-tools-preview"] components = ["rust-src", "rustc-dev", "llvm-tools-preview"]
# commit_hash = 44cfafe2fafe816395d3acc434663a45d5178c41"#; # commit_hash = 84dd17b56a931a631a23dfd5ef2018fd3ef49108"#;
fn get_rustc_commit_hash() -> Result<String, Box<dyn Error>> { fn get_rustc_commit_hash() -> Result<String, Box<dyn Error>> {
let rustc = std::env::var("RUSTC").unwrap_or_else(|_| String::from("rustc")); let rustc = std::env::var("RUSTC").unwrap_or_else(|_| String::from("rustc"));

View File

@ -424,7 +424,7 @@ impl<'tcx> ConvSpirvType<'tcx> for TyAndLayout<'tcx> {
if let TyKind::Adt(adt, _) = self.ty.kind() { if let TyKind::Adt(adt, _) = self.ty.kind() {
if let Variants::Single { index } = self.variants { if let Variants::Single { index } = self.variants {
for i in self.fields.index_by_increasing_offset() { for i in self.fields.index_by_increasing_offset() {
let field = &adt.variants()[index].fields[i]; let field = &adt.variants()[index].fields[i.into()];
field_names.push(field.name); field_names.push(field.name);
} }
} }
@ -711,7 +711,7 @@ fn trans_struct<'tcx>(cx: &CodegenCx<'tcx>, span: Span, ty: TyAndLayout<'tcx>) -
field_offsets.push(offset); field_offsets.push(offset);
if let Variants::Single { index } = ty.variants { if let Variants::Single { index } = ty.variants {
if let TyKind::Adt(adt, _) = ty.ty.kind() { if let TyKind::Adt(adt, _) = ty.ty.kind() {
let field = &adt.variants()[index].fields[i]; let field = &adt.variants()[index].fields[i.into()];
field_names.push(field.name); field_names.push(field.name);
} else { } else {
// FIXME(eddyb) this looks like something that should exist in rustc. // FIXME(eddyb) this looks like something that should exist in rustc.

View File

@ -657,6 +657,12 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
} }
fn set_span(&mut self, span: Span) { fn set_span(&mut self, span: Span) {
// HACK(eddyb) this is what `#[track_caller]` does, and we need it to be
// able to point at e.g. a use of `panic!`, instead of its implementation,
// but it should be more fine-grained and/or include macro backtraces in
// debuginfo (so the decision to use them can be deferred).
let span = span.ctxt().outer_expn().expansion_cause().unwrap_or(span);
let old_span = self.current_span.replace(span); let old_span = self.current_span.replace(span);
// FIXME(eddyb) enable this once cross-block interactions are figured out // FIXME(eddyb) enable this once cross-block interactions are figured out
@ -2392,10 +2398,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
&[SpirvValue { &[SpirvValue {
kind: SpirvValueKind::Def(format_args_id), kind: SpirvValueKind::Def(format_args_id),
.. ..
}, SpirvValue { }, _] => format_args_id,
kind: SpirvValueKind::IllegalConst(_panic_location_id),
..
}] => format_args_id,
_ => return None, _ => return None,
}; };
@ -2445,21 +2448,27 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
(operands.next().unwrap(), operands.next().unwrap()) (operands.next().unwrap(), operands.next().unwrap())
}) })
.filter(|&(store_dst_id, _)| store_dst_id == load_src_id)?; .filter(|&(store_dst_id, _)| store_dst_id == load_src_id)?;
let (call_fmt_args_new_idx, _) = relevant_insts_next_back(Op::FunctionCall) let call_fmt_args_new_idx = relevant_insts_next_back(Op::FunctionCall)
.filter(|&(_, result_id, _)| result_id == Some(store_val_id)) .filter(|&(_, result_id, _)| result_id == Some(store_val_id))
.map(|(i, _, mut operands)| (i, operands.next().unwrap(), operands)) .map(|(i, _, mut operands)| (i, operands.next().unwrap(), operands))
.filter(|&(_, callee, _)| self.fmt_args_new_fn_ids.borrow().contains(&callee)) .filter(|&(_, callee, _)| self.fmt_args_new_fn_ids.borrow().contains(&callee))
.map(|(i, _, mut call_args)| { .and_then(|(i, _, mut call_args)| {
assert_eq!(call_args.len(), 4); if call_args.len() == 4 {
// `<core::fmt::Arguments>::new_v1`
let mut arg = || call_args.next().unwrap(); let mut arg = || call_args.next().unwrap();
(i, [arg(), arg(), arg(), arg()]) let [_, _, _, fmt_args_len_id] = [arg(), arg(), arg(), arg()];
})
.filter(|&(_, [_, _, _, fmt_args_len_id])| {
// Only ever remove `fmt::Arguments` with no runtime values. // Only ever remove `fmt::Arguments` with no runtime values.
Some(i).filter(|_| {
matches!( matches!(
self.builder.lookup_const_by_id(fmt_args_len_id), self.builder.lookup_const_by_id(fmt_args_len_id),
Some(SpirvConst::U32(0)) Some(SpirvConst::U32(0))
) )
})
} else {
// `<core::fmt::Arguments>::new_const`
assert_eq!(call_args.len(), 2);
Some(i)
}
})?; })?;
// Lastly, ensure that the `Op{Store,Load}` pair operates on // Lastly, ensure that the `Op{Store,Load}` pair operates on

View File

@ -683,6 +683,11 @@ impl<'tcx> BuilderSpirv<'tcx> {
&self, &self,
span: Span, span: Span,
) -> (DebugFileSpirv<'tcx>, Range<(u32, u32)>) { ) -> (DebugFileSpirv<'tcx>, Range<(u32, u32)>) {
// HACK(eddyb) this is similar to what `#[track_caller]` does, and it
// allows us to point to the use site of a macro, instead of inside the
// macro (but ideally we would record the entire macro backtrace).
let span = span.ctxt().outer_expn().expansion_cause().unwrap_or(span);
let (lo, hi) = (span.lo(), span.hi()); let (lo, hi) = (span.lo(), span.hi());
let lo_loc = self.source_map.lookup_char_pos(lo); let lo_loc = self.source_map.lookup_char_pos(lo);

View File

@ -127,6 +127,10 @@ impl<'tcx> ConstMethods<'tcx> for CodegenCx<'tcx> {
fn const_undef(&self, ty: Self::Type) -> Self::Value { fn const_undef(&self, ty: Self::Type) -> Self::Value {
self.undef(ty) self.undef(ty)
} }
fn const_poison(&self, ty: Self::Type) -> Self::Value {
// No distinction between undef and poison.
self.const_undef(ty)
}
fn const_int(&self, t: Self::Type, i: i64) -> Self::Value { fn const_int(&self, t: Self::Type, i: i64) -> Self::Value {
self.constant_int(t, i as u64) self.constant_int(t, i as u64)
} }

View File

@ -7,6 +7,7 @@ use crate::spirv_type::SpirvType;
use rspirv::spirv::{FunctionControl, LinkageType, StorageClass, Word}; use rspirv::spirv::{FunctionControl, LinkageType, StorageClass, Word};
use rustc_attr::InlineAttr; use rustc_attr::InlineAttr;
use rustc_codegen_ssa::traits::{BaseTypeMethods, PreDefineMethods, StaticMethods}; use rustc_codegen_ssa::traits::{BaseTypeMethods, PreDefineMethods, StaticMethods};
use rustc_hir::def::DefKind;
use rustc_middle::bug; use rustc_middle::bug;
use rustc_middle::middle::codegen_fn_attrs::{CodegenFnAttrFlags, CodegenFnAttrs}; use rustc_middle::middle::codegen_fn_attrs::{CodegenFnAttrFlags, CodegenFnAttrs};
use rustc_middle::mir::mono::{Linkage, MonoItem, Visibility}; use rustc_middle::mir::mono::{Linkage, MonoItem, Visibility};
@ -124,8 +125,16 @@ impl<'tcx> CodegenCx<'tcx> {
let declared = fn_id.with_type(function_type); let declared = fn_id.with_type(function_type);
let attrs = let attrs = AggregatedSpirvAttributes::parse(
AggregatedSpirvAttributes::parse(self, self.tcx.get_attrs_unchecked(instance.def_id())); self,
match self.tcx.def_kind(instance.def_id()) {
// This was made to ICE cross-crate at some point, but then got
// reverted in https://github.com/rust-lang/rust/pull/111381.
// FIXME(eddyb) remove this workaround once we rustup past that.
DefKind::Closure => &[],
_ => self.tcx.get_attrs_unchecked(instance.def_id()),
},
);
if let Some(entry) = attrs.entry.map(|attr| attr.value) { if let Some(entry) = attrs.entry.map(|attr| attr.value) {
let entry_name = entry let entry_name = entry
.name .name
@ -178,7 +187,12 @@ impl<'tcx> CodegenCx<'tcx> {
// HACK(eddyb) there is no good way to identify this definition // HACK(eddyb) there is no good way to identify this definition
// (e.g. no `#[lang = "..."]` attribute), but this works well enough. // (e.g. no `#[lang = "..."]` attribute), but this works well enough.
if demangled_symbol_name == "<core::fmt::Arguments>::new_v1" { if [
"<core::fmt::Arguments>::new_v1",
"<core::fmt::Arguments>::new_const",
]
.contains(&&demangled_symbol_name[..])
{
self.fmt_args_new_fn_ids.borrow_mut().insert(fn_id); self.fmt_args_new_fn_ids.borrow_mut().insert(fn_id);
} }

View File

@ -69,7 +69,7 @@ pub struct CodegenCx<'tcx> {
// it mandatory even for `panic!("...")` (that were previously separate). // it mandatory even for `panic!("...")` (that were previously separate).
pub panic_entry_point_ids: RefCell<FxHashSet<Word>>, pub panic_entry_point_ids: RefCell<FxHashSet<Word>>,
/// `core::fmt::Arguments::new_v1` instances (for Rust 2021 panics). /// `core::fmt::Arguments::new_{v1,const}` instances (for Rust 2021 panics).
pub fmt_args_new_fn_ids: RefCell<FxHashSet<Word>>, pub fmt_args_new_fn_ids: RefCell<FxHashSet<Word>>,
/// Intrinsic for loading a <T> from a &[u32]. The PassMode is the mode of the <T>. /// Intrinsic for loading a <T> from a &[u32]. The PassMode is the mode of the <T>.

View File

@ -19,7 +19,7 @@
#![feature(assert_matches)] #![feature(assert_matches)]
#![feature(result_flattening)] #![feature(result_flattening)]
#![feature(lint_reasons)] #![feature(lint_reasons)]
#![feature(once_cell)] #![feature(lazy_cell)]
// crate-specific exceptions: // crate-specific exceptions:
#![allow( #![allow(
unsafe_code, // rustc_codegen_ssa requires unsafe functions in traits to be impl'd unsafe_code, // rustc_codegen_ssa requires unsafe functions in traits to be impl'd
@ -104,7 +104,7 @@ use rustc_middle::dep_graph::{WorkProduct, WorkProductId};
use rustc_middle::mir::mono::{Linkage, MonoItem, Visibility}; use rustc_middle::mir::mono::{Linkage, MonoItem, Visibility};
use rustc_middle::mir::pretty::write_mir_pretty; use rustc_middle::mir::pretty::write_mir_pretty;
use rustc_middle::ty::print::with_no_trimmed_paths; use rustc_middle::ty::print::with_no_trimmed_paths;
use rustc_middle::ty::{self, query, DefIdTree, Instance, InstanceDef, TyCtxt}; use rustc_middle::ty::{self, query, Instance, InstanceDef, TyCtxt};
use rustc_session::config::{self, OutputFilenames, OutputType}; use rustc_session::config::{self, OutputFilenames, OutputType};
use rustc_session::Session; use rustc_session::Session;
use rustc_span::symbol::{sym, Symbol}; use rustc_span::symbol::{sym, Symbol};

View File

@ -99,24 +99,14 @@ fn link_rlib(sess: &Session, codegen_results: &CodegenResults, out_filename: &Pa
file_list.push(obj); file_list.push(obj);
} }
for lib in codegen_results.crate_info.used_libraries.iter() { for lib in codegen_results.crate_info.used_libraries.iter() {
match lib.kind { if let NativeLibKind::Static {
NativeLibKind::Static {
bundle: None | Some(true), bundle: None | Some(true),
.. ..
} => {} } = lib.kind
NativeLibKind::Static { {
bundle: Some(false),
..
}
| NativeLibKind::Dylib { .. }
| NativeLibKind::Framework { .. }
| NativeLibKind::RawDylib
| NativeLibKind::LinkArg
| NativeLibKind::Unspecified => continue,
}
if let Some(name) = lib.name {
sess.err(format!( sess.err(format!(
"Adding native library to rlib not supported yet: {name}" "adding native library to rlib not supported yet: {}",
lib.name
)); ));
} }
} }
@ -441,39 +431,23 @@ fn add_upstream_native_libraries(
for &cnum in &codegen_results.crate_info.used_crates { for &cnum in &codegen_results.crate_info.used_crates {
for lib in codegen_results.crate_info.native_libraries[&cnum].iter() { for lib in codegen_results.crate_info.native_libraries[&cnum].iter() {
let name = match lib.name {
Some(l) => l,
None => continue,
};
if !relevant_lib(sess, lib) { if !relevant_lib(sess, lib) {
continue; continue;
} }
match lib.kind { match lib.kind {
NativeLibKind::Dylib { .. } | NativeLibKind::Unspecified => sess.fatal(format!(
"TODO: dylib nativelibkind not supported yet: {name}"
)),
NativeLibKind::Framework { .. } => sess.fatal(format!(
"TODO: framework nativelibkind not supported yet: {name}"
)),
NativeLibKind::Static { NativeLibKind::Static {
bundle: Some(false), bundle: Some(false),
.. ..
} => { } if data[cnum.as_usize() - 1] != Linkage::Static => {}
if data[cnum.as_usize() - 1] == Linkage::Static {
sess.fatal(format!(
"TODO: staticnobundle nativelibkind not supported yet: {name}"
))
}
}
NativeLibKind::Static { NativeLibKind::Static {
bundle: None | Some(true), bundle: None | Some(true),
.. ..
} => {} } => {}
NativeLibKind::RawDylib => {
sess.fatal(format!("raw_dylib feature not yet implemented: {name}")) _ => sess.fatal(format!(
} "`NativeLibKind::{:?}` (name={:?}) not supported yet",
NativeLibKind::LinkArg => sess.fatal(format!( lib.kind, lib.name
"TODO: linkarg nativelibkind not supported yet: {name}"
)), )),
} }
} }

View File

@ -195,6 +195,8 @@ pub fn gpu_only(_attr: TokenStream, item: TokenStream) -> TokenStream {
block, block,
} = syn::parse_macro_input!(item as syn::ItemFn); } = syn::parse_macro_input!(item as syn::ItemFn);
// FIXME(eddyb) this looks like a clippy false positive (`sig` is used below).
#[allow(clippy::redundant_clone)]
let fn_name = sig.ident.clone(); let fn_name = sig.ident.clone();
let sig_cpu = syn::Signature { let sig_cpu = syn::Signature {

View File

@ -1,7 +1,7 @@
[toolchain] [toolchain]
channel = "nightly-2023-03-04" channel = "nightly-2023-04-15"
components = ["rust-src", "rustc-dev", "llvm-tools-preview"] components = ["rust-src", "rustc-dev", "llvm-tools-preview"]
# commit_hash = 44cfafe2fafe816395d3acc434663a45d5178c41 # commit_hash = 84dd17b56a931a631a23dfd5ef2018fd3ef49108
# Whenever changing the nightly channel, update the commit hash above, and make # 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. # sure to change `REQUIRED_TOOLCHAIN` in `crates/rustc_codegen_spirv/build.rs` also.

View File

@ -1,13 +1,13 @@
error: cannot memcpy dynamically sized data error: cannot memcpy dynamically sized data
--> $CORE_SRC/intrinsics.rs:2460:9 --> $CORE_SRC/intrinsics.rs:2724:9
| |
2460 | copy(src, dst, count) 2724 | copy(src, dst, count)
| ^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^
| |
note: used from within `core::intrinsics::copy::<f32>` note: used from within `core::intrinsics::copy::<f32>`
--> $CORE_SRC/intrinsics.rs:2447:21 --> $CORE_SRC/intrinsics.rs:2710:21
| |
2447 | pub const unsafe fn copy<T>(src: *const T, dst: *mut T, count: usize) { 2710 | pub const unsafe fn copy<T>(src: *const T, dst: *mut T, count: usize) {
| ^^^^ | ^^^^
note: called by `ptr_copy::copy_via_raw_ptr` note: called by `ptr_copy::copy_via_raw_ptr`
--> $DIR/ptr_copy.rs:28:18 --> $DIR/ptr_copy.rs:28:18

View File

@ -2,7 +2,7 @@
%4 = OpFunctionParameter %5 %4 = OpFunctionParameter %5
%6 = OpFunctionParameter %5 %6 = OpFunctionParameter %5
%7 = OpLabel %7 = OpLabel
OpLine %8 1157 8 OpLine %8 1188 12
%9 = OpLoad %10 %4 %9 = OpLoad %10 %4
OpLine %11 7 13 OpLine %11 7 13
OpStore %6 %9 OpStore %6 %9

View File

@ -2,7 +2,7 @@
%4 = OpFunctionParameter %5 %4 = OpFunctionParameter %5
%6 = OpFunctionParameter %5 %6 = OpFunctionParameter %5
%7 = OpLabel %7 = OpLabel
OpLine %8 1157 8 OpLine %8 1188 12
%9 = OpLoad %10 %4 %9 = OpLoad %10 %4
OpLine %11 7 13 OpLine %11 7 13
OpStore %6 %9 OpStore %6 %9

View File

@ -4,7 +4,7 @@
%7 = OpLabel %7 = OpLabel
OpLine %8 7 35 OpLine %8 7 35
%9 = OpLoad %10 %4 %9 = OpLoad %10 %4
OpLine %11 1354 8 OpLine %11 1386 8
OpStore %6 %9 OpStore %6 %9
OpNoLine OpNoLine
OpReturn OpReturn

View File

@ -4,7 +4,7 @@
%7 = OpLabel %7 = OpLabel
OpLine %8 7 37 OpLine %8 7 37
%9 = OpLoad %10 %4 %9 = OpLoad %10 %4
OpLine %11 1354 8 OpLine %11 1386 8
OpStore %6 %9 OpStore %6 %9
OpNoLine OpNoLine
OpReturn OpReturn

View File

@ -3,9 +3,9 @@
OpLine %5 13 11 OpLine %5 13 11
%6 = OpCompositeInsert %7 %8 %9 0 %6 = OpCompositeInsert %7 %8 %9 0
%10 = OpCompositeExtract %11 %6 1 %10 = OpCompositeExtract %11 %6 1
OpLine %12 967 14 OpLine %12 975 14
%13 = OpBitcast %14 %8 %13 = OpBitcast %14 %8
OpLine %12 967 8 OpLine %12 975 8
%15 = OpIEqual %16 %13 %17 %15 = OpIEqual %16 %13 %17
OpNoLine OpNoLine
OpSelectionMerge %18 None OpSelectionMerge %18 None

View File

@ -4,9 +4,7 @@
use spirv_std::spirv; use spirv_std::spirv;
#[spirv(matrix)] #[spirv(matrix)]
pub struct _EmptyStruct {} pub struct EmptyStruct {}
#[spirv(fragment)] #[spirv(fragment)]
pub fn _entry() { pub fn entry(#[spirv(push_constant)] matrix: &EmptyStruct) {}
let _empty_struct = _EmptyStruct {};
}

View File

@ -1,8 +1,8 @@
error: #[spirv(matrix)] type must have at least two fields error: #[spirv(matrix)] type must have at least two fields
--> $DIR/invalid-matrix-type-empty.rs:7:1 --> $DIR/invalid-matrix-type-empty.rs:7:1
| |
7 | pub struct _EmptyStruct {} 7 | pub struct EmptyStruct {}
| ^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error error: aborting due to previous error