@@ -27,35 +27,35 @@ pub enum DepNode<D: Clone + Debug> {
27
27
// During compilation, it is always `DefId`, but when serializing
28
28
// it is mapped to `DefPath`.
29
29
30
- // Represents the `Krate` as a whole (the `hir::Krate` value) (as
31
- // distinct from the krate module). This is basically a hash of
32
- // the entire krate, so if you read from `Krate` (e.g., by calling
33
- // `tcx.hir.krate()`), we will have to assume that any change
34
- // means that you need to be recompiled. This is because the
35
- // `Krate` value gives you access to all other items. To avoid
36
- // this fate, do not call `tcx.hir.krate()`; instead, prefer
37
- // wrappers like `tcx.visit_all_items_in_krate()`. If there is no
38
- // suitable wrapper, you can use `tcx.dep_graph.ignore()` to gain
39
- // access to the krate, but you must remember to add suitable
40
- // edges yourself for the individual items that you read.
30
+ /// Represents the `Krate` as a whole (the `hir::Krate` value) (as
31
+ /// distinct from the krate module). This is basically a hash of
32
+ /// the entire krate, so if you read from `Krate` (e.g., by calling
33
+ /// `tcx.hir.krate()`), we will have to assume that any change
34
+ /// means that you need to be recompiled. This is because the
35
+ /// `Krate` value gives you access to all other items. To avoid
36
+ /// this fate, do not call `tcx.hir.krate()`; instead, prefer
37
+ /// wrappers like `tcx.visit_all_items_in_krate()`. If there is no
38
+ /// suitable wrapper, you can use `tcx.dep_graph.ignore()` to gain
39
+ /// access to the krate, but you must remember to add suitable
40
+ /// edges yourself for the individual items that you read.
41
41
Krate ,
42
42
43
- // Represents the HIR node with the given node-id
43
+ /// Represents the HIR node with the given node-id
44
44
Hir ( D ) ,
45
45
46
- // Represents the body of a function or method. The def-id is that of the
47
- // function/method.
46
+ /// Represents the body of a function or method. The def-id is that of the
47
+ /// function/method.
48
48
HirBody ( D ) ,
49
49
50
- // Represents the metadata for a given HIR node, typically found
51
- // in an extern crate.
50
+ /// Represents the metadata for a given HIR node, typically found
51
+ /// in an extern crate.
52
52
MetaData ( D ) ,
53
53
54
- // Represents some piece of metadata global to its crate.
54
+ /// Represents some piece of metadata global to its crate.
55
55
GlobalMetaData ( D , GlobalMetaDataKind ) ,
56
56
57
- // Represents some artifact that we save to disk. Note that these
58
- // do not have a def-id as part of their identifier.
57
+ /// Represents some artifact that we save to disk. Note that these
58
+ /// do not have a def-id as part of their identifier.
59
59
WorkProduct ( Arc < WorkProductId > ) ,
60
60
61
61
// Represents different phases in the compiler.
@@ -114,13 +114,13 @@ pub enum DepNode<D: Clone + Debug> {
114
114
NeedsDrop ( D ) ,
115
115
Layout ( D ) ,
116
116
117
- // The set of impls for a given trait. Ultimately, it would be
118
- // nice to get more fine-grained here (e.g., to include a
119
- // simplified type), but we can't do that until we restructure the
120
- // HIR to distinguish the *header* of an impl from its body. This
121
- // is because changes to the header may change the self-type of
122
- // the impl and hence would require us to be more conservative
123
- // than changes in the impl body.
117
+ /// The set of impls for a given trait. Ultimately, it would be
118
+ /// nice to get more fine-grained here (e.g., to include a
119
+ /// simplified type), but we can't do that until we restructure the
120
+ /// HIR to distinguish the *header* of an impl from its body. This
121
+ /// is because changes to the header may change the self-type of
122
+ /// the impl and hence would require us to be more conservative
123
+ /// than changes in the impl body.
124
124
TraitImpls ( D ) ,
125
125
126
126
AllLocalTraitImpls ,
@@ -133,35 +133,35 @@ pub enum DepNode<D: Clone + Debug> {
133
133
TraitItems ( D ) ,
134
134
ReprHints ( D ) ,
135
135
136
- // Trait selection cache is a little funny. Given a trait
137
- // reference like `Foo: SomeTrait<Bar>`, there could be
138
- // arbitrarily many def-ids to map on in there (e.g., `Foo`,
139
- // `SomeTrait`, `Bar`). We could have a vector of them, but it
140
- // requires heap-allocation, and trait sel in general can be a
141
- // surprisingly hot path. So instead we pick two def-ids: the
142
- // trait def-id, and the first def-id in the input types. If there
143
- // is no def-id in the input types, then we use the trait def-id
144
- // again. So for example:
145
- //
146
- // - `i32: Clone` -> `TraitSelect { trait_def_id: Clone, self_def_id: Clone }`
147
- // - `u32: Clone` -> `TraitSelect { trait_def_id: Clone, self_def_id: Clone }`
148
- // - `Clone: Clone` -> `TraitSelect { trait_def_id: Clone, self_def_id: Clone }`
149
- // - `Vec<i32>: Clone` -> `TraitSelect { trait_def_id: Clone, self_def_id: Vec }`
150
- // - `String: Clone` -> `TraitSelect { trait_def_id: Clone, self_def_id: String }`
151
- // - `Foo: Trait<Bar>` -> `TraitSelect { trait_def_id: Trait, self_def_id: Foo }`
152
- // - `Foo: Trait<i32>` -> `TraitSelect { trait_def_id: Trait, self_def_id: Foo }`
153
- // - `(Foo, Bar): Trait` -> `TraitSelect { trait_def_id: Trait, self_def_id: Foo }`
154
- // - `i32: Trait<Foo>` -> `TraitSelect { trait_def_id: Trait, self_def_id: Foo }`
155
- //
156
- // You can see that we map many trait refs to the same
157
- // trait-select node. This is not a problem, it just means
158
- // imprecision in our dep-graph tracking. The important thing is
159
- // that for any given trait-ref, we always map to the **same**
160
- // trait-select node.
136
+ /// Trait selection cache is a little funny. Given a trait
137
+ /// reference like `Foo: SomeTrait<Bar>`, there could be
138
+ /// arbitrarily many def-ids to map on in there (e.g., `Foo`,
139
+ /// `SomeTrait`, `Bar`). We could have a vector of them, but it
140
+ /// requires heap-allocation, and trait sel in general can be a
141
+ /// surprisingly hot path. So instead we pick two def-ids: the
142
+ /// trait def-id, and the first def-id in the input types. If there
143
+ /// is no def-id in the input types, then we use the trait def-id
144
+ /// again. So for example:
145
+ ///
146
+ /// - `i32: Clone` -> `TraitSelect { trait_def_id: Clone, self_def_id: Clone }`
147
+ /// - `u32: Clone` -> `TraitSelect { trait_def_id: Clone, self_def_id: Clone }`
148
+ /// - `Clone: Clone` -> `TraitSelect { trait_def_id: Clone, self_def_id: Clone }`
149
+ /// - `Vec<i32>: Clone` -> `TraitSelect { trait_def_id: Clone, self_def_id: Vec }`
150
+ /// - `String: Clone` -> `TraitSelect { trait_def_id: Clone, self_def_id: String }`
151
+ /// - `Foo: Trait<Bar>` -> `TraitSelect { trait_def_id: Trait, self_def_id: Foo }`
152
+ /// - `Foo: Trait<i32>` -> `TraitSelect { trait_def_id: Trait, self_def_id: Foo }`
153
+ /// - `(Foo, Bar): Trait` -> `TraitSelect { trait_def_id: Trait, self_def_id: Foo }`
154
+ /// - `i32: Trait<Foo>` -> `TraitSelect { trait_def_id: Trait, self_def_id: Foo }`
155
+ ///
156
+ /// You can see that we map many trait refs to the same
157
+ /// trait-select node. This is not a problem, it just means
158
+ /// imprecision in our dep-graph tracking. The important thing is
159
+ /// that for any given trait-ref, we always map to the **same**
160
+ /// trait-select node.
161
161
TraitSelect { trait_def_id : D , input_def_id : D } ,
162
162
163
- // For proj. cache, we just keep a list of all def-ids, since it is
164
- // not a hotspot.
163
+ /// For proj. cache, we just keep a list of all def-ids, since it is
164
+ /// not a hotspot.
165
165
ProjectionCache { def_ids : Vec < D > } ,
166
166
167
167
ParamEnv ( D ) ,
0 commit comments