Skip to content

Commit dbe0f25

Browse files
committed
upgrade to 1.78.0 nightly-2024-03-14
1 parent 5f54507 commit dbe0f25

31 files changed

+386
-343
lines changed

.cargo/config .cargo/config.toml

File renamed without changes.

Cargo.lock

+3-23
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/rustc_codegen_spirv/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ syn = { version = "1", features = ["extra-traits", "full"] }
4040
[dependencies]
4141
# HACK(eddyb) these only exist to unify features across dependency trees,
4242
# in order to avoid multiple separate instances of `rustc_codegen_spirv`.
43-
hashbrown = "0.11"
4443
libc = { version = "0.2", features = ["align", "extra_traits"] }
4544
num-traits = { version = "0.2", features = ["libm"] }
4645
once_cell = "1"
4746
regex = { version = "1", features = ["perf"] }
4847

4948
# Normal dependencies.
49+
termcolor = "1.2"
5050
ar = "0.9.0"
5151
either = "1.8.0"
5252
indexmap = "1.6.0"

crates/rustc_codegen_spirv/build.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ use std::process::{Command, ExitCode};
1010
/// `cargo publish`. We need to figure out a way to do this properly, but let's hardcode it for now :/
1111
//const REQUIRED_RUST_TOOLCHAIN: &str = include_str!("../../rust-toolchain.toml");
1212
const REQUIRED_RUST_TOOLCHAIN: &str = r#"[toolchain]
13-
channel = "nightly-2023-12-21"
13+
channel = "nightly-2024-03-14"
1414
components = ["rust-src", "rustc-dev", "llvm-tools"]
15-
# commit_hash = 5ac4c8a63ee305742071ac6dd11817f7c24adce2"#;
15+
# commit_hash = 3cbb93223f33024db464a4df27a13c7cce870173"#;
1616

1717
fn get_rustc_commit_hash() -> Result<String, Box<dyn Error>> {
1818
let rustc = std::env::var("RUSTC").unwrap_or_else(|_| String::from("rustc"));

crates/rustc_codegen_spirv/src/abi.rs

+17-16
Original file line numberDiff line numberDiff line change
@@ -505,8 +505,10 @@ fn trans_scalar<'tcx>(
505505
Primitive::Int(width, signedness) => {
506506
SpirvType::Integer(width.size().bits() as u32, signedness).def(span, cx)
507507
}
508+
Primitive::F16 => SpirvType::Float(16).def(span, cx),
508509
Primitive::F32 => SpirvType::Float(32).def(span, cx),
509510
Primitive::F64 => SpirvType::Float(64).def(span, cx),
511+
Primitive::F128 => SpirvType::Float(128).def(span, cx),
510512
Primitive::Pointer(_) => {
511513
let pointee_ty = dig_scalar_pointee(cx, ty, offset);
512514
// Pointers can be recursive. So, record what we're currently translating, and if we're already translating
@@ -580,7 +582,7 @@ fn dig_scalar_pointee<'tcx>(
580582
let new_pointee = dig_scalar_pointee(cx, field, offset - field_offset);
581583
match pointee {
582584
Some(old_pointee) if old_pointee != new_pointee => {
583-
cx.tcx.sess.fatal(format!(
585+
cx.tcx.sess.psess.dcx.fatal(format!(
584586
"dig_scalar_pointee: unsupported Pointer with different \
585587
pointee types ({old_pointee:?} vs {new_pointee:?}) at offset {offset:?} in {layout:#?}"
586588
));
@@ -728,7 +730,7 @@ fn trans_struct<'tcx>(cx: &CodegenCx<'tcx>, span: Span, ty: TyAndLayout<'tcx>) -
728730
if i == 0 {
729731
field_names.push(cx.sym.discriminant);
730732
} else {
731-
cx.tcx.sess.fatal("Variants::Multiple has multiple fields")
733+
cx.tcx.sess.psess.dcx.fatal("Variants::Multiple has multiple fields")
732734
}
733735
};
734736
}
@@ -784,7 +786,7 @@ impl fmt::Display for TyLayoutNameKey<'_> {
784786
write!(f, "::{}", def.variants()[index].name)?;
785787
}
786788
}
787-
if let (TyKind::Coroutine(_, _, _), Some(index)) = (self.ty.kind(), self.variant) {
789+
if let (TyKind::Coroutine(_, _,), Some(index)) = (self.ty.kind(), self.variant) {
788790
write!(f, "::{}", CoroutineArgs::variant_name(index))?;
789791
}
790792
Ok(())
@@ -805,6 +807,7 @@ fn trans_intrinsic_type<'tcx>(
805807
return Err(cx
806808
.tcx
807809
.sess
810+
.psess.dcx
808811
.err("#[spirv(generic_image)] type must have size 4"));
809812
}
810813

@@ -848,7 +851,7 @@ fn trans_intrinsic_type<'tcx>(
848851
_ => {
849852
return Err(cx
850853
.tcx
851-
.sess
854+
.sess.psess.dcx
852855
.span_err(span, "Invalid sampled type to `Image`."));
853856
}
854857
};
@@ -871,7 +874,7 @@ fn trans_intrinsic_type<'tcx>(
871874
Some(v) => Ok(v),
872875
None => Err(cx
873876
.tcx
874-
.sess
877+
.sess.psess.dcx
875878
.err(format!("Invalid value for Image const generic: {value}"))),
876879
}
877880
}
@@ -897,7 +900,7 @@ fn trans_intrinsic_type<'tcx>(
897900
IntrinsicType::Sampler => {
898901
// see SpirvType::sizeof
899902
if ty.size != Size::from_bytes(4) {
900-
return Err(cx.tcx.sess.err("#[spirv(sampler)] type must have size 4"));
903+
return Err(cx.tcx.sess.psess.dcx.err("#[spirv(sampler)] type must have size 4"));
901904
}
902905
Ok(SpirvType::Sampler.def(span, cx))
903906
}
@@ -910,7 +913,7 @@ fn trans_intrinsic_type<'tcx>(
910913
if ty.size != Size::from_bytes(4) {
911914
return Err(cx
912915
.tcx
913-
.sess
916+
.sess.psess.dcx
914917
.err("#[spirv(sampled_image)] type must have size 4"));
915918
}
916919

@@ -923,15 +926,15 @@ fn trans_intrinsic_type<'tcx>(
923926
} else {
924927
Err(cx
925928
.tcx
926-
.sess
929+
.sess.psess.dcx
927930
.err("#[spirv(sampled_image)] type must have a generic image type"))
928931
}
929932
}
930933
IntrinsicType::RuntimeArray => {
931934
if ty.size != Size::from_bytes(4) {
932935
return Err(cx
933936
.tcx
934-
.sess
937+
.sess.psess.dcx
935938
.err("#[spirv(runtime_array)] type must have size 4"));
936939
}
937940

@@ -943,7 +946,7 @@ fn trans_intrinsic_type<'tcx>(
943946
} else {
944947
Err(cx
945948
.tcx
946-
.sess
949+
.sess.psess.dcx
947950
.err("#[spirv(runtime_array)] type must have a generic element type"))
948951
}
949952
}
@@ -958,12 +961,12 @@ fn trans_intrinsic_type<'tcx>(
958961
if field_types.len() < 2 {
959962
return Err(cx
960963
.tcx
961-
.sess
964+
.sess.psess.dcx
962965
.span_err(span, "#[spirv(matrix)] type must have at least two fields"));
963966
}
964967
let elem_type = field_types[0];
965968
if !field_types.iter().all(|&ty| ty == elem_type) {
966-
return Err(cx.tcx.sess.span_err(
969+
return Err(cx.tcx.sess.psess.dcx.span_err(
967970
span,
968971
"#[spirv(matrix)] type fields must all be the same type",
969972
));
@@ -973,10 +976,8 @@ fn trans_intrinsic_type<'tcx>(
973976
ty => {
974977
return Err(cx
975978
.tcx
976-
.sess
977-
.struct_span_err(span, "#[spirv(matrix)] type fields must all be vectors")
978-
.note(format!("field type is {}", ty.debug(elem_type, cx)))
979-
.emit());
979+
.sess.psess.dcx
980+
.span_err(span, format!("#[spirv(matrix)] type fields must all be vectors, found {}", ty.debug(elem_type, cx))));
980981
}
981982
}
982983

crates/rustc_codegen_spirv/src/attr.rs

+11-11
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ impl AggregatedSpirvAttributes {
154154
let (span, parsed_attr) = match parse_attr_result {
155155
Ok(span_and_parsed_attr) => span_and_parsed_attr,
156156
Err((span, msg)) => {
157-
cx.tcx.sess.span_delayed_bug(span, msg);
157+
cx.tcx.sess.psess.dcx.span_delayed_bug(span, msg);
158158
continue;
159159
}
160160
};
@@ -165,7 +165,7 @@ impl AggregatedSpirvAttributes {
165165
category,
166166
}) => {
167167
cx.tcx
168-
.sess
168+
.sess.psess.dcx
169169
.span_delayed_bug(span, format!("multiple {category} attributes"));
170170
}
171171
}
@@ -278,7 +278,7 @@ impl CheckSpirvAttrVisitor<'_> {
278278
let (span, parsed_attr) = match parse_attr_result {
279279
Ok(span_and_parsed_attr) => span_and_parsed_attr,
280280
Err((span, msg)) => {
281-
self.tcx.sess.span_err(span, msg);
281+
self.tcx.sess.psess.dcx.span_err(span, msg);
282282
continue;
283283
}
284284
};
@@ -317,13 +317,13 @@ impl CheckSpirvAttrVisitor<'_> {
317317
| SpirvAttribute::InputAttachmentIndex(_)
318318
| SpirvAttribute::SpecConstant(_) => match target {
319319
Target::Param => {
320-
let parent_hir_id = self.tcx.hir().parent_id(hir_id);
320+
let mut parent_hir_id = self.tcx.hir().parent_id_iter(hir_id);
321321
let parent_is_entry_point =
322-
parse_attrs(self.tcx.hir().attrs(parent_hir_id))
322+
parse_attrs(self.tcx.hir().attrs(parent_hir_id.next().unwrap()))
323323
.filter_map(|r| r.ok())
324324
.any(|(_, attr)| matches!(attr, SpirvAttribute::Entry(_)));
325325
if !parent_is_entry_point {
326-
self.tcx.sess.span_err(
326+
self.tcx.sess.psess.dcx.span_err(
327327
span,
328328
"attribute is only valid on a parameter of an entry-point function",
329329
);
@@ -346,7 +346,7 @@ impl CheckSpirvAttrVisitor<'_> {
346346
};
347347

348348
if let Err(msg) = valid {
349-
self.tcx.sess.span_err(
349+
self.tcx.sess.psess.dcx.span_err(
350350
span,
351351
format!("`{storage_class:?}` storage class {msg}"),
352352
);
@@ -367,7 +367,7 @@ impl CheckSpirvAttrVisitor<'_> {
367367
};
368368
match valid_target {
369369
Err(Expected(expected_target)) => {
370-
self.tcx.sess.span_err(
370+
self.tcx.sess.psess.dcx.span_err(
371371
span,
372372
format!(
373373
"attribute is only valid on a {expected_target}, not on a {target}"
@@ -381,13 +381,13 @@ impl CheckSpirvAttrVisitor<'_> {
381381
category,
382382
}) => {
383383
self.tcx
384-
.sess
384+
.sess.psess.dcx
385385
.struct_span_err(
386386
span,
387387
format!("only one {category} attribute is allowed on a {target}"),
388388
)
389389
.span_note(prev_span, format!("previous {category} attribute"))
390-
.emit();
390+
;
391391
}
392392
},
393393
}
@@ -397,7 +397,7 @@ impl CheckSpirvAttrVisitor<'_> {
397397
// so we can perform further checks, emit warnings, etc.
398398

399399
if let Some(block_attr) = aggregated_attrs.block {
400-
self.tcx.sess.span_warn(
400+
self.tcx.sess.psess.dcx.span_warn(
401401
block_attr.span,
402402
"#[spirv(block)] is no longer needed and should be removed",
403403
);

0 commit comments

Comments
 (0)