forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
18 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -814,26 +814,25 @@ impl<'a> MethodDef<'a> { | |
"no self match on an enum in \ | ||
generic `deriving`"); | ||
} | ||
|
||
// `ref` inside let matches is buggy. Causes havoc wih rusc. | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
flaper87
Author
Owner
|
||
// let (variant_index, ref self_vec) = matches_so_far[0]; | ||
let (variant, self_vec) = match matches_so_far.get(0) { | ||
&(_, v, ref s) => (v, s) | ||
}; | ||
|
||
// we currently have a vec of vecs, where each | ||
// subvec is the fields of one of the arguments, | ||
// but if the variants all match, we want this as | ||
// vec of tuples, where each tuple represents a | ||
// field. | ||
|
||
let substructure; | ||
|
||
// most arms don't have matching variants, so do a | ||
// quick check to see if they match (even though | ||
// this means iterating twice) instead of being | ||
// optimistic and doing a pile of allocations etc. | ||
match matching { | ||
let substructure = match matching { | ||
Some(variant_index) => { | ||
// `ref` inside let matches is buggy. Causes havoc wih rusc. | ||
// let (variant_index, ref self_vec) = matches_so_far[0]; | ||
let (variant, self_vec) = match matches_so_far.get(0) { | ||
&(_, v, ref s) => (v, s) | ||
}; | ||
|
||
let mut enum_matching_fields = Vec::from_elem(self_vec.len(), Vec::new()); | ||
|
||
for triple in matches_so_far.tail().iter() { | ||
|
@@ -856,12 +855,12 @@ impl<'a> MethodDef<'a> { | |
other: (*other).clone() | ||
} | ||
}).collect(); | ||
substructure = EnumMatching(variant_index, variant, field_tuples); | ||
EnumMatching(variant_index, variant, field_tuples) | ||
} | ||
None => { | ||
substructure = EnumNonMatching(matches_so_far.as_slice()); | ||
EnumNonMatching(matches_so_far.as_slice()) | ||
} | ||
} | ||
}; | ||
self.call_substructure_method(cx, trait_, type_ident, | ||
self_args, nonself_args, | ||
&substructure) | ||
|
Hey, @flaper87 , is there an issue open for whatever phenomenon you were commenting on here?