@@ -14,7 +14,7 @@ use rustc_abi::{Align, BackendRepr, Scalar, Size, WrappingRange};
1414use rustc_apfloat:: { Float , Round , Status , ieee} ;
1515use rustc_codegen_ssa:: MemFlags ;
1616use rustc_codegen_ssa:: common:: {
17- AtomicOrdering , AtomicRmwBinOp , IntPredicate , RealPredicate , SynchronizationScope , TypeKind ,
17+ AtomicRmwBinOp , IntPredicate , RealPredicate , SynchronizationScope , TypeKind ,
1818} ;
1919use rustc_codegen_ssa:: mir:: operand:: { OperandRef , OperandValue } ;
2020use rustc_codegen_ssa:: mir:: place:: PlaceRef ;
@@ -26,7 +26,7 @@ use rustc_data_structures::fx::FxHashSet;
2626use rustc_middle:: bug;
2727use rustc_middle:: middle:: codegen_fn_attrs:: CodegenFnAttrs ;
2828use rustc_middle:: ty:: layout:: LayoutOf ;
29- use rustc_middle:: ty:: { self , Ty } ;
29+ use rustc_middle:: ty:: { self , AtomicOrdering , Ty } ;
3030use rustc_span:: Span ;
3131use rustc_target:: callconv:: FnAbi ;
3232use smallvec:: SmallVec ;
@@ -157,17 +157,15 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
157157 fn ordering_to_semantics_def ( & self , ordering : AtomicOrdering ) -> SpirvValue {
158158 let mut invalid_seq_cst = false ;
159159 let semantics = match ordering {
160- AtomicOrdering :: Unordered | AtomicOrdering :: Relaxed => MemorySemantics :: NONE ,
161- // Note: rustc currently has AtomicOrdering::Consume commented out, if it ever becomes
162- // uncommented, it should be MakeVisible | Acquire.
160+ AtomicOrdering :: Relaxed => MemorySemantics :: NONE ,
163161 AtomicOrdering :: Acquire => MemorySemantics :: MAKE_VISIBLE | MemorySemantics :: ACQUIRE ,
164162 AtomicOrdering :: Release => MemorySemantics :: MAKE_AVAILABLE | MemorySemantics :: RELEASE ,
165- AtomicOrdering :: AcquireRelease => {
163+ AtomicOrdering :: AcqRel => {
166164 MemorySemantics :: MAKE_AVAILABLE
167165 | MemorySemantics :: MAKE_VISIBLE
168166 | MemorySemantics :: ACQUIRE_RELEASE
169167 }
170- AtomicOrdering :: SequentiallyConsistent => {
168+ AtomicOrdering :: SeqCst => {
171169 let emit = self . emit ( ) ;
172170 let memory_model = emit. module_ref ( ) . memory_model . as_ref ( ) . unwrap ( ) ;
173171 if memory_model. operands [ 1 ] . unwrap_memory_model ( ) == MemoryModel :: Vulkan {
@@ -182,8 +180,8 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
182180 if invalid_seq_cst {
183181 self . zombie (
184182 semantics. def ( self ) ,
185- "cannot use AtomicOrdering=SequentiallyConsistent on Vulkan memory model \
186- (check if AcquireRelease fits your needs)",
183+ "cannot use ` AtomicOrdering::SeqCst` on Vulkan memory model \
184+ (check if `AcqRel` fits your needs)",
187185 ) ;
188186 }
189187 semantics
@@ -3128,6 +3126,14 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
31283126 String :: from_utf8 ( piece_str_bytes) . ok ( )
31293127 } ;
31303128
3129+ // HACK(eddyb) `panic_explicit` doesn't take any regular arguments,
3130+ // only an (implicit) `&'static panic::Location<'static>`.
3131+ if args. len ( ) == 1 {
3132+ decoded_format_args. const_pieces =
3133+ Some ( [ "explicit panic" . into ( ) ] . into_iter ( ) . collect ( ) ) ;
3134+ return Ok ( decoded_format_args) ;
3135+ }
3136+
31313137 // HACK(eddyb) some entry-points only take a `&str`, not `fmt::Arguments`.
31323138 if let [
31333139 SpirvValue {
@@ -3360,17 +3366,14 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
33603366 }
33613367 } ;
33623368
3363- let prepare_args_insts = try_rev_take ( 3 ) . ok_or_else ( || {
3369+ let prepare_args_insts = try_rev_take ( 2 ) . ok_or_else ( || {
33643370 FormatArgsNotRecognized (
33653371 "fmt::Arguments::new_v1_formatted call: ran out of instructions" . into ( ) ,
33663372 )
33673373 } ) ?;
33683374 let ( rt_args_slice_ptr_id, _fmt_placeholders_slice_ptr_id) =
33693375 match prepare_args_insts[ ..] {
33703376 [
3371- // HACK(eddyb) `rt::UnsafeArg::new()` call
3372- // (`unsafe` ZST "constructor").
3373- Inst :: Call ( _, _, ref rt_unsafe_arg_call_args) ,
33743377 Inst :: Bitcast (
33753378 rt_args_cast_out_id,
33763379 rt_args_cast_in_id,
@@ -3379,8 +3382,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
33793382 placeholders_cast_out_id,
33803383 placeholders_cast_in_id,
33813384 ) ,
3382- ] if rt_unsafe_arg_call_args. is_empty ( )
3383- && rt_args_cast_out_id == rt_args_slice_ptr_id
3385+ ] if rt_args_cast_out_id == rt_args_slice_ptr_id
33843386 && placeholders_cast_out_id
33853387 == fmt_placeholders_slice_ptr_id =>
33863388 {
0 commit comments