]> git.lizzy.rs Git - rust.git/blob - src/test/ui/generator/issue-52398.rs
Auto merge of #98051 - davidtwco:split-dwarf-stabilization, r=wesleywiser
[rust.git] / src / test / 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 }