@@ -268,6 +268,12 @@ impl ExprVisitor<'tcx> {
268268 reg_class. name( ) ,
269269 supported_tys. join( ", " ) ,
270270 ) ) ;
271+ if let Some ( suggest) = reg_class. suggest_class ( asm_arch, asm_ty) {
272+ err. help ( & format ! (
273+ "consider using the `{}` register class instead" ,
274+ suggest. name( )
275+ ) ) ;
276+ }
271277 err. emit ( ) ;
272278 return Some ( asm_ty) ;
273279 }
@@ -298,7 +304,7 @@ impl ExprVisitor<'tcx> {
298304 }
299305
300306 // Check whether a modifier is suggested for using this type.
301- if let Some ( ( suggested_modifier, suggested_result, switch_reg_class ) ) =
307+ if let Some ( ( suggested_modifier, suggested_result) ) =
302308 reg_class. suggest_modifier ( asm_arch, asm_ty)
303309 {
304310 // Search for any use of this operand without a modifier and emit
@@ -323,18 +329,10 @@ impl ExprVisitor<'tcx> {
323329 let msg = "formatting may not be suitable for sub-register argument" ;
324330 let mut err = lint. build ( msg) ;
325331 err. span_label ( expr. span , "for this argument" ) ;
326- if let Some ( switch_reg_class) = switch_reg_class {
327- err. help ( & format ! (
328- "use the `{}` modifier with the `{}` register class \
329- to have the register formatted as `{}`",
330- suggested_modifier, switch_reg_class, suggested_result,
331- ) ) ;
332- } else {
333- err. help ( & format ! (
334- "use the `{}` modifier to have the register formatted as `{}`" ,
335- suggested_modifier, suggested_result,
336- ) ) ;
337- }
332+ err. help ( & format ! (
333+ "use the `{}` modifier to have the register formatted as `{}`" ,
334+ suggested_modifier, suggested_result,
335+ ) ) ;
338336 err. help ( & format ! (
339337 "or use the `{}` modifier to keep the default formatting of `{}`" ,
340338 default_modifier, default_result,
0 commit comments