You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**Example: `fn foo(x: &u32) -> &u32`** In addition, HIR might have information left out. This type
46
+
**Example: `fn foo(x: &u32) -> &u32`**
47
+
48
+
In addition, HIR might have information left out. This type
43
49
`&u32` is incomplete, since in the full Rust type there is actually a lifetime, but we didn’t need
44
50
to write those lifetimes. There are also some elision rules that insert information. The result may
45
51
look like `fn foo<'a>(x: &'a u32) -> &'a u32`.
@@ -56,23 +62,27 @@ Here is a summary:
56
62
| Describe the *syntax* of a type: what the user wrote (with some desugaring). | Describe the *semantics* of a type: the meaning of what the user wrote. |
57
63
| Each `rustc_hir::Ty` has its own spans corresponding to the appropriate place in the program. | Doesn’t correspond to a single place in the user’s program. |
58
64
|`rustc_hir::Ty` has generics and lifetimes; however, some of those lifetimes are special markers like [`LifetimeName::Implicit`][implicit]. |`ty::Ty` has the full type, including generics and lifetimes, even if the user left them out |
59
-
|`fn foo(x: u32) → u32 { }` - Two `rustc_hir::Ty` representing each usage of `u32`. Each has its own `Span`s, etc.-`rustc_hir::Ty` doesn’t tell us that both are the same type |`fn foo(x: u32) → u32 { }` - One `ty::Ty` for all instances of `u32` throughout the program.-`ty::Ty` tells us that both usages of `u32` mean the same type. |
60
-
|`fn foo(x: &u32) -> &u32)`- Two `rustc_hir::Ty` again.- Lifetimes for the references show up in the `rustc_hir::Ty`s using a special marker, [`LifetimeName::Implicit`][implicit]. |`fn foo(x: &u32) -> &u32)`- A single `ty::Ty`.- The `ty::Ty` has the hidden lifetime param |
65
+
|`fn foo(x: u32) → u32 { }` - Two `rustc_hir::Ty` representing each usage of `u32`, each has its own `Span`s, and`rustc_hir::Ty` doesn’t tell us that both are the same type |`fn foo(x: u32) → u32 { }` - One `ty::Ty` for all instances of `u32` throughout the program, and`ty::Ty` tells us that both usages of `u32` mean the same type. |
66
+
|`fn foo(x: &u32) -> &u32)`- Two `rustc_hir::Ty` again. Lifetimes for the references show up in the `rustc_hir::Ty`s using a special marker, [`LifetimeName::Implicit`][implicit]. |`fn foo(x: &u32) -> &u32)`- A single `ty::Ty`. The `ty::Ty` has the hidden lifetime param.|
0 commit comments