Rollup merge of #126584 - cjgillot:issue-122736, r=michaelwoerister
Do not ICE in privacy when type inference fails. Fixes https://github.com/rust-lang/rust/issues/122736
This commit is contained in:
commit
592f9aa544
3 changed files with 34 additions and 3 deletions
|
@ -973,8 +973,12 @@ impl<'tcx> NamePrivacyVisitor<'tcx> {
|
|||
|
||||
impl<'tcx> Visitor<'tcx> for NamePrivacyVisitor<'tcx> {
|
||||
fn visit_nested_body(&mut self, body_id: hir::BodyId) {
|
||||
let old_maybe_typeck_results =
|
||||
self.maybe_typeck_results.replace(self.tcx.typeck_body(body_id));
|
||||
let new_typeck_results = self.tcx.typeck_body(body_id);
|
||||
// Do not try reporting privacy violations if we failed to infer types.
|
||||
if new_typeck_results.tainted_by_errors.is_some() {
|
||||
return;
|
||||
}
|
||||
let old_maybe_typeck_results = self.maybe_typeck_results.replace(new_typeck_results);
|
||||
self.visit_body(self.tcx.hir().body(body_id));
|
||||
self.maybe_typeck_results = old_maybe_typeck_results;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue