@@ -218,6 +218,8 @@ pub enum InlineAsmReg {
218
218
Mips ( MipsInlineAsmReg ) ,
219
219
SpirV ( SpirVInlineAsmReg ) ,
220
220
Wasm ( WasmInlineAsmReg ) ,
221
+ // Fake register used by rustdoc to support foreign asm!
222
+ RustdocDummy ,
221
223
}
222
224
223
225
impl InlineAsmReg {
@@ -229,6 +231,7 @@ impl InlineAsmReg {
229
231
Self :: RiscV ( r) => r. name ( ) ,
230
232
Self :: Hexagon ( r) => r. name ( ) ,
231
233
Self :: Mips ( r) => r. name ( ) ,
234
+ Self :: RustdocDummy => "<reg>" ,
232
235
}
233
236
}
234
237
@@ -240,6 +243,7 @@ impl InlineAsmReg {
240
243
Self :: RiscV ( r) => InlineAsmRegClass :: RiscV ( r. reg_class ( ) ) ,
241
244
Self :: Hexagon ( r) => InlineAsmRegClass :: Hexagon ( r. reg_class ( ) ) ,
242
245
Self :: Mips ( r) => InlineAsmRegClass :: Mips ( r. reg_class ( ) ) ,
246
+ Self :: RustdocDummy => InlineAsmRegClass :: RustdocDummy ,
243
247
}
244
248
}
245
249
@@ -298,6 +302,7 @@ impl InlineAsmReg {
298
302
Self :: RiscV ( r) => r. emit ( out, arch, modifier) ,
299
303
Self :: Hexagon ( r) => r. emit ( out, arch, modifier) ,
300
304
Self :: Mips ( r) => r. emit ( out, arch, modifier) ,
305
+ Self :: RustdocDummy => unreachable ! ( ) ,
301
306
}
302
307
}
303
308
@@ -309,6 +314,10 @@ impl InlineAsmReg {
309
314
Self :: RiscV ( _) => cb ( self ) ,
310
315
Self :: Hexagon ( r) => r. overlapping_regs ( |r| cb ( Self :: Hexagon ( r) ) ) ,
311
316
Self :: Mips ( _) => cb ( self ) ,
317
+ Self :: RustdocDummy => {
318
+ // This effectively disables the register conflict check since
319
+ // we don't report RustdocDummy as conflicting with itself.
320
+ }
312
321
}
313
322
}
314
323
}
@@ -324,6 +333,8 @@ pub enum InlineAsmRegClass {
324
333
Mips ( MipsInlineAsmRegClass ) ,
325
334
SpirV ( SpirVInlineAsmRegClass ) ,
326
335
Wasm ( WasmInlineAsmRegClass ) ,
336
+ // Fake register class used by rustdoc to support foreign asm!
337
+ RustdocDummy ,
327
338
}
328
339
329
340
impl InlineAsmRegClass {
@@ -338,6 +349,7 @@ impl InlineAsmRegClass {
338
349
Self :: Mips ( r) => r. name ( ) ,
339
350
Self :: SpirV ( r) => r. name ( ) ,
340
351
Self :: Wasm ( r) => r. name ( ) ,
352
+ Self :: RustdocDummy => rustc_span:: symbol:: sym:: reg,
341
353
}
342
354
}
343
355
@@ -355,6 +367,7 @@ impl InlineAsmRegClass {
355
367
Self :: Mips ( r) => r. suggest_class ( arch, ty) . map ( InlineAsmRegClass :: Mips ) ,
356
368
Self :: SpirV ( r) => r. suggest_class ( arch, ty) . map ( InlineAsmRegClass :: SpirV ) ,
357
369
Self :: Wasm ( r) => r. suggest_class ( arch, ty) . map ( InlineAsmRegClass :: Wasm ) ,
370
+ Self :: RustdocDummy => None ,
358
371
}
359
372
}
360
373
@@ -379,6 +392,7 @@ impl InlineAsmRegClass {
379
392
Self :: Mips ( r) => r. suggest_modifier ( arch, ty) ,
380
393
Self :: SpirV ( r) => r. suggest_modifier ( arch, ty) ,
381
394
Self :: Wasm ( r) => r. suggest_modifier ( arch, ty) ,
395
+ Self :: RustdocDummy => None ,
382
396
}
383
397
}
384
398
@@ -399,6 +413,7 @@ impl InlineAsmRegClass {
399
413
Self :: Mips ( r) => r. default_modifier ( arch) ,
400
414
Self :: SpirV ( r) => r. default_modifier ( arch) ,
401
415
Self :: Wasm ( r) => r. default_modifier ( arch) ,
416
+ Self :: RustdocDummy => None ,
402
417
}
403
418
}
404
419
@@ -418,6 +433,9 @@ impl InlineAsmRegClass {
418
433
Self :: Mips ( r) => r. supported_types ( arch) ,
419
434
Self :: SpirV ( r) => r. supported_types ( arch) ,
420
435
Self :: Wasm ( r) => r. supported_types ( arch) ,
436
+ // Rustdoc never gets around to type-checking the asm!, this is just
437
+ // used to indicate the lack of any dependency on target features.
438
+ Self :: RustdocDummy => & [ ] ,
421
439
}
422
440
}
423
441
@@ -454,6 +472,8 @@ impl InlineAsmRegClass {
454
472
Self :: Mips ( r) => r. valid_modifiers ( arch) ,
455
473
Self :: SpirV ( r) => r. valid_modifiers ( arch) ,
456
474
Self :: Wasm ( r) => r. valid_modifiers ( arch) ,
475
+ // The modifier check is skipped in the code for rustdoc
476
+ Self :: RustdocDummy => & [ ] ,
457
477
}
458
478
}
459
479
}
0 commit comments