@@ -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
@@ -3127,6 +3125,14 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
31273125 String :: from_utf8 ( piece_str_bytes) . ok ( )
31283126 } ;
31293127
3128+ // HACK(eddyb) `panic_explicit` doesn't take any regular arguments,
3129+ // only an (implicit) `&'static panic::Location<'static>`.
3130+ if args. len ( ) == 1 {
3131+ decoded_format_args. const_pieces =
3132+ Some ( [ "explicit panic" . into ( ) ] . into_iter ( ) . collect ( ) ) ;
3133+ return Ok ( decoded_format_args) ;
3134+ }
3135+
31303136 // HACK(eddyb) some entry-points only take a `&str`, not `fmt::Arguments`.
31313137 if let [
31323138 SpirvValue {
@@ -3359,17 +3365,14 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
33593365 }
33603366 } ;
33613367
3362- let prepare_args_insts = try_rev_take ( 3 ) . ok_or_else ( || {
3368+ let prepare_args_insts = try_rev_take ( 2 ) . ok_or_else ( || {
33633369 FormatArgsNotRecognized (
33643370 "fmt::Arguments::new_v1_formatted call: ran out of instructions" . into ( ) ,
33653371 )
33663372 } ) ?;
33673373 let ( rt_args_slice_ptr_id, _fmt_placeholders_slice_ptr_id) =
33683374 match prepare_args_insts[ ..] {
33693375 [
3370- // HACK(eddyb) `rt::UnsafeArg::new()` call
3371- // (`unsafe` ZST "constructor").
3372- Inst :: Call ( _, _, ref rt_unsafe_arg_call_args) ,
33733376 Inst :: Bitcast (
33743377 rt_args_cast_out_id,
33753378 rt_args_cast_in_id,
@@ -3378,8 +3381,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
33783381 placeholders_cast_out_id,
33793382 placeholders_cast_in_id,
33803383 ) ,
3381- ] if rt_unsafe_arg_call_args. is_empty ( )
3382- && rt_args_cast_out_id == rt_args_slice_ptr_id
3384+ ] if rt_args_cast_out_id == rt_args_slice_ptr_id
33833385 && placeholders_cast_out_id
33843386 == fmt_placeholders_slice_ptr_id =>
33853387 {
0 commit comments