|
1 | 1 | use crate::consts::{constant_context, constant_simple};
|
2 | 2 | use crate::utils::differing_macro_contexts;
|
| 3 | +use rustc_ast::ast::InlineAsmTemplatePiece; |
3 | 4 | use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
|
4 | 5 | use rustc_hir::{
|
5 | 6 | BinOpKind, Block, BlockCheckMode, BodyId, BorrowKind, CaptureBy, Expr, ExprKind, Field, FnRetTy, GenericArg,
|
6 |
| - GenericArgs, Guard, Lifetime, LifetimeName, ParamName, Pat, PatKind, Path, PathSegment, QPath, Stmt, StmtKind, Ty, |
7 |
| - TyKind, TypeBinding, |
| 7 | + GenericArgs, Guard, InlineAsmOperand, Lifetime, LifetimeName, ParamName, Pat, PatKind, Path, PathSegment, QPath, |
| 8 | + Stmt, StmtKind, Ty, TyKind, TypeBinding, |
8 | 9 | };
|
9 | 10 | use rustc_lint::LateContext;
|
10 | 11 | use rustc_middle::ich::StableHashingContextProvider;
|
@@ -474,6 +475,56 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> {
|
474 | 475 | self.hash_expr(a);
|
475 | 476 | self.hash_expr(i);
|
476 | 477 | },
|
| 478 | + ExprKind::InlineAsm(ref asm) => { |
| 479 | + for piece in asm.template { |
| 480 | + match piece { |
| 481 | + InlineAsmTemplatePiece::String(s) => s.hash(&mut self.s), |
| 482 | + InlineAsmTemplatePiece::Placeholder { |
| 483 | + operand_idx, |
| 484 | + modifier, |
| 485 | + span: _, |
| 486 | + } => { |
| 487 | + operand_idx.hash(&mut self.s); |
| 488 | + modifier.hash(&mut self.s); |
| 489 | + }, |
| 490 | + } |
| 491 | + } |
| 492 | + asm.options.hash(&mut self.s); |
| 493 | + for op in asm.operands { |
| 494 | + match op { |
| 495 | + InlineAsmOperand::In { reg, expr } => { |
| 496 | + reg.hash(&mut self.s); |
| 497 | + self.hash_expr(expr); |
| 498 | + }, |
| 499 | + InlineAsmOperand::Out { reg, late, expr } => { |
| 500 | + reg.hash(&mut self.s); |
| 501 | + late.hash(&mut self.s); |
| 502 | + if let Some(expr) = expr { |
| 503 | + self.hash_expr(expr); |
| 504 | + } |
| 505 | + }, |
| 506 | + InlineAsmOperand::InOut { reg, late, expr } => { |
| 507 | + reg.hash(&mut self.s); |
| 508 | + late.hash(&mut self.s); |
| 509 | + self.hash_expr(expr); |
| 510 | + }, |
| 511 | + InlineAsmOperand::SplitInOut { |
| 512 | + reg, |
| 513 | + late, |
| 514 | + in_expr, |
| 515 | + out_expr, |
| 516 | + } => { |
| 517 | + reg.hash(&mut self.s); |
| 518 | + late.hash(&mut self.s); |
| 519 | + self.hash_expr(in_expr); |
| 520 | + if let Some(out_expr) = out_expr { |
| 521 | + self.hash_expr(out_expr); |
| 522 | + } |
| 523 | + }, |
| 524 | + InlineAsmOperand::Const { expr } | InlineAsmOperand::Sym { expr } => self.hash_expr(expr), |
| 525 | + } |
| 526 | + } |
| 527 | + }, |
477 | 528 | ExprKind::LlvmInlineAsm(..) | ExprKind::Err => {},
|
478 | 529 | ExprKind::Lit(ref l) => {
|
479 | 530 | l.node.hash(&mut self.s);
|
|
0 commit comments