2018-09-06 12:41:12 +00:00
|
|
|
// run-pass
|
2018-09-25 21:51:35 +00:00
|
|
|
#![allow(unused_variables)]
|
2018-09-06 12:41:12 +00:00
|
|
|
|
2018-08-06 10:03:51 +00: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-28 00:00:00 +00:00
|
|
|
move || { //~ WARN unused generator that must be used
|
2018-08-06 10:03:51 +00: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-28 00:00:00 +00:00
|
|
|
static move || { //~ WARN unused generator that must be used
|
2018-08-06 10:03:51 +00:00
|
|
|
yield *y.borrow();
|
|
|
|
return "Done";
|
|
|
|
};
|
|
|
|
}
|