-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #55525 - nnethercote:MatcherPos-stack-SmallVec, r=nneth…
…ercote Make `MatcherPos::stack` a `SmallVec`. This avoids some allocations. This seems like a trivial change, but the compiler rejects it: ``` Compiling syntax v0.0.0 (/home/njn/moz/rust1/src/libsyntax) error[E0597]: `initial` does not live long enough=========> ] 89/110: syntax --> libsyntax/ext/tt/macro_parser.rs:647:57 | 647 | let mut cur_items = smallvec![MatcherPosHandle::Ref(&mut initial)]; | ^^^^^^^^^^^^ borrowed value does not live long enough ... 762 | } | - | | | `initial` dropped here while still borrowed | borrow later used here, when `initial` is dropped error: aborting due to previous error ``` This is either a compiler bug, or there's some subtle thing I don't understand. The lifetimes sure seem straightforward: `initial` is declared, and then `cur_items` is declared immediately afterward, and it uses a reference to `initial`. The error message makes it sound like the compiler is dropping the variables in the wrong order. r? @nikomatsakis, any idea what the problem is?
- Loading branch information
Showing
1 changed file
with
57 additions
and
34 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