@@ -29,18 +29,18 @@ In contrast, `ty::Ty` represents the semantics of a type, that is, the *meaning*
29
29
wrote. For example, ` rustc_hir::Ty ` would record the fact that a user used the name ` u32 ` twice
30
30
in their program, but the ` ty::Ty ` would record the fact that both usages refer to the same type.
31
31
32
- ** Example: ` fn foo(x: u32) → u32 { } ` ** In this function we see that ` u32 ` appears twice. We know
32
+ ** Example: ` fn foo(x: u32) → u32 { x } ` ** In this function we see that ` u32 ` appears twice. We know
33
33
that that is the same type, i.e. the function takes an argument and returns an argument of the same
34
34
type, but from the point of view of the HIR there would be two distinct type instances because these
35
35
are occurring in two different places in the program. That is, they have two
36
36
different [ ` Span ` s] [ span ] (locations).
37
37
38
38
[ span ] : https://doc.rust-lang.org/nightly/nightly-rustc/rustc_span/struct.Span.html
39
39
40
- ** Example: ` fn foo(x: &u32) -> &u32) ` ** In addition, HIR might have information left out. This type
40
+ ** Example: ` fn foo(x: &u32) -> &u32 ` ** In addition, HIR might have information left out. This type
41
41
` &u32 ` is incomplete, since in the full rust type there is actually a lifetime, but we didn’t need
42
42
to write those lifetimes. There are also some elision rules that insert information. The result may
43
- look like ` fn foo<'a>(x: &'a u32) -> &'a u32) ` .
43
+ look like ` fn foo<'a>(x: &'a u32) -> &'a u32 ` .
44
44
45
45
In the HIR level, these things are not spelled out and you can say the picture is rather incomplete.
46
46
However, at the ` ty::Ty ` level, these details are added and it is complete. Moreover, we will have
0 commit comments