-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-NLLArea: Non-lexical lifetimes (NLL)Area: Non-lexical lifetimes (NLL)A-borrow-checkerArea: The borrow checkerArea: The borrow checkerA-coroutinesArea: CoroutinesArea: CoroutinesC-bugCategory: This is a bug.Category: This is a bug.F-coroutines`#![feature(coroutines)]``#![feature(coroutines)]`I-unsoundIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessT-typesRelevant to the types team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way.This issue requires a nightly compiler in some way.
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
A-NLLArea: Non-lexical lifetimes (NLL)Area: Non-lexical lifetimes (NLL)A-borrow-checkerArea: The borrow checkerArea: The borrow checkerA-coroutinesArea: CoroutinesArea: CoroutinesC-bugCategory: This is a bug.Category: This is a bug.F-coroutines`#![feature(coroutines)]``#![feature(coroutines)]`I-unsoundIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessT-typesRelevant to the types team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way.This issue requires a nightly compiler in some way.