Skip to content

Commit a8d2f34

Browse files
committed
rustup: update to nightly-2023-12-31.
1 parent b432328 commit a8d2f34

25 files changed

+204
-188
lines changed

crates/rustc_codegen_spirv/build.rs

Lines changed: 2 additions & 2 deletions
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-16"
13+
channel = "nightly-2023-12-31"
1414
components = ["rust-src", "rustc-dev", "llvm-tools"]
15-
# commit_hash = a96d57bdb6d2bb6d233d7d5aaefc2995ab99be01"#;
15+
# commit_hash = 2a3e63551fe21458637480a97b65a2d15dec8062"#;
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

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,7 @@ fn dig_scalar_pointee<'tcx>(
580580
let new_pointee = dig_scalar_pointee(cx, field, offset - field_offset);
581581
match pointee {
582582
Some(old_pointee) if old_pointee != new_pointee => {
583-
cx.tcx.sess.fatal(format!(
583+
cx.tcx.dcx().fatal(format!(
584584
"dig_scalar_pointee: unsupported Pointer with different \
585585
pointee types ({old_pointee:?} vs {new_pointee:?}) at offset {offset:?} in {layout:#?}"
586586
));
@@ -728,7 +728,7 @@ fn trans_struct<'tcx>(cx: &CodegenCx<'tcx>, span: Span, ty: TyAndLayout<'tcx>) -
728728
if i == 0 {
729729
field_names.push(cx.sym.discriminant);
730730
} else {
731-
cx.tcx.sess.fatal("Variants::Multiple has multiple fields")
731+
cx.tcx.dcx().fatal("Variants::Multiple has multiple fields")
732732
}
733733
};
734734
}
@@ -784,7 +784,7 @@ impl fmt::Display for TyLayoutNameKey<'_> {
784784
write!(f, "::{}", def.variants()[index].name)?;
785785
}
786786
}
787-
if let (TyKind::Coroutine(_, _, _), Some(index)) = (self.ty.kind(), self.variant) {
787+
if let (TyKind::Coroutine(_, _), Some(index)) = (self.ty.kind(), self.variant) {
788788
write!(f, "::{}", CoroutineArgs::variant_name(index))?;
789789
}
790790
Ok(())
@@ -804,7 +804,7 @@ fn trans_intrinsic_type<'tcx>(
804804
if ty.size != Size::from_bytes(4) {
805805
return Err(cx
806806
.tcx
807-
.sess
807+
.dcx()
808808
.err("#[spirv(generic_image)] type must have size 4"));
809809
}
810810

@@ -848,7 +848,7 @@ fn trans_intrinsic_type<'tcx>(
848848
_ => {
849849
return Err(cx
850850
.tcx
851-
.sess
851+
.dcx()
852852
.span_err(span, "Invalid sampled type to `Image`."));
853853
}
854854
};
@@ -871,7 +871,7 @@ fn trans_intrinsic_type<'tcx>(
871871
Some(v) => Ok(v),
872872
None => Err(cx
873873
.tcx
874-
.sess
874+
.dcx()
875875
.err(format!("Invalid value for Image const generic: {value}"))),
876876
}
877877
}
@@ -897,7 +897,7 @@ fn trans_intrinsic_type<'tcx>(
897897
IntrinsicType::Sampler => {
898898
// see SpirvType::sizeof
899899
if ty.size != Size::from_bytes(4) {
900-
return Err(cx.tcx.sess.err("#[spirv(sampler)] type must have size 4"));
900+
return Err(cx.tcx.dcx().err("#[spirv(sampler)] type must have size 4"));
901901
}
902902
Ok(SpirvType::Sampler.def(span, cx))
903903
}
@@ -910,7 +910,7 @@ fn trans_intrinsic_type<'tcx>(
910910
if ty.size != Size::from_bytes(4) {
911911
return Err(cx
912912
.tcx
913-
.sess
913+
.dcx()
914914
.err("#[spirv(sampled_image)] type must have size 4"));
915915
}
916916

@@ -923,15 +923,15 @@ fn trans_intrinsic_type<'tcx>(
923923
} else {
924924
Err(cx
925925
.tcx
926-
.sess
926+
.dcx()
927927
.err("#[spirv(sampled_image)] type must have a generic image type"))
928928
}
929929
}
930930
IntrinsicType::RuntimeArray => {
931931
if ty.size != Size::from_bytes(4) {
932932
return Err(cx
933933
.tcx
934-
.sess
934+
.dcx()
935935
.err("#[spirv(runtime_array)] type must have size 4"));
936936
}
937937

@@ -943,7 +943,7 @@ fn trans_intrinsic_type<'tcx>(
943943
} else {
944944
Err(cx
945945
.tcx
946-
.sess
946+
.dcx()
947947
.err("#[spirv(runtime_array)] type must have a generic element type"))
948948
}
949949
}
@@ -958,12 +958,12 @@ fn trans_intrinsic_type<'tcx>(
958958
if field_types.len() < 2 {
959959
return Err(cx
960960
.tcx
961-
.sess
961+
.dcx()
962962
.span_err(span, "#[spirv(matrix)] type must have at least two fields"));
963963
}
964964
let elem_type = field_types[0];
965965
if !field_types.iter().all(|&ty| ty == elem_type) {
966-
return Err(cx.tcx.sess.span_err(
966+
return Err(cx.tcx.dcx().span_err(
967967
span,
968968
"#[spirv(matrix)] type fields must all be the same type",
969969
));
@@ -973,7 +973,7 @@ fn trans_intrinsic_type<'tcx>(
973973
ty => {
974974
return Err(cx
975975
.tcx
976-
.sess
976+
.dcx()
977977
.struct_span_err(span, "#[spirv(matrix)] type fields must all be vectors")
978978
.note(format!("field type is {}", ty.debug(elem_type, cx)))
979979
.emit());

crates/rustc_codegen_spirv/src/attr.rs

Lines changed: 8 additions & 8 deletions
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.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+
.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.dcx().span_err(span, msg);
282282
continue;
283283
}
284284
};
@@ -323,7 +323,7 @@ impl CheckSpirvAttrVisitor<'_> {
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.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.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.dcx().span_err(
371371
span,
372372
format!(
373373
"attribute is only valid on a {expected_target}, not on a {target}"
@@ -381,7 +381,7 @@ impl CheckSpirvAttrVisitor<'_> {
381381
category,
382382
}) => {
383383
self.tcx
384-
.sess
384+
.dcx()
385385
.struct_span_err(
386386
span,
387387
format!("only one {category} attribute is allowed on a {target}"),
@@ -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.dcx().span_warn(
401401
block_attr.span,
402402
"#[spirv(block)] is no longer needed and should be removed",
403403
);

crates/rustc_codegen_spirv/src/builder/builder_methods.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2282,7 +2282,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
22822282
order: AtomicOrdering,
22832283
failure_order: AtomicOrdering,
22842284
_weak: bool,
2285-
) -> Self::Value {
2285+
) -> (Self::Value, Self::Value) {
22862286
assert_ty_eq!(self, cmp.ty, src.ty);
22872287
let ty = src.ty;
22882288

@@ -2310,7 +2310,12 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
23102310
)
23112311
.unwrap()
23122312
.with_type(access_ty);
2313-
self.bitcast(result, ty)
2313+
let result = self.bitcast(result, ty);
2314+
2315+
let val = self.extract_value(result, 0);
2316+
let success = self.extract_value(result, 1);
2317+
2318+
(val, success)
23142319
}
23152320

23162321
fn atomic_rmw(
@@ -2987,7 +2992,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
29872992

29882993
Err(FormatArgsNotRecognized(step)) => {
29892994
if let Some(current_span) = self.current_span {
2990-
let mut warn = self.tcx.sess.struct_span_warn(
2995+
let mut warn = self.tcx.dcx().struct_span_warn(
29912996
current_span,
29922997
"failed to find and remove `format_args!` construction for this `panic!`",
29932998
);

crates/rustc_codegen_spirv/src/builder/mod.rs

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use rustc_codegen_ssa::traits::{
2020
AbiBuilderMethods, ArgAbiMethods, BackendTypes, BuilderMethods, CoverageInfoBuilderMethods,
2121
DebugInfoBuilderMethods, HasCodegen, StaticBuilderMethods, TypeMembershipMethods,
2222
};
23-
use rustc_errors::{DiagnosticBuilder, DiagnosticMessage, ErrorGuaranteed};
23+
use rustc_errors::{DiagnosticBuilder, DiagnosticMessage};
2424
use rustc_middle::mir::Coverage;
2525
use rustc_middle::span_bug;
2626
use rustc_middle::ty::layout::{
@@ -69,32 +69,29 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
6969
}
7070

7171
#[track_caller]
72-
pub fn struct_err(
73-
&self,
74-
msg: impl Into<DiagnosticMessage>,
75-
) -> DiagnosticBuilder<'_, ErrorGuaranteed> {
72+
pub fn struct_err(&self, msg: impl Into<DiagnosticMessage>) -> DiagnosticBuilder<'_> {
7673
if let Some(current_span) = self.current_span {
77-
self.tcx.sess.struct_span_err(current_span, msg)
74+
self.tcx.dcx().struct_span_err(current_span, msg)
7875
} else {
79-
self.tcx.sess.struct_err(msg)
76+
self.tcx.dcx().struct_err(msg)
8077
}
8178
}
8279

8380
#[track_caller]
8481
pub fn err(&self, msg: impl Into<DiagnosticMessage>) {
8582
if let Some(current_span) = self.current_span {
86-
self.tcx.sess.span_err(current_span, msg);
83+
self.tcx.dcx().span_err(current_span, msg);
8784
} else {
88-
self.tcx.sess.err(msg);
85+
self.tcx.dcx().err(msg);
8986
}
9087
}
9188

9289
#[track_caller]
9390
pub fn fatal(&self, msg: impl Into<DiagnosticMessage>) -> ! {
9491
if let Some(current_span) = self.current_span {
95-
self.tcx.sess.span_fatal(current_span, msg)
92+
self.tcx.dcx().span_fatal(current_span, msg)
9693
} else {
97-
self.tcx.sess.fatal(msg)
94+
self.tcx.dcx().fatal(msg)
9895
}
9996
}
10097

0 commit comments

Comments
 (0)