Work around #3215/#3217 use-after-free in typeck::check::alt
This commit is contained in:
parent
5026ea0446
commit
09cf5c1de4
1 changed files with 4 additions and 1 deletions
|
@ -235,7 +235,10 @@ fn check_pat(pcx: pat_ctxt, pat: @ast::pat, expected: ty::t) {
|
|||
ast::pat_struct(path, fields, etc) => {
|
||||
// Grab the class data that we care about.
|
||||
let class_fields, class_id, substitutions;
|
||||
match structure_of(fcx, pat.span, expected) {
|
||||
// FIXME(#3217) If this were "match structure_of...", this bug causes
|
||||
// it to not live long enough for 'substitutions'.
|
||||
let structure = structure_of(fcx, pat.span, expected);
|
||||
match structure {
|
||||
ty::ty_class(cid, ref substs) => {
|
||||
class_id = cid;
|
||||
substitutions = substs;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue