1
Fork 0

improve comments on GeneratorKind and AsyncGeneratorKind

This commit is contained in:
Niko Matsakis 2019-10-02 14:24:43 -04:00
parent 3ae4abbaa3
commit a999132113

View file

@ -1362,7 +1362,6 @@ impl Body {
} }
/// The type of source expression that caused this generator to be created. /// The type of source expression that caused this generator to be created.
// Not `IsAsync` because we want to eventually add support for `AsyncGen`
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, HashStable, #[derive(Clone, PartialEq, Eq, PartialOrd, Ord, HashStable,
RustcEncodable, RustcDecodable, Hash, Debug, Copy)] RustcEncodable, RustcDecodable, Hash, Debug, Copy)]
pub enum GeneratorKind { pub enum GeneratorKind {
@ -1382,8 +1381,11 @@ impl fmt::Display for GeneratorKind {
} }
} }
/// The type of source expression that caused this generator to be created. /// In the case of a generator created as part of an async construct,
// Not `IsAsync` because we want to eventually add support for `AsyncGen` /// which kind of async construct caused it to be created?
///
/// This helps error messages but is also used to drive coercions in
/// type-checking (see #60424).
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, HashStable, #[derive(Clone, PartialEq, Eq, PartialOrd, Ord, HashStable,
RustcEncodable, RustcDecodable, Hash, Debug, Copy)] RustcEncodable, RustcDecodable, Hash, Debug, Copy)]
pub enum AsyncGeneratorKind { pub enum AsyncGeneratorKind {