Add a fast path in ty::occurs_check_fails
Use type_contains_vars in occurs_check_fails to avoid doing any work most of the time. This fixes a performance regression. (No one else noticed yet that typechecking just got 4x slower, right? Well, now it isn't anymore. :-})
This commit is contained in:
parent
2baaeab784
commit
5f03ca48d8
|
@ -2015,6 +2015,10 @@ fn is_lval(expr: &@ast::expr) -> bool {
|
|||
|
||||
fn occurs_check_fails(tcx: &ctxt, sp: &option::t[span], vid: int, rt: &t)
|
||||
-> bool {
|
||||
if (!type_contains_vars(tcx, rt)) {
|
||||
// Fast path
|
||||
ret false;
|
||||
}
|
||||
// Occurs check!
|
||||
if ivec::member(vid, vars_in_type(tcx, rt)) {
|
||||
alt sp {
|
||||
|
|
Loading…
Reference in New Issue