Auto merge of #83964 - Dylan-DPC:rollup-9kinaiv, r=Dylan-DPC
Rollup of 8 pull requests Successful merges: - #83476 (Add strong_count mutation methods to Rc) - #83634 (Do not emit the advanced diagnostics on macros) - #83816 (Trigger `unused_doc_comments` on macros at once) - #83916 (Use AnonConst for asm! constants) - #83935 (forbid `impl Trait` in generic param defaults) - #83936 (Disable using non-ascii identifiers in extern blocks.) - #83945 (Add suggestion to reborrow mutable references when they're moved in a for loop) - #83954 (Do not ICE when closure is involved in Trait Alias Impl Trait) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
e9cdcccfa8
127 changed files with 902 additions and 400 deletions
|
@ -2087,7 +2087,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||
fn check_expr_asm(&self, asm: &'tcx hir::InlineAsm<'tcx>) -> Ty<'tcx> {
|
||||
for (op, _op_sp) in asm.operands {
|
||||
match op {
|
||||
hir::InlineAsmOperand::In { expr, .. } | hir::InlineAsmOperand::Const { expr } => {
|
||||
hir::InlineAsmOperand::In { expr, .. } => {
|
||||
self.check_expr_asm_operand(expr, true);
|
||||
}
|
||||
hir::InlineAsmOperand::Out { expr, .. } => {
|
||||
|
@ -2104,6 +2104,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||
self.check_expr_asm_operand(out_expr, false);
|
||||
}
|
||||
}
|
||||
hir::InlineAsmOperand::Const { anon_const } => {
|
||||
self.to_const(anon_const);
|
||||
}
|
||||
hir::InlineAsmOperand::Sym { expr } => {
|
||||
self.check_expr(expr);
|
||||
}
|
||||
|
|
|
@ -540,6 +540,19 @@ fn typeck_with_fallback<'tcx>(
|
|||
kind: TypeVariableOriginKind::TypeInference,
|
||||
span,
|
||||
}),
|
||||
Node::Expr(&hir::Expr { kind: hir::ExprKind::InlineAsm(ia), .. })
|
||||
if ia.operands.iter().any(|(op, _op_sp)| match op {
|
||||
hir::InlineAsmOperand::Const { anon_const } => {
|
||||
anon_const.hir_id == id
|
||||
}
|
||||
_ => false,
|
||||
}) =>
|
||||
{
|
||||
fcx.next_ty_var(TypeVariableOrigin {
|
||||
kind: TypeVariableOriginKind::MiscVariable,
|
||||
span,
|
||||
})
|
||||
}
|
||||
_ => fallback(),
|
||||
},
|
||||
_ => fallback(),
|
||||
|
|
|
@ -430,6 +430,15 @@ pub(super) fn type_of(tcx: TyCtxt<'_>, def_id: DefId) -> Ty<'_> {
|
|||
tcx.typeck(def_id).node_type(anon_const.hir_id)
|
||||
}
|
||||
|
||||
Node::Expr(&Expr { kind: ExprKind::InlineAsm(ia), .. })
|
||||
if ia.operands.iter().any(|(op, _op_sp)| match op {
|
||||
hir::InlineAsmOperand::Const { anon_const } => anon_const.hir_id == hir_id,
|
||||
_ => false,
|
||||
}) =>
|
||||
{
|
||||
tcx.typeck(def_id).node_type(hir_id)
|
||||
}
|
||||
|
||||
Node::Variant(Variant { disr_expr: Some(ref e), .. }) if e.hir_id == hir_id => tcx
|
||||
.adt_def(tcx.hir().get_parent_did(hir_id).to_def_id())
|
||||
.repr
|
||||
|
|
|
@ -318,7 +318,6 @@ impl<'a, 'tcx> ExprUseVisitor<'a, 'tcx> {
|
|||
for (op, _op_sp) in asm.operands {
|
||||
match op {
|
||||
hir::InlineAsmOperand::In { expr, .. }
|
||||
| hir::InlineAsmOperand::Const { expr, .. }
|
||||
| hir::InlineAsmOperand::Sym { expr, .. } => self.consume_expr(expr),
|
||||
hir::InlineAsmOperand::Out { expr, .. } => {
|
||||
if let Some(expr) = expr {
|
||||
|
@ -334,6 +333,7 @@ impl<'a, 'tcx> ExprUseVisitor<'a, 'tcx> {
|
|||
self.mutate_expr(out_expr);
|
||||
}
|
||||
}
|
||||
hir::InlineAsmOperand::Const { .. } => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue