2018-09-06 14:41:12 +02:00
|
|
|
//@ run-pass
|
2018-09-25 23:51:35 +02:00
|
|
|
#![allow(unused_variables)]
|
2018-09-06 14:41:12 +02:00
|
|
|
|
2023-10-19 21:46:28 +00:00
|
|
|
#![feature(coroutines)]
|
2018-08-06 12:03:51 +02:00
|
|
|
|
|
|
|
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
|
2024-04-11 13:15:34 +00:00
|
|
|
#[coroutine] move || { //~ WARN unused coroutine that must be used
|
2018-08-06 12:03:51 +02: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);
|
2024-04-11 13:15:34 +00:00
|
|
|
#[coroutine] static move || { //~ WARN unused coroutine that must be used
|
2018-08-06 12:03:51 +02:00
|
|
|
yield *y.borrow();
|
|
|
|
return "Done";
|
|
|
|
};
|
|
|
|
}
|