Skip to content

Commit

Permalink
Rollup merge of rust-lang#33967 - dsprenkels:enum_pattern_resolve_ice…
Browse files Browse the repository at this point in the history
…, r=petrochenkov

resolve: record pattern def when `resolve_pattern` returns `Err(true)`

I propose a fix for issue rust-lang#33293.

In 1a374b8, (pr rust-lang#33046) fixed the error reporting of a specific case, but the change that was introduced did not make sure that `record_def` was called in all cases, which lead to an ICE in [1].
This change restores the original `else` case, but keeps the changes that were committed in 1a374b8.

[1] `rustc::middle::mem_categorization::MemCategorizationContext::cat_pattern_`
  • Loading branch information
Manishearth committed Jun 1, 2016
2 parents 0e65b75 + cde0f94 commit eba82bb
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/librustc_resolve/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2422,13 +2422,16 @@ impl<'a> Resolver<'a> {
}
}
}
} else if let Err(false) = self.resolve_path(pat_id, &path, 0, ValueNS) {
resolve_error(
self,
path.span,
ResolutionError::UnresolvedEnumVariantStructOrConst(
&path.segments.last().unwrap().identifier.name.as_str())
);
} else {
if let Err(false) = self.resolve_path(pat_id, &path, 0, ValueNS) {
// No error has been reported, so we need to do this ourselves.
resolve_error(
self,
path.span,
ResolutionError::UnresolvedEnumVariantStructOrConst(
&path.segments.last().unwrap().identifier.name.as_str())
);
}
self.record_def(pattern.id, err_path_resolution());
}
visit::walk_path(self, path);
Expand Down

0 comments on commit eba82bb

Please sign in to comment.