Work around #3215/#3217 use-after-free in typeck::check::alt
This commit is contained in:
@@ -235,7 +235,10 @@ fn check_pat(pcx: pat_ctxt, pat: @ast::pat, expected: ty::t) {
|
|||||||
ast::pat_struct(path, fields, etc) => {
|
ast::pat_struct(path, fields, etc) => {
|
||||||
// Grab the class data that we care about.
|
// Grab the class data that we care about.
|
||||||
let class_fields, class_id, substitutions;
|
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) => {
|
ty::ty_class(cid, ref substs) => {
|
||||||
class_id = cid;
|
class_id = cid;
|
||||||
substitutions = substs;
|
substitutions = substs;
|
||||||
|
|||||||
Reference in New Issue
Block a user