2018-09-06 07:41:12 -05:00
|
|
|
// run-pass
|
2018-09-25 16:51:35 -05:00
|
|
|
#![allow(unused_variables)]
|
2018-09-06 07:41:12 -05:00
|
|
|
|
2018-08-06 05:03:51 -05:00
|
|
|
#![feature(generators)]
|
|
|
|
|
|
|
|
use std::cell::RefCell;
|
|
|
|
|
|
|
|
struct A;
|
|
|
|
|
|
|
|
impl A {
|
|
|
|
fn test(&self, a: ()) {}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
// Test that the MIR local with type &A created for the auto-borrow adjustment
|
|
|
|
// is caught by typeck
|
2020-07-27 19:00:00 -05:00
|
|
|
move || { //~ WARN unused generator that must be used
|
2018-08-06 05:03:51 -05:00
|
|
|
A.test(yield);
|
|
|
|
};
|
|
|
|
|
|
|
|
// Test that the std::cell::Ref temporary returned from the `borrow` call
|
|
|
|
// is caught by typeck
|
|
|
|
let y = RefCell::new(true);
|
2020-07-27 19:00:00 -05:00
|
|
|
static move || { //~ WARN unused generator that must be used
|
2018-08-06 05:03:51 -05:00
|
|
|
yield *y.borrow();
|
|
|
|
return "Done";
|
|
|
|
};
|
|
|
|
}
|