Skip to content

Rollup of 14 pull requests #49875

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

Merged
merged 40 commits into from
Apr 12, 2018
Merged
Changes from 1 commit
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
7719f53
Replace `structurally_resolved_type` in casts check.
leoyvens Feb 16, 2018
7353ef7
Replace `structurally_resolve_type` in unary expr check.
leoyvens Feb 18, 2018
0a5a5c3
revert making casts atomic, test order dependency
leoyvens Mar 22, 2018
5152a6f
Stabilize `Option::filter`.
tmccombs Apr 2, 2018
c7ac32a
Remove uses of option_filter feature
tmccombs Apr 5, 2018
20c499d
Fix ICE with impl Trait
sinkuu Apr 6, 2018
d985344
proc_macro: Generalize `FromIterator` impl
alexcrichton Apr 6, 2018
b9e04e5
Print region in case of ICE
sinkuu Apr 8, 2018
5edfb53
Properly look for uninhabitedness of variants in niche-filling check
nox Apr 1, 2018
eacfb33
Convert sort_by_key to sort_by_cached_key
varkor Mar 30, 2018
d3fe534
Convert sort_unstable_by_key to sort_by_cached_key
varkor Mar 30, 2018
5cd0504
Convert sort_unstable_by to sort_by_cached_key
varkor Mar 30, 2018
57eedba
Convert sort_by to sort_by_cached_key
varkor Mar 30, 2018
1aa6152
Add trivial early return for sort_by_cached_key
varkor Mar 31, 2018
2cc52f0
Use cmp::Reverse instead of subtraction
varkor Mar 31, 2018
e7aa139
Use sort_by_cached_key for partitioning
varkor Apr 1, 2018
a1d90a2
in which the non-shorthand patterns lint keeps its own counsel in macros
zackmdavis Apr 3, 2018
d326beb
Stop emitting color codes on TERM=dumb
Mark-Simulacrum Apr 9, 2018
f62c210
add regression test for issue #16223: fixed by NLL
Apr 9, 2018
dab317f
Small nits to make couple of tests pass on mips targets.
Apr 3, 2018
1e5145d
Update ui test references.
Apr 5, 2018
0a94344
Add ignores for powerpc and s390x to target-feature-wrong.rs and upda…
Apr 10, 2018
18e9532
Add --enable-debug flag to musl CI build script
alecmocatta Apr 10, 2018
6e0089e
Do not uppercase-lint no_mangle statics
varkor Apr 10, 2018
5e53746
Fix "fp" feature for AArch64
Amanieu Apr 10, 2018
a648267
fixed typo
memoryleak47 Apr 10, 2018
77777b4
Rollup merge of #49525 - varkor:sort_by_cached_key-conversion, r=scot…
kennytm Apr 11, 2018
5ee5de1
Rollup merge of #49575 - tmccombs:option-filter-stabilize, r=withoutb…
kennytm Apr 11, 2018
63c4d50
Rollup merge of #49614 - zackmdavis:the_phantom_menace, r=petrochenkov
kennytm Apr 11, 2018
1bdb9a5
Rollup merge of #49665 - draganmladjenovic:mips_tests, r=nikomatsakis
kennytm Apr 11, 2018
f4b9fda
Rollup merge of #49781 - Robbepop:master, r=nikomatsakis
kennytm Apr 11, 2018
6eb66fc
Rollup merge of #49795 - nox:niche-with-uninhabited-fields, r=eddyb
kennytm Apr 11, 2018
4dbca4c
Rollup merge of #49809 - Mark-Simulacrum:no-color-for-dumb, r=alexcri…
kennytm Apr 11, 2018
0629309
Rollup merge of #49856 - varkor:no_mangle-statics-unlinted, r=michael…
kennytm Apr 11, 2018
7a70928
Rollup merge of #49863 - memoryleak47:andorid, r=oli-obk
kennytm Apr 11, 2018
dfdcf63
Rollup merge of #49857 - Amanieu:aarch64_fp, r=alexcrichton
kennytm Apr 11, 2018
57b15f6
Rollup merge of #49849 - alecmocatta:master, r=alexcrichton
kennytm Apr 11, 2018
574c050
Rollup merge of #49734 - alexcrichton:generalize-token-stream, r=niko…
kennytm Apr 11, 2018
484e6f0
Rollup merge of #49730 - sinkuu:fix_ice_49556, r=cramertj
kennytm Apr 11, 2018
9f6e5ae
Rollup merge of #48270 - leodasvacas:refactor-casts, r=nikomatsakis
kennytm Apr 11, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add regression test for issue #16223: fixed by NLL
  • Loading branch information
Hero committed Apr 9, 2018
commit f62c210d9012f45343bbe6148f897f77fbe50aa1
63 changes: 63 additions & 0 deletions src/test/ui/nll/issue-16223.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// Regression test for #16223: without NLL the `if let` construct together with
// the nested box-structure of `Root` causes an unwanted collateral move.

// The exact error prevented here is:
//
// error[E0382]: use of collaterally moved value: `(root.boxed.rhs as SomeVariant::B).0`
// --> src/main.rs:55:29
// |
// 56 | lhs: SomeVariant::A(a),
// | - value moved here
// 57 | rhs: SomeVariant::B(b),
// | ^ value used here after move
// |
// = note: move occurs because the value has type `A`, which does not implement the `Copy` trait

// must-compile-successfully

#![feature(nll)]
#![feature(box_patterns)]

struct Root {
boxed: Box<SetOfVariants>,
}

struct SetOfVariants {
lhs: SomeVariant,
rhs: SomeVariant,
}

enum SomeVariant {
A(A),
B(B),
}

struct A(String);
struct B(String);

fn main() {
let root = Root {
boxed: Box::new(SetOfVariants {
lhs: SomeVariant::A(A(String::from("This is A"))),
rhs: SomeVariant::B(B(String::from("This is B"))),
}),
};
if let box SetOfVariants {
lhs: SomeVariant::A(a),
rhs: SomeVariant::B(b),
} = root.boxed
{
println!("a = {}", a.0);
println!("b = {}", b.0);
}
}