New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use a `SmallVec` within `_match::Matrix`. #56269

Merged
merged 2 commits into from Dec 10, 2018

Conversation

Projects
None yet
5 participants
@nnethercote
Contributor

nnethercote commented Nov 27, 2018

This avoids allocations.

@rust-highfive

This comment has been minimized.

Collaborator

rust-highfive commented Nov 27, 2018

r? @davidtwco

(rust_highfive has picked a reviewer for you, use r? to override)

@nnethercote

This comment has been minimized.

Contributor

nnethercote commented Nov 27, 2018

Note! This code doesn't compile currently. I get four compile errors:

error: unsatisfied lifetime constraints
   --> src/librustc_mir/hair/pattern/_match.rs:341:9
    |
317 |   impl<'a, 'tcx> MatchCheckCtxt<'a, 'tcx> {
    |        -- lifetime `'a` defined here
...
335 |       fn lower_byte_str_pattern<'p>(&mut self, pat: &'p Pattern<'tcx>)
    |                                 -- lifetime `'p` defined here
...
341 | /         self.byte_array_map.entry(pat).or_insert_with(|| {
342 | |             match pat.kind {
343 | |                 box PatternKind::Constant {
344 | |                     value: const_val
...   |
372 | |             }
373 | |         }).clone()
    | |__________________^ returning this value requires that `'p` must outlive `'a`

error[E0597]: `wild_patterns_owned` does not live long enough
    --> src/librustc_mir/hair/pattern/_match.rs:1254:33
     |
1254 |     let wild_patterns: Vec<_> = wild_patterns_owned.iter().collect();
     |                                 ^^^^^^^^^^^^^^^^^^^ borrowed value does not live long enough
...
1258 |     match specialize(cx, v, &ctor, &wild_patterns) {
     |           ---------------------------------------- a temporary with access to the borrow is created here ...
...
1269 | }
     | -
     | |
     | `wild_patterns_owned` dropped here while still borrowed
     | ... and the borrow might be used here, when that temporary is dropped and runs the destructor for type `std::option::Option<smallvec::SmallVec<[&hair::pattern::Pattern<'_>; 2]>>`
     |
     = note: The temporary is part of an expression at the end of a block. Consider forcing this temporary to be dropped sooner, before the block's local variables are dropped. For example, you could save the expression's value in a new local variable `x` and then make `x` be the expression at the end of the block.

error[E0597]: `wild_pattern` does not live long enough
   --> src/librustc_mir/hair/pattern/check_match.rs:287:56
    |
287 |             let witness = match is_useful(cx, &pats, &[&wild_pattern], ConstructWitness) {
    |                                                        ^^^^^^^^^^^^^ borrowed value does not live long enough
...
309 |         });
    |         -
    |         |
    |         `wild_pattern` dropped here while still borrowed
    |         borrow might be used here, when `pats` is dropped and runs the destructor for type `hair::pattern::_match::Matrix<'_, '_>`
    |
    = note: values in a scope are dropped in the opposite order they are defined

error[E0597]: `wild_pattern` does not live long enough
   --> src/librustc_mir/hair/pattern/check_match.rs:475:35
    |
466 | fn check_exhaustive<'a, 'tcx>(cx: &mut MatchCheckCtxt<'a, 'tcx>,
    |                     -- lifetime `'a` defined here
...
475 |     match is_useful(cx, matrix, &[&wild_pattern], ConstructWitness) {
    |           ------------------------^^^^^^^^^^^^^--------------------
    |           |                       |
    |           |                       borrowed value does not live long enough
    |           argument requires that `wild_pattern` is borrowed for `'a`
...
514 | }
    | - `wild_pattern` dropped here while still borrowed

This is at least partly because SmallVec doesn't use may_dangle. If I add that to SmallVec -- see servo/rust-smallvec#132 -- it avoids the 2nd and 3rd error, but the 1st and 4th remain. So either the way I've added may_dangle isn't right, or there's something else going on as well.

@nikomatsakis: this is similar to #55525.

@Mark-Simulacrum

This comment has been minimized.

Member

Mark-Simulacrum commented Nov 27, 2018

r=me (@bors delegate+) -- one thing though might be to change the repeated SmallVec writing to a type alias placed somewhere, but since I didn't see a great place for it I don't think we should block on it or do it all perhaps

@rust-highfive

This comment was marked as outdated.

Collaborator

rust-highfive commented Nov 27, 2018

The job x86_64-gnu-llvm-5.0 of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
travis_time:end:2319eec0:start=1543289811034372568,finish=1543289864911109366,duration=53876736798
$ git checkout -qf FETCH_HEAD
travis_fold:end:git.checkout

Encrypted environment variables have been removed for security reasons.
See https://docs.travis-ci.com/user/pull-requests/#Pull-Requests-and-Security-Restrictions
$ export SCCACHE_BUCKET=rust-lang-ci-sccache2
$ export SCCACHE_REGION=us-west-1
Setting environment variables from .travis.yml
$ export IMAGE=x86_64-gnu-llvm-5.0
---
[00:13:22]    Compiling rustc_typeck v0.0.0 (/checkout/src/librustc_typeck)
[00:14:24] error: unsatisfied lifetime constraints
[00:14:24]    --> src/librustc_mir/hair/pattern/_match.rs:341:9
[00:14:24]     |
[00:14:24] 317 |   impl<'a, 'tcx> MatchCheckCtxt<'a, 'tcx> {
[00:14:24]     |        -- lifetime `'a` defined here
[00:14:24] ...
[00:14:24] 335 |       fn lower_byte_str_pattern<'p>(&mut self, pat: &'p Pattern<'tcx>)
[00:14:24]     |                                 -- lifetime `'p` defined here
[00:14:24] ...
[00:14:24] 341 | /         self.byte_array_map.entry(pat).or_insert_with(|| {
[00:14:24] 342 | |             match pat.kind {
[00:14:24] 343 | |                 box PatternKind::Constant {
[00:14:24] 344 | |                     value: const_val
[00:14:24] 372 | |             }
[00:14:24] 373 | |         }).clone()
[00:14:24] 373 | |         }).clone()
[00:14:24]     | |__________________^ returning this value requires that `'p` must outlive `'a`
[00:14:24] 
[00:14:24] error[E0597]: `wild_patterns_owned` does not live long enough
[00:14:24]      |
[00:14:24]      |
[00:14:24] 1254 |     let wild_patterns: Vec<_> = wild_patterns_owned.iter().collect();
[00:14:24]      |                                 ^^^^^^^^^^^^^^^^^^^ borrowed value does not live long enough
[00:14:24] ...
[00:14:24] 1258 |     match specialize(cx, v, &ctor, &wild_patterns) {
[00:14:24]      |           ---------------------------------------- a temporary with access to the borrow is created here ...
[00:14:24] 1269 | }
[00:14:24]      | -
[00:14:24]      | |
[00:14:24]      | |
[00:14:24]      | `wild_patterns_owned` dropped here while still borrowed
[00:14:24]      | ... and the borrow might be used here, when that temporary is dropped and runs the destructor for type `std::option::Option<smallvec::SmallVec<[&hair::pattern::Pattern<'_>; 2]>>`
[00:14:24]      |
[00:14:24]      = note: The temporary is part of an expression at the end of a block. Consider forcing this temporary to be dropped sooner, before the block's local variables are dropped. For example, you could save the expression's value in a new local variable `x` and then make `x` be the expression at the end of the block.
[00:14:24] 
[00:14:24] error[E0597]: `wild_pattern` does not live long enough
[00:14:24]    --> src/librustc_mir/hair/pattern/check_match.rs:287:56
[00:14:24]     |
[00:14:24] 287 |             let witness = match is_useful(cx, &pats, &[&wild_pattern], ConstructWitness) {
[00:14:24]     |                                                        ^^^^^^^^^^^^^ borrowed value does not live long enough
[00:14:24] 309 |         });
[00:14:24]     |         -
[00:14:24]     |         |
[00:14:24]     |         |
[00:14:24]     |         `wild_pattern` dropped here while still borrowed
[00:14:24]     |         borrow might be used here, when `pats` is dropped and runs the destructor for type `hair::pattern::_match::Matrix<'_, '_>`
[00:14:24]     |
[00:14:24]     = note: values in a scope are dropped in the opposite order they are defined
[00:14:24] 
[00:14:24] error[E0597]: `wild_pattern` does not live long enough
[00:14:24]    --> src/librustc_mir/hair/pattern/check_match.rs:475:35
[00:14:24]     |
[00:14:24] 466 | fn check_exhaustive<'a, 'tcx>(cx: &mut MatchCheckCtxt<'a, 'tcx>,
[00:14:24]     |                     -- lifetime `'a` defined here
[00:14:24] ...
[00:14:24] 475 |     match is_useful(cx, matrix, &[&wild_pattern], ConstructWitness) {
[00:14:24]     |           |                       |
[00:14:24]     |           |                       |
[00:14:24]     |           |                       borrowed value does not live long enough
[00:14:24]     |           argument requires that `wild_pattern` is borrowed for `'a`
[00:14:24] 514 | }
[00:14:24] 514 | }
[00:14:24]     | - `wild_pattern` dropped here while still borrowed
[00:14:31] error: aborting due to 4 previous errors
[00:14:31] 
[00:14:31] For more information about this error, try `rustc --explain E0597`.
[00:14:31] error: Could not compile `rustc_mir`.

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@nnethercote

This comment has been minimized.

Contributor

nnethercote commented Nov 27, 2018

@bors r-

As mentioned above, this code doesn't currently compile. I'm posting it to a PR because it's the easiest way to get others to look at it :)

one thing though might be to change the repeated SmallVec writing to a type alias placed somewhere

I tried that, and ended up with this:

type PatternVec<'a, 'tcx> = SmallVec<[&'a Pattern<'tcx>; 2]>>;

and when you see a PatternVec in isolation it's not clear what the two lifetimes are referring to, i.e. I felt that it obscured things. But I could be convinced otherwise.

@Mark-Simulacrum

This comment has been minimized.

Member

Mark-Simulacrum commented Nov 27, 2018

That's a good point -- though PatternRefVec<'a, 'tcx> might be a bit clearer.

Also, r=me doesn't actually bors-approve, I just indicated that the overall change seemed good so when ready you can go ahead and r=me :)

@nnethercote nnethercote force-pushed the nnethercote:_match-Matrix-SmallVec branch from 43bef44 to 1b0f049 Nov 29, 2018

@nnethercote

This comment has been minimized.

Contributor

nnethercote commented Nov 29, 2018

I put new code up. If works if SmallVec gets may_dangle added to it. I.e. this is now only blocked by servo/rust-smallvec#132.

@rust-highfive

This comment was marked as outdated.

Collaborator

rust-highfive commented Nov 29, 2018

The job x86_64-gnu-llvm-5.0 of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
travis_time:end:054d4258:start=1543479888773956289,finish=1543479944417783227,duration=55643826938
$ git checkout -qf FETCH_HEAD
travis_fold:end:git.checkout

Encrypted environment variables have been removed for security reasons.
See https://docs.travis-ci.com/user/pull-requests/#Pull-Requests-and-Security-Restrictions
$ export SCCACHE_BUCKET=rust-lang-ci-sccache2
$ export SCCACHE_REGION=us-west-1
Setting environment variables from .travis.yml
$ export IMAGE=x86_64-gnu-llvm-5.0
---
[00:01:02] downloading https://static.rust-lang.org/dist/2018-10-30/cargo-beta-x86_64-unknown-linux-gnu.tar.gz
[00:01:02] 
######################################################################## 100.0%
[00:01:02] extracting /checkout/obj/build/cache/2018-10-30/cargo-beta-x86_64-unknown-linux-gnu.tar.gz
[00:01:02] error: failed to read `/rust-smallvec/Cargo.toml`
[00:01:02] Caused by:
[00:01:02]   No such file or directory (os error 2)
[00:01:02] failed to run: /checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo build --manifest-path /checkout/src/bootstrap/Cargo.toml --locked
[00:01:02] Build completed unsuccessfully in 0:00:11
[00:01:02] Build completed unsuccessfully in 0:00:11
[00:01:02] make: *** [prepare] Error 1
[00:01:02] Makefile:81: recipe for target 'prepare' failed
[00:01:03] Command failed. Attempt 2/5:
[00:01:03] error: failed to read `/rust-smallvec/Cargo.toml`
[00:01:03] Caused by:
[00:01:03]   No such file or directory (os error 2)
[00:01:03] failed to run: /checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo build --manifest-path /checkout/src/bootstrap/Cargo.toml --locked
[00:01:03] Build completed unsuccessfully in 0:00:00
[00:01:03] Build completed unsuccessfully in 0:00:00
[00:01:03] make: *** [prepare] Error 1
[00:01:03] Makefile:81: recipe for target 'prepare' failed
[00:01:05] Command failed. Attempt 3/5:
[00:01:05] error: failed to read `/rust-smallvec/Cargo.toml`
[00:01:05] Caused by:
[00:01:05]   No such file or directory (os error 2)
[00:01:05] failed to run: /checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo build --manifest-path /checkout/src/bootstrap/Cargo.toml --locked
[00:01:05] Build completed unsuccessfully in 0:00:00
[00:01:05] Build completed unsuccessfully in 0:00:00
[00:01:05] make: *** [prepare] Error 1
[00:01:05] Makefile:81: recipe for target 'prepare' failed
[00:01:08] Command failed. Attempt 4/5:
[00:01:08] error: failed to read `/rust-smallvec/Cargo.toml`
[00:01:08] Caused by:
[00:01:08]   No such file or directory (os error 2)
[00:01:08] failed to run: /checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo build --manifest-path /checkout/src/bootstrap/Cargo.toml --locked
[00:01:08] Build completed unsuccessfully in 0:00:00
[00:01:08] Build completed unsuccessfully in 0:00:00
[00:01:08] Makefile:81: recipe for target 'prepare' failed
[00:01:08] make: *** [prepare] Error 1
[00:01:12] Command failed. Attempt 5/5:
[00:01:12] error: failed to read `/rust-smallvec/Cargo.toml`
[00:01:12] Caused by:
[00:01:12]   No such file or directory (os error 2)
[00:01:12] failed to run: /checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo build --manifest-path /checkout/src/bootstrap/Cargo.toml --locked
[00:01:12] Build completed unsuccessfully in 0:00:00
---
travis_time:end:1716e520:start=1543480026883858139,finish=1543480026888786949,duration=4928810
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:04fa31c6
$ ln -s . checkout && for CORE in obj/cores/core.*; do EXE=$(echo $CORE | sed 's|obj/cores/core\.[0-9]*\.!checkout!\(.*\)|\1|;y|!|/|'); if [ -f "$EXE" ]; then printf travis_fold":start:crashlog\n\033[31;1m%s\033[0m\n" "$CORE"; gdb --batch -q -c "$CORE" "$EXE" -iex 'set auto-load off' -iex 'dir src/' -iex 'set sysroot .' -ex bt -ex q; echo travis_fold":"end:crashlog; fi; done || true
travis_fold:end:after_failure.4
travis_fold:start:after_failure.5
travis_time:start:0f78fd98
travis_time:start:0f78fd98
$ cat ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers || true
cat: ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers: No such file or directory
travis_fold:end:after_failure.5
travis_fold:start:after_failure.6
travis_time:start:10797e7f
$ dmesg | grep -i kill

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@nnethercote nnethercote force-pushed the nnethercote:_match-Matrix-SmallVec branch from 1b0f049 to 123df63 Nov 30, 2018

@nnethercote

This comment has been minimized.

Contributor

nnethercote commented Nov 30, 2018

smallvec 0.6.7 now has may_dangle support, and this change is ok to land.

@Mark-Simulacrum: want to take another look before landing?

@Mark-Simulacrum

This comment has been minimized.

Member

Mark-Simulacrum commented Nov 30, 2018

@bors r+

@bors

This comment has been minimized.

Contributor

bors commented Nov 30, 2018

📌 Commit 123df63 has been approved by Mark-Simulacrum

Centril added a commit to Centril/rust that referenced this pull request Dec 2, 2018

Rollup merge of rust-lang#56269 - nnethercote:_match-Matrix-SmallVec,…
… r=Mark-Simulacrum

Use a `SmallVec` within `_match::Matrix`.

This avoids allocations.

Centril added a commit to Centril/rust that referenced this pull request Dec 2, 2018

Rollup merge of rust-lang#56269 - nnethercote:_match-Matrix-SmallVec,…
… r=Mark-Simulacrum

Use a `SmallVec` within `_match::Matrix`.

This avoids allocations.

Centril added a commit to Centril/rust that referenced this pull request Dec 2, 2018

Rollup merge of rust-lang#56269 - nnethercote:_match-Matrix-SmallVec,…
… r=Mark-Simulacrum

Use a `SmallVec` within `_match::Matrix`.

This avoids allocations.

bors added a commit that referenced this pull request Dec 2, 2018

Auto merge of #56430 - Centril:rollup, r=Centril
Rollup of 16 pull requests

Successful merges:

 - #56110 (Consider references and unions potentially inhabited during privacy-respecting inhabitedness checks)
 - #56269 (Use a `SmallVec` within `_match::Matrix`.)
 - #56305 (update miri)
 - #56358 (Enable -mergefunc-use-aliases)
 - #56366 (Stabilize self_in_typedefs feature)
 - #56372 (Refer to the second borrow as the "second borrow" in E0501.rs)
 - #56394 (Deal with EINTR in net timeout tests)
 - #56395 (Stabilize dbg!(...))
 - #56401 (Move VecDeque::resize_with out of the impl<T:Clone> block)
 - #56402 (Improve the unstable book example for #[marker] trait)
 - #56406 (Update RLS and Rustfmt)
 - #56412 (Update tracking issue for `extern_crate_self`)
 - #56416 (Remove unneeded body class selector)
 - #56418 (Fix failing tidy (line endings on Windows))
 - #56419 (Remove some uses of try!)
 - #56424 (Mention raw-ident syntax)

Failed merges:

r? @ghost
@bors

This comment has been minimized.

Contributor

bors commented Dec 2, 2018

🔒 Merge conflict

This pull request and the master branch diverged in a way that cannot be automatically merged. Please rebase on top of the latest master branch, and let the reviewer approve again.

How do I rebase?

Assuming self is your fork and upstream is this repository, you can resolve the conflict following these steps:

  1. git checkout _match-Matrix-SmallVec (switch to your branch)
  2. git fetch upstream master (retrieve the latest master)
  3. git rebase upstream/master -p (rebase on top of it)
  4. Follow the on-screen instruction to resolve conflicts (check git status if you got lost).
  5. git push self _match-Matrix-SmallVec --force-with-lease (update this PR)

You may also read Git Rebasing to Resolve Conflicts by Drew Blessing for a short tutorial.

Please avoid the "Resolve conflicts" button on GitHub. It uses git merge instead of git rebase which makes the PR commit history more difficult to read.

Sometimes step 4 will complete without asking for resolution. This is usually due to difference between how Cargo.lock conflict is handled during merge and rebase. This is normal, and you should still perform step 5 to update this PR.

Error message
warning: Cannot merge binary files: Cargo.lock (HEAD vs. heads/homu-tmp)
Auto-merging src/libsyntax_ext/Cargo.toml
Auto-merging src/librustc_mir/hair/pattern/check_match.rs
Auto-merging src/librustc/Cargo.toml
Auto-merging Cargo.lock
CONFLICT (content): Merge conflict in Cargo.lock
Automatic merge failed; fix conflicts and then commit the result.

@bors

This comment has been minimized.

Contributor

bors commented Dec 5, 2018

☔️ The latest upstream changes (presumably #55922) made this pull request unmergeable. Please resolve the merge conflicts.

@nnethercote nnethercote force-pushed the nnethercote:_match-Matrix-SmallVec branch from 123df63 to 642ad42 Dec 9, 2018

@nnethercote

This comment has been minimized.

Contributor

nnethercote commented Dec 9, 2018

I have rebased.

@bors r=simulacrum

@bors

This comment has been minimized.

Contributor

bors commented Dec 9, 2018

📌 Commit 642ad42 has been approved by simulacrum

@rust-highfive

This comment has been minimized.

Collaborator

rust-highfive commented Dec 9, 2018

The job x86_64-gnu-llvm-5.0 of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
travis_time:end:04144704:start=1544394824014681787,finish=1544394826168454948,duration=2153773161
$ git checkout -qf FETCH_HEAD
travis_fold:end:git.checkout

Encrypted environment variables have been removed for security reasons.
See https://docs.travis-ci.com/user/pull-requests/#Pull-Requests-and-Security-Restrictions
$ export SCCACHE_BUCKET=rust-lang-ci-sccache2
$ export SCCACHE_REGION=us-west-1
Setting environment variables from .travis.yml
$ export IMAGE=x86_64-gnu-llvm-5.0
---
[00:12:02]     --> src/librustc_mir/hair/pattern/_match.rs:1672:13
[00:12:02]      |
[00:12:02] 1672 | /             match *constructor {
[00:12:02] 1673 | |                 Slice(..) => {
[00:12:02] 1674 | |                     // we extract an `Option` for the pointer because slices of zero elements don't
[00:12:02] 1675 | |                     // necessarily point to memory, they are usually just integers. The only time
[00:12:02] 1738 | |                 }
[00:12:02] 1739 | |             }
[00:12:02]      | |_____________^ expected struct `std::vec::Vec`, found struct `smallvec::SmallVec`
[00:12:02]      |
[00:12:02]      |
[00:12:02]      = note: expected type `std::option::Option<std::vec::Vec<&hair::pattern::Pattern<'_>>>`
[00:12:02]                 found type `std::option::Option<smallvec::SmallVec<[&hair::pattern::Pattern<'_>; 2]>>`
[00:12:02] note: match arm with an incompatible type
[00:12:02]      |
[00:12:02] 1733 |                   _ => {
[00:12:02]      |  ______________________^
[00:12:02] 1734 | |                     // If the constructor is a:
[00:12:02] 1734 | |                     // If the constructor is a:
[00:12:02] 1735 | |                     //      Single value: add a row if the constructor equals the pattern.
[00:12:02] 1736 | |                     //      Range: add a row if the constructor contains the pattern.
[00:12:02] 1737 | |                     constructor_intersects_pattern(cx.tcx, constructor, pat)
[00:12:02]      | |_________________^
[00:12:02] 
[00:12:08] error: aborting due to previous error
[00:12:08] 
---
[00:13:35] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "build" "--target" "x86_64-unknown-linux-gnu" "-j" "4" "--release" "--locked" "--color" "always" "--features" "" "--manifest-path" "/checkout/src/rustc/Cargo.toml" "--message-format" "json"
[00:13:35] expected success, got: exit code: 101
[00:13:35] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap build
[00:13:35] Build completed unsuccessfully in 0:10:38
[00:13:35] make: *** [all] Error 1
[00:13:35] Makefile:28: recipe for target 'all' failed

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@Mark-Simulacrum

This comment has been minimized.

Member

Mark-Simulacrum commented Dec 9, 2018

@bors r-

Use a `SmallVec` within `_match::Matrix`.
This commit also fixes up lifetimes a bit:

- Renames `'a` as `'p` when used with `Matrix` and `Pattern`, for
  consistency.

- Removes some unnecessary `'p` lifetimes on some function arguments.

- Adds some missing lifetime parameters.

@nnethercote nnethercote force-pushed the nnethercote:_match-Matrix-SmallVec branch from 642ad42 to cdc6633 Dec 10, 2018

@nnethercote

This comment has been minimized.

Contributor

nnethercote commented Dec 10, 2018

I have updated. Just required changing a Vec::new to SmallVec::new.

@bors r=simulacrum

@bors

This comment has been minimized.

Contributor

bors commented Dec 10, 2018

📌 Commit cdc6633 has been approved by simulacrum

@bors

This comment has been minimized.

Contributor

bors commented Dec 10, 2018

⌛️ Testing commit cdc6633 with merge e2c329c...

bors added a commit that referenced this pull request Dec 10, 2018

Auto merge of #56269 - nnethercote:_match-Matrix-SmallVec, r=simulacrum
Use a `SmallVec` within `_match::Matrix`.

This avoids allocations.
@bors

This comment has been minimized.

Contributor

bors commented Dec 10, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: simulacrum
Pushing e2c329c to master...

@bors bors merged commit cdc6633 into rust-lang:master Dec 10, 2018

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details

@nnethercote nnethercote deleted the nnethercote:_match-Matrix-SmallVec branch Dec 10, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment