Skip to content

Commit

Permalink
Mark some once-again-unreachable paths as unreachable.
Browse files Browse the repository at this point in the history
This undoes the changes from rust-lang#121482 and rust-lang#121586, now that stashed errors
will trigger more early aborts.
  • Loading branch information
nnethercote committed Feb 27, 2024
1 parent 09aafe5 commit 3411625
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
14 changes: 5 additions & 9 deletions compiler/rustc_lint/src/array_into_iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,11 @@ impl<'tcx> LateLintPass<'tcx> for ArrayIntoIter {

// Check if the method call actually calls the libcore
// `IntoIterator::into_iter`.
let trait_id = cx
.typeck_results()
.type_dependent_def_id(expr.hir_id)
.and_then(|did| cx.tcx.trait_of_item(did));
if trait_id.is_none()
|| !cx.tcx.is_diagnostic_item(sym::IntoIterator, trait_id.unwrap())
{
return;
}
let def_id = cx.typeck_results().type_dependent_def_id(expr.hir_id).unwrap();
match cx.tcx.trait_of_item(def_id) {
Some(trait_id) if cx.tcx.is_diagnostic_item(sym::IntoIterator, trait_id) => {}
_ => return,
};

// As this is a method call expression, we have at least one argument.
let receiver_ty = cx.typeck_results().expr_ty(receiver_arg);
Expand Down
5 changes: 1 addition & 4 deletions compiler/rustc_privacy/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -988,10 +988,7 @@ impl<'tcx> Visitor<'tcx> for NamePrivacyVisitor<'tcx> {
fn visit_expr(&mut self, expr: &'tcx hir::Expr<'tcx>) {
if let hir::ExprKind::Struct(qpath, fields, ref base) = expr.kind {
let res = self.typeck_results().qpath_res(qpath, expr.hir_id);
let Some(adt) = self.typeck_results().expr_ty(expr).ty_adt_def() else {
self.tcx.dcx().span_delayed_bug(expr.span, "no adt_def for expression");
return;
};
let adt = self.typeck_results().expr_ty(expr).ty_adt_def().unwrap();
let variant = adt.variant_of_res(res);
if let Some(base) = *base {
// If the expression uses FRU we need to make sure all the unmentioned fields
Expand Down

0 comments on commit 3411625

Please sign in to comment.