Skip to content

Commit 744feb7

Browse files
Rollup merge of #152968 - khyperia:regionkind-comment, r=BoxyUwU
Flip "region lattice" in RegionKind doc comment If we assume that references take their region covariantly, and use that to define the subtyping relationship of regions, `'empty` is ⊤ (top) and `'static` is ⊥ (bottom), and that `'a <: 'b` is defined as `'a >= 'b`. However, the RegionKind doc comment's "region lattice" had `'static` at Top. While this is perhaps technically correct (a so-called "region lattice" is not a "type lattice"), it confused me a lot, and took me half an hour to be like "no, ok, I *do* understand things correctly, this region lattice is just flipped from the subtype lattice". Seems better to just have them be the same! I also took the opportunity to rewrite some parts of the comment with notes that would have helped me when starting out. Bikesheds welcome (as long as they don't go on forever)! For context: the comment "`'static` is Top" was [written in 2013](rust-lang/rust@a896440#diff-8780054cdf09361c4ac2540c7f544ecfdc52a9e610822aabb8bcd2964affcb1cR430), before there was a [discussion in 2014](rust-lang/rust#15699) that clarified that references take their regions covariantly, and `'a <: 'b` is defined as `'a >= 'b`. See also Zulip thread: https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/RegionKind.20rustc.20doc.20comment
2 parents 8d29c14 + ce2b5dd commit 744feb7

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/early-late-parameters.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33

44
> **NOTE**: This chapter largely talks about early/late bound as being solely relevant when discussing function item types/function definitions. This is potentially not completely true, async blocks and closures should likely be discussed somewhat in this chapter.
55
6+
See also these blog posts from when the distinction between early and late bound parameters was
7+
introduced: [Intermingled parameter lists] and [Intermingled parameter lists, take 2].
8+
9+
[Intermingled parameter lists]: https://smallcultfollowing.com/babysteps/blog/2013/10/29/intermingled-parameter-lists/
10+
[Intermingled parameter lists, take 2]: https://smallcultfollowing.com/babysteps/blog/2013/11/04/intermingled-parameter-lists/
11+
612
## What does it mean to be "early" bound or "late" bound
713

814
Every function definition has a corresponding ZST that implements the `Fn*` traits known as a [function item type][function_item_type]. This part of the chapter will talk a little bit about the "desugaring" of function item types as it is useful context for explaining the difference between early bound and late bound generic parameters.

0 commit comments

Comments
 (0)