Skip to content

Commit

Permalink
upgrade to 1.78.0 nightly-2024-03-14
Browse files Browse the repository at this point in the history
  • Loading branch information
LemonHX committed Mar 15, 2024
1 parent 5f54507 commit dbe0f25
Show file tree
Hide file tree
Showing 31 changed files with 386 additions and 343 deletions.
File renamed without changes.
26 changes: 3 additions & 23 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/rustc_codegen_spirv/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ syn = { version = "1", features = ["extra-traits", "full"] }
[dependencies]
# HACK(eddyb) these only exist to unify features across dependency trees,
# in order to avoid multiple separate instances of `rustc_codegen_spirv`.
hashbrown = "0.11"
libc = { version = "0.2", features = ["align", "extra_traits"] }
num-traits = { version = "0.2", features = ["libm"] }
once_cell = "1"
regex = { version = "1", features = ["perf"] }

# Normal dependencies.
termcolor = "1.2"
ar = "0.9.0"
either = "1.8.0"
indexmap = "1.6.0"
Expand Down
4 changes: 2 additions & 2 deletions crates/rustc_codegen_spirv/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.toml");
const REQUIRED_RUST_TOOLCHAIN: &str = r#"[toolchain]
channel = "nightly-2023-12-21"
channel = "nightly-2024-03-14"
components = ["rust-src", "rustc-dev", "llvm-tools"]
# commit_hash = 5ac4c8a63ee305742071ac6dd11817f7c24adce2"#;
# commit_hash = 3cbb93223f33024db464a4df27a13c7cce870173"#;

fn get_rustc_commit_hash() -> Result<String, Box<dyn Error>> {
let rustc = std::env::var("RUSTC").unwrap_or_else(|_| String::from("rustc"));
Expand Down
33 changes: 17 additions & 16 deletions crates/rustc_codegen_spirv/src/abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -505,8 +505,10 @@ fn trans_scalar<'tcx>(
Primitive::Int(width, signedness) => {
SpirvType::Integer(width.size().bits() as u32, signedness).def(span, cx)
}
Primitive::F16 => SpirvType::Float(16).def(span, cx),
Primitive::F32 => SpirvType::Float(32).def(span, cx),
Primitive::F64 => SpirvType::Float(64).def(span, cx),
Primitive::F128 => SpirvType::Float(128).def(span, cx),
Primitive::Pointer(_) => {
let pointee_ty = dig_scalar_pointee(cx, ty, offset);
// Pointers can be recursive. So, record what we're currently translating, and if we're already translating
Expand Down Expand Up @@ -580,7 +582,7 @@ fn dig_scalar_pointee<'tcx>(
let new_pointee = dig_scalar_pointee(cx, field, offset - field_offset);
match pointee {
Some(old_pointee) if old_pointee != new_pointee => {
cx.tcx.sess.fatal(format!(
cx.tcx.sess.psess.dcx.fatal(format!(
"dig_scalar_pointee: unsupported Pointer with different \
pointee types ({old_pointee:?} vs {new_pointee:?}) at offset {offset:?} in {layout:#?}"
));
Expand Down Expand Up @@ -728,7 +730,7 @@ fn trans_struct<'tcx>(cx: &CodegenCx<'tcx>, span: Span, ty: TyAndLayout<'tcx>) -
if i == 0 {
field_names.push(cx.sym.discriminant);
} else {
cx.tcx.sess.fatal("Variants::Multiple has multiple fields")
cx.tcx.sess.psess.dcx.fatal("Variants::Multiple has multiple fields")
}
};
}
Expand Down Expand Up @@ -784,7 +786,7 @@ impl fmt::Display for TyLayoutNameKey<'_> {
write!(f, "::{}", def.variants()[index].name)?;
}
}
if let (TyKind::Coroutine(_, _, _), Some(index)) = (self.ty.kind(), self.variant) {
if let (TyKind::Coroutine(_, _,), Some(index)) = (self.ty.kind(), self.variant) {
write!(f, "::{}", CoroutineArgs::variant_name(index))?;
}
Ok(())
Expand All @@ -805,6 +807,7 @@ fn trans_intrinsic_type<'tcx>(
return Err(cx
.tcx
.sess
.psess.dcx
.err("#[spirv(generic_image)] type must have size 4"));
}

Expand Down Expand Up @@ -848,7 +851,7 @@ fn trans_intrinsic_type<'tcx>(
_ => {
return Err(cx
.tcx
.sess
.sess.psess.dcx
.span_err(span, "Invalid sampled type to `Image`."));
}
};
Expand All @@ -871,7 +874,7 @@ fn trans_intrinsic_type<'tcx>(
Some(v) => Ok(v),
None => Err(cx
.tcx
.sess
.sess.psess.dcx
.err(format!("Invalid value for Image const generic: {value}"))),
}
}
Expand All @@ -897,7 +900,7 @@ fn trans_intrinsic_type<'tcx>(
IntrinsicType::Sampler => {
// see SpirvType::sizeof
if ty.size != Size::from_bytes(4) {
return Err(cx.tcx.sess.err("#[spirv(sampler)] type must have size 4"));
return Err(cx.tcx.sess.psess.dcx.err("#[spirv(sampler)] type must have size 4"));
}
Ok(SpirvType::Sampler.def(span, cx))
}
Expand All @@ -910,7 +913,7 @@ fn trans_intrinsic_type<'tcx>(
if ty.size != Size::from_bytes(4) {
return Err(cx
.tcx
.sess
.sess.psess.dcx
.err("#[spirv(sampled_image)] type must have size 4"));
}

Expand All @@ -923,15 +926,15 @@ fn trans_intrinsic_type<'tcx>(
} else {
Err(cx
.tcx
.sess
.sess.psess.dcx
.err("#[spirv(sampled_image)] type must have a generic image type"))
}
}
IntrinsicType::RuntimeArray => {
if ty.size != Size::from_bytes(4) {
return Err(cx
.tcx
.sess
.sess.psess.dcx
.err("#[spirv(runtime_array)] type must have size 4"));
}

Expand All @@ -943,7 +946,7 @@ fn trans_intrinsic_type<'tcx>(
} else {
Err(cx
.tcx
.sess
.sess.psess.dcx
.err("#[spirv(runtime_array)] type must have a generic element type"))
}
}
Expand All @@ -958,12 +961,12 @@ fn trans_intrinsic_type<'tcx>(
if field_types.len() < 2 {
return Err(cx
.tcx
.sess
.sess.psess.dcx
.span_err(span, "#[spirv(matrix)] type must have at least two fields"));
}
let elem_type = field_types[0];
if !field_types.iter().all(|&ty| ty == elem_type) {
return Err(cx.tcx.sess.span_err(
return Err(cx.tcx.sess.psess.dcx.span_err(
span,
"#[spirv(matrix)] type fields must all be the same type",
));
Expand All @@ -973,10 +976,8 @@ fn trans_intrinsic_type<'tcx>(
ty => {
return Err(cx
.tcx
.sess
.struct_span_err(span, "#[spirv(matrix)] type fields must all be vectors")
.note(format!("field type is {}", ty.debug(elem_type, cx)))
.emit());
.sess.psess.dcx
.span_err(span, format!("#[spirv(matrix)] type fields must all be vectors, found {}", ty.debug(elem_type, cx))));
}
}

Expand Down
22 changes: 11 additions & 11 deletions crates/rustc_codegen_spirv/src/attr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ impl AggregatedSpirvAttributes {
let (span, parsed_attr) = match parse_attr_result {
Ok(span_and_parsed_attr) => span_and_parsed_attr,
Err((span, msg)) => {
cx.tcx.sess.span_delayed_bug(span, msg);
cx.tcx.sess.psess.dcx.span_delayed_bug(span, msg);
continue;
}
};
Expand All @@ -165,7 +165,7 @@ impl AggregatedSpirvAttributes {
category,
}) => {
cx.tcx
.sess
.sess.psess.dcx
.span_delayed_bug(span, format!("multiple {category} attributes"));
}
}
Expand Down Expand Up @@ -278,7 +278,7 @@ impl CheckSpirvAttrVisitor<'_> {
let (span, parsed_attr) = match parse_attr_result {
Ok(span_and_parsed_attr) => span_and_parsed_attr,
Err((span, msg)) => {
self.tcx.sess.span_err(span, msg);
self.tcx.sess.psess.dcx.span_err(span, msg);
continue;
}
};
Expand Down Expand Up @@ -317,13 +317,13 @@ impl CheckSpirvAttrVisitor<'_> {
| SpirvAttribute::InputAttachmentIndex(_)
| SpirvAttribute::SpecConstant(_) => match target {
Target::Param => {
let parent_hir_id = self.tcx.hir().parent_id(hir_id);
let mut parent_hir_id = self.tcx.hir().parent_id_iter(hir_id);
let parent_is_entry_point =
parse_attrs(self.tcx.hir().attrs(parent_hir_id))
parse_attrs(self.tcx.hir().attrs(parent_hir_id.next().unwrap()))
.filter_map(|r| r.ok())
.any(|(_, attr)| matches!(attr, SpirvAttribute::Entry(_)));
if !parent_is_entry_point {
self.tcx.sess.span_err(
self.tcx.sess.psess.dcx.span_err(
span,
"attribute is only valid on a parameter of an entry-point function",
);
Expand All @@ -346,7 +346,7 @@ impl CheckSpirvAttrVisitor<'_> {
};

if let Err(msg) = valid {
self.tcx.sess.span_err(
self.tcx.sess.psess.dcx.span_err(
span,
format!("`{storage_class:?}` storage class {msg}"),
);
Expand All @@ -367,7 +367,7 @@ impl CheckSpirvAttrVisitor<'_> {
};
match valid_target {
Err(Expected(expected_target)) => {
self.tcx.sess.span_err(
self.tcx.sess.psess.dcx.span_err(
span,
format!(
"attribute is only valid on a {expected_target}, not on a {target}"
Expand All @@ -381,13 +381,13 @@ impl CheckSpirvAttrVisitor<'_> {
category,
}) => {
self.tcx
.sess
.sess.psess.dcx
.struct_span_err(
span,
format!("only one {category} attribute is allowed on a {target}"),
)
.span_note(prev_span, format!("previous {category} attribute"))
.emit();
;
}
},
}
Expand All @@ -397,7 +397,7 @@ impl CheckSpirvAttrVisitor<'_> {
// so we can perform further checks, emit warnings, etc.

if let Some(block_attr) = aggregated_attrs.block {
self.tcx.sess.span_warn(
self.tcx.sess.psess.dcx.span_warn(
block_attr.span,
"#[spirv(block)] is no longer needed and should be removed",
);
Expand Down
Loading

0 comments on commit dbe0f25

Please sign in to comment.