Skip to content
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

add regression test for #16223 (NLL): use of collaterally moved value #49781

Merged
merged 1 commit into from
Apr 12, 2018

Conversation

Robbepop
Copy link
Contributor

@Robbepop Robbepop commented Apr 8, 2018

Adds regression test for #16223 which NLL fixes.

The current downside of this test is that it uses the #![feature(box_patterns)] and I haven't come up with a proper test that only uses the #![feature(nll)] - however, I don't know if this is even possible to test without #![feature(box_syntax)] or #![feature(box_patterns)].

@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @nikomatsakis (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 8, 2018
@TimNN
Copy link
Contributor

TimNN commented Apr 8, 2018

Your PR failed on Travis. 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.
[00:00:29] configure: rust.quiet-tests     := True
---
121636 ./obj/build/bootstrap/debug/incremental/bootstrap-351vorei3hhuv/s-ezxa4aw5hk-1t5fayr-1a7xax1ixldkk

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.

if let box SetOfVariants {
lhs: SomeVariant::A(a),
rhs: SomeVariant::B(b),
} = root.boxed
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use *root.boxed here if you want to avoid the box pattern.

Copy link
Contributor Author

@Robbepop Robbepop Apr 9, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the code review!

Your suggested code works and maybe this test should go with a dereference.

I haven't dereferenced root.boxed because it covers a nice use case where the entire root.boxed is only conditionally moved into the then-case of the if and otherwise can be further processed - this is not possible if you explicitely dereference it.

I use this convenience a lot in my current project and at least to me it would be nice if this functionality was tested, too.

@nikomatsakis
Copy link
Contributor

@bors r+ rollup

Thanks!

@bors
Copy link
Contributor

bors commented Apr 10, 2018

📌 Commit f62c210 has been approved by nikomatsakis

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 10, 2018
kennytm added a commit to kennytm/rust that referenced this pull request Apr 11, 2018
add regression test for rust-lang#16223 (NLL): use of collaterally moved value

Adds regression test for rust-lang#16223 which NLL fixes.

The current downside of this test is that it uses the `#![feature(box_patterns)]` and I haven't come up with a proper test that only uses the `#![feature(nll)]` - however, I don't know if this is even possible to test without `#![feature(box_syntax)]` or `#![feature(box_patterns)]`.
bors added a commit that referenced this pull request Apr 11, 2018
Rollup of 14 pull requests

Successful merges:

 - #49525 (Use sort_by_cached_key where appropriate)
 - #49575 (Stabilize `Option::filter`.)
 - #49614 (in which the non-shorthand patterns lint keeps its own counsel in macros)
 - #49665 (Small nits to make couple of tests pass on mips targets.)
 - #49781 (add regression test for #16223 (NLL): use of collaterally moved value)
 - #49795 (Properly look for uninhabitedness of variants in niche-filling check)
 - #49809 (Stop emitting color codes on TERM=dumb)
 - #49856 (Do not uppercase-lint #[no_mangle] statics)
 - #49863 (fixed typo)
 - #49857 (Fix "fp" target feature for AArch64)
 - #49849 (Add --enable-debug flag to musl CI build script)
 - #49734 (proc_macro: Generalize `FromIterator` impl)
 - #49730 (Fix ICE with impl Trait)
 - #48270 (Replace `structurally_resolved_type` in casts check.)

Failed merges:
@bors bors merged commit f62c210 into rust-lang:master Apr 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants