]>
Commit | Line | Data |
---|---|---|
0531ce1d XL |
1 | // Copyright 2018 The Rust Project Developers. See the COPYRIGHT |
2 | // file at the top-level directory of this distribution and at | |
3 | // http://rust-lang.org/COPYRIGHT. | |
4 | // | |
5 | // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | |
6 | // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | |
7 | // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | |
8 | // option. This file may not be copied, modified, or distributed | |
9 | // except according to those terms. | |
10 | ||
0531ce1d XL |
11 | // run-pass |
12 | ||
b7449926 | 13 | #![feature(generators)] |
0531ce1d | 14 | |
b7449926 | 15 | use std::cell::RefCell; |
0531ce1d | 16 | |
b7449926 | 17 | struct A; |
0531ce1d | 18 | |
b7449926 XL |
19 | impl A { |
20 | fn test(&self, a: ()) {} | |
0531ce1d XL |
21 | } |
22 | ||
0531ce1d | 23 | fn main() { |
b7449926 XL |
24 | // Test that the MIR local with type &A created for the auto-borrow adjustment |
25 | // is caught by typeck | |
26 | move || { | |
27 | A.test(yield); | |
28 | }; | |
29 | ||
30 | // Test that the std::cell::Ref temporary returned from the `borrow` call | |
31 | // is caught by typeck | |
32 | let y = RefCell::new(true); | |
33 | static move || { | |
34 | yield *y.borrow(); | |
35 | return "Done"; | |
36 | }; | |
0531ce1d | 37 | } |