@@ -11,7 +11,7 @@ use rustc_middle::ty::{self, Ty, TyCtxt};
11
11
use rustc_session:: lint;
12
12
use rustc_span:: { sym, Span , Symbol , DUMMY_SP } ;
13
13
use rustc_target:: abi:: { Pointer , VariantIdx } ;
14
- use rustc_target:: asm:: { InlineAsmRegOrRegClass , InlineAsmType } ;
14
+ use rustc_target:: asm:: { InlineAsmRegOrRegClass , InlineAsmSupportedTypes , InlineAsmType } ;
15
15
use rustc_target:: spec:: abi:: Abi :: RustIntrinsic ;
16
16
17
17
fn check_mod_intrinsics ( tcx : TyCtxt < ' _ > , module_def_id : LocalDefId ) {
@@ -255,10 +255,18 @@ impl ExprVisitor<'tcx> {
255
255
// register class.
256
256
let asm_arch = self . tcx . sess . asm_arch . unwrap ( ) ;
257
257
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) => {
262
270
let msg = & format ! ( "type `{}` cannot be used with this register class" , ty) ;
263
271
let mut err = self . tcx . sess . struct_span_err ( expr. span , msg) ;
264
272
let supported_tys: Vec < _ > =
0 commit comments