]> git.lizzy.rs Git - rust.git/commit
Cache drops for early scope exits
authorSimonas Kazlauskas <git@kazlauskas.me>
Thu, 16 Jun 2016 15:28:30 +0000 (18:28 +0300)
committerSimonas Kazlauskas <git@kazlauskas.me>
Thu, 16 Jun 2016 21:00:44 +0000 (00:00 +0300)
commit04d63ccf5ac2448ced4ca0d964afbcfe47a58dfe
treef5cf6d87236c1b21fc7aea45a231ca26221d0211
parenta479a6a7a6fa1bfe1f18d7d7411ad14e7b8ca17b
Cache drops for early scope exits

Previously we would rebuild all drops on every early exit from a scope, which for code like:

```rust
match x {
    a => return 1,
    b => return 2,
    ...
    z => return 27
}
```

would produce 27 exactly same chains of drops for each return, a O(n*m) explosion in drops.
src/librustc_mir/build/scope.rs