@@ -11,7 +11,7 @@ use rustc_middle::ty::{self, Ty, TyCtxt};
1111use rustc_session:: lint;
1212use rustc_span:: { sym, Span , Symbol , DUMMY_SP } ;
1313use rustc_target:: abi:: { Pointer , VariantIdx } ;
14- use rustc_target:: asm:: { InlineAsmRegOrRegClass , InlineAsmType } ;
14+ use rustc_target:: asm:: { InlineAsmRegOrRegClass , InlineAsmSupportedTypes , InlineAsmType } ;
1515use rustc_target:: spec:: abi:: Abi :: RustIntrinsic ;
1616
1717fn check_mod_intrinsics ( tcx : TyCtxt < ' _ > , module_def_id : LocalDefId ) {
@@ -255,10 +255,18 @@ impl ExprVisitor<'tcx> {
255255 // register class.
256256 let asm_arch = self . tcx . sess . asm_arch . unwrap ( ) ;
257257 let reg_class = reg. reg_class ( ) ;
258- let supported_tys = reg_class. supported_types ( asm_arch) ;
259- let feature = match supported_tys. iter ( ) . find ( |& & ( t, _) | t == asm_ty) {
260- Some ( ( _, feature) ) => feature,
261- None => {
258+ let found_supported_ty = match reg_class. supported_types ( asm_arch) {
259+ // FIXME(eddyb) consider skipping the "cannot use value of type" error
260+ // above, letting the codegen backend handle non-scalar/vector types.
261+ InlineAsmSupportedTypes :: Any => Ok ( ( asm_ty, None ) ) ,
262+
263+ InlineAsmSupportedTypes :: OneOf ( supported_tys) => {
264+ supported_tys. iter ( ) . find ( |& & ( t, _) | t == asm_ty) . copied ( ) . ok_or ( supported_tys)
265+ }
266+ } ;
267+ let feature = match found_supported_ty {
268+ Ok ( ( _, feature) ) => feature,
269+ Err ( supported_tys) => {
262270 let msg = & format ! ( "type `{}` cannot be used with this register class" , ty) ;
263271 let mut err = self . tcx . sess . struct_span_err ( expr. span , msg) ;
264272 let supported_tys: Vec < _ > =
0 commit comments