]> git.lizzy.rs Git - rust.git/blob - tests/ui/generator/issue-52398.rs
Rollup merge of #106638 - RalfJung:realstd, r=thomcc
[rust.git] / tests / ui / generator / issue-52398.rs
1 // run-pass
2 #![allow(unused_variables)]
3
4 #![feature(generators)]
5
6 use std::cell::RefCell;
7
8 struct A;
9
10 impl A {
11     fn test(&self, a: ()) {}
12 }
13
14 fn main() {
15     // Test that the MIR local with type &A created for the auto-borrow adjustment
16     // is caught by typeck
17     move || { //~ WARN unused generator that must be used
18         A.test(yield);
19     };
20
21     // Test that the std::cell::Ref temporary returned from the `borrow` call
22     // is caught by typeck
23     let y = RefCell::new(true);
24     static move || { //~ WARN unused generator that must be used
25         yield *y.borrow();
26         return "Done";
27     };
28 }