Skip to content

Commit 6ba8da6

Browse files
committed
Fall through to check other arguments instead of bailing out on the first error
1 parent 46a2342 commit 6ba8da6

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

compiler/rustc_typeck/src/check/expr.rs

+5
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
296296
}
297297
ExprKind::Path(ref qpath) => self.check_expr_path(qpath, expr, &[]),
298298
ExprKind::InlineAsm(asm) => {
299+
// We defer some asm checks as we may not have resolved the input and output types yet (they may still be infer vars).
299300
self.deferred_asm_checks.borrow_mut().push((asm, expr.hir_id));
300301
self.check_expr_asm(asm)
301302
}
@@ -539,6 +540,10 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
539540
if tcx.fn_sig(did).abi() == RustIntrinsic && tcx.item_name(did) == sym::transmute {
540541
let from = fn_sig.inputs().skip_binder()[0];
541542
let to = fn_sig.output().skip_binder();
543+
// We defer the transmute to the end of typeck, once all inference vars have
544+
// been resolved or we errored. This is important as we can only check transmute
545+
// on concrete types, but the output type may not be known yet (it would only
546+
// be known if explicitly specified via turbofish).
542547
self.deferred_transmute_checks.borrow_mut().push((from, to, expr.span));
543548
}
544549
if !tcx.features().unsized_fn_params {

compiler/rustc_typeck/src/check/intrinsicck.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
361361
// target. Reject those here.
362362
if let InlineAsmRegOrRegClass::Reg(reg) = reg {
363363
if let InlineAsmReg::Err = reg {
364-
return;
364+
// `validate` will panic on `Err`, as an error must
365+
// already have been reported.
366+
continue;
365367
}
366368
if let Err(msg) = reg.validate(
367369
asm_arch,
@@ -380,7 +382,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
380382
let mut missing_required_features = vec![];
381383
let reg_class = reg.reg_class();
382384
if let InlineAsmRegClass::Err = reg_class {
383-
return;
385+
continue;
384386
}
385387
for &(_, feature) in reg_class.supported_types(asm_arch) {
386388
match feature {

0 commit comments

Comments
 (0)