Closed
Description
I tried this code:
#![feature(coroutine_trait)]
#![feature(coroutines)]
use std::ops::Coroutine;
struct Invariant<'a>(fn(&'a ()) -> &'a ());
fn x<'a, 'b>() -> impl Coroutine<Invariant<'a>> {
|_: Invariant<'a>| {
let a: Invariant<'b> = yield ();
}
}
I expected to see compilation fail, since Invariant<'a>
is not a subtype of Invariant<'b>
.
Instead, compilation succeeded ❗
Metadata
Metadata
Assignees
Labels
Area: Non-lexical lifetimes (NLL)Area: The borrow checkerArea: CoroutinesCategory: This is a bug.`#![feature(coroutines)]`Issue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessRelevant to the types team, which will review and decide on the PR/issue.This issue requires a nightly compiler in some way.