Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from 2 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
f85b0c4
Remove use of `unwrap()` from save-analysis
JohnTitor Feb 24, 2020
a211a82
Address review comment
JohnTitor Feb 24, 2020
5307edc
Tweak tests
JohnTitor Feb 24, 2020
f9db3c2
Clean up unstable book
JohnTitor Feb 28, 2020
4c9e87e
Stop generating `compiler_builtins_lib` doc
JohnTitor Feb 29, 2020
c55df37
Make `rustc_attrs` tracking issue None
JohnTitor Feb 29, 2020
2746e12
check_binding_alt_eq_ty: improve precision wrt. `if let`.
Centril Mar 1, 2020
8ea676e
Update books
ehuss Mar 2, 2020
44c97c4
Fix & test leak of some BTreeMap nodes on panic during `into_iter`
ssomers Mar 6, 2020
33ebc20
Turn trailing tokens in `assert!()` into hard errors
LeSeulArtichaut Feb 28, 2020
1915bf1
resolve: `ImportDirective` -> `Import`
petrochenkov Mar 7, 2020
66d7a88
resolve: `directive` -> `import`
petrochenkov Mar 7, 2020
2e88bec
test(bindings_after_at): add dynamic drop tests for bindings_after_at
thekuom Mar 7, 2020
f459d2e
Rollup merge of #69422 - JohnTitor:remove-unwrap, r=Xanewok
Centril Mar 8, 2020
24757a8
Rollup merge of #69548 - LeSeulArtichaut:assert-errors, r=petrochenkov
Centril Mar 8, 2020
d4860fc
Rollup merge of #69561 - JohnTitor:clean-up-unstable-book, r=Mark-Sim…
Centril Mar 8, 2020
c717721
Rollup merge of #69599 - Centril:typeck-tweak-wording, r=davidtwco
Centril Mar 8, 2020
5adfa4b
Rollup merge of #69641 - ehuss:update-books, r=ehuss
Centril Mar 8, 2020
f497325
Rollup merge of #69776 - ssomers:fix69769, r=Mark-Simulacrum
Centril Mar 8, 2020
17b7791
Rollup merge of #69805 - petrochenkov:importname, r=Centril
Centril Mar 8, 2020
49c82d1
Rollup merge of #69810 - thekuom:test/67523-dynamic-semantics-binding…
Centril Mar 8, 2020
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
48 changes: 48 additions & 0 deletions src/test/ui/drop/dynamic-drop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#![feature(generators, generator_trait, untagged_unions)]
#![feature(move_ref_pattern)]
#![feature(bindings_after_at)]

#![allow(unused_assignments)]
#![allow(unused_variables)]
Expand Down Expand Up @@ -291,6 +292,44 @@ fn subslice_mixed_min_lengths(a: &Allocator, c: i32) {
}
}

fn bindings_after_at_dynamic_init_move(a: &Allocator, c: bool) {
let foo = if c { Some(a.alloc()) } else { None };
let _x;

if let bar @ Some(_) = foo {
_x = bar;
}
}

fn bindings_after_at_dynamic_init_ref(a: &Allocator, c: bool) {
let foo = if c { Some(a.alloc()) } else { None };
let _x;

if let bar @ Some(_baz) = &foo {
_x = bar;
}
}

fn bindings_after_at_dynamic_drop_move(a: &Allocator, c: bool) {
let foo = if c { Some(a.alloc()) } else { None };

if let bar @ Some(_) = foo {
bar
} else {
None
};
}

fn bindings_after_at_dynamic_drop_ref(a: &Allocator, c: bool) {
let foo = if c { Some(a.alloc()) } else { None };

if let bar @ Some(_baz) = &foo {
bar
} else {
&None
};
}

fn move_ref_pattern(a: &Allocator) {
let mut tup = (a.alloc(), a.alloc(), a.alloc(), a.alloc());
let (ref _a, ref mut _b, _c, mut _d) = tup;
Expand Down Expand Up @@ -471,5 +510,14 @@ fn main() {
run_test(|a| panic_after_init_temp(a));
run_test(|a| panic_after_init_by_loop(a));

run_test(|a| bindings_after_at_dynamic_init_move(a, true));
run_test(|a| bindings_after_at_dynamic_init_move(a, false));
run_test(|a| bindings_after_at_dynamic_init_ref(a, true));
run_test(|a| bindings_after_at_dynamic_init_ref(a, false));
run_test(|a| bindings_after_at_dynamic_drop_move(a, true));
run_test(|a| bindings_after_at_dynamic_drop_move(a, false));
run_test(|a| bindings_after_at_dynamic_drop_ref(a, true));
run_test(|a| bindings_after_at_dynamic_drop_ref(a, false));

run_test_nopanic(|a| union1(a));
}