diff options
| author | Amanieu d'Antras <amanieu@gmail.com> | 2021-04-29 00:59:15 +0100 |
|---|---|---|
| committer | Amanieu d'Antras <amanieu@gmail.com> | 2021-05-14 14:58:21 +0100 |
| commit | f1b11939e22582b4100843344ed7bf1b5184e704 (patch) | |
| tree | ec4e44155d14aebfe8e0d8ff278d974a54070b12 /compiler/rustc_passes/src | |
| parent | 36a4d14c7edba21bba14df00b9e6e4a111dfc6f2 (diff) | |
| download | rust-f1b11939e22582b4100843344ed7bf1b5184e704.tar.gz rust-f1b11939e22582b4100843344ed7bf1b5184e704.zip | |
Remove support for floating-point constants in asm!
Floating-point constants aren't very useful anyways and this simplifies the code since the type check can now be done in typeck.
Diffstat (limited to 'compiler/rustc_passes/src')
| -rw-r--r-- | compiler/rustc_passes/src/intrinsicck.rs | 43 |
1 files changed, 2 insertions, 41 deletions
diff --git a/compiler/rustc_passes/src/intrinsicck.rs b/compiler/rustc_passes/src/intrinsicck.rs index 4532a0a350c..012d97ef106 100644 --- a/compiler/rustc_passes/src/intrinsicck.rs +++ b/compiler/rustc_passes/src/intrinsicck.rs @@ -347,7 +347,7 @@ impl ExprVisitor<'tcx> { } fn check_asm(&self, asm: &hir::InlineAsm<'tcx>) { - for (idx, (op, op_sp)) in asm.operands.iter().enumerate() { + for (idx, (op, _)) in asm.operands.iter().enumerate() { match *op { hir::InlineAsmOperand::In { reg, ref expr } => { self.check_asm_operand_type(idx, reg, expr, asm.template, None); @@ -372,19 +372,7 @@ impl ExprVisitor<'tcx> { ); } } - hir::InlineAsmOperand::Const { ref anon_const } => { - let anon_const_def_id = self.tcx.hir().local_def_id(anon_const.hir_id); - let value = ty::Const::from_anon_const(self.tcx, anon_const_def_id); - match value.ty.kind() { - ty::Int(_) | ty::Uint(_) | ty::Float(_) => {} - _ => { - let msg = - "asm `const` arguments must be integer or floating-point values"; - self.tcx.sess.span_err(*op_sp, msg); - } - } - } - hir::InlineAsmOperand::Sym { .. } => {} + hir::InlineAsmOperand::Const { .. } | hir::InlineAsmOperand::Sym { .. } => {} } } } @@ -405,33 +393,6 @@ impl Visitor<'tcx> for ItemVisitor<'tcx> { ExprVisitor { tcx: self.tcx, param_env, typeck_results }.visit_body(body); self.visit_body(body); } - - fn visit_item(&mut self, item: &'tcx hir::Item<'tcx>) { - if let hir::ItemKind::GlobalAsm(asm) = item.kind { - for (op, op_sp) in asm.operands { - match *op { - hir::InlineAsmOperand::Const { ref anon_const } => { - let anon_const_def_id = self.tcx.hir().local_def_id(anon_const.hir_id); - let value = ty::Const::from_anon_const(self.tcx, anon_const_def_id); - match value.ty.kind() { - ty::Int(_) | ty::Uint(_) | ty::Float(_) => {} - _ => { - let msg = "asm `const` arguments must be integer or floating-point values"; - self.tcx.sess.span_err(*op_sp, msg); - } - } - } - hir::InlineAsmOperand::In { .. } - | hir::InlineAsmOperand::Out { .. } - | hir::InlineAsmOperand::InOut { .. } - | hir::InlineAsmOperand::SplitInOut { .. } - | hir::InlineAsmOperand::Sym { .. } => unreachable!(), - } - } - } - - intravisit::walk_item(self, item); - } } impl Visitor<'tcx> for ExprVisitor<'tcx> { |
