@@ -27,35 +27,35 @@ pub enum DepNode<D: Clone + Debug> {
2727 // During compilation, it is always `DefId`, but when serializing
2828 // it is mapped to `DefPath`.
2929
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.
4141 Krate ,
4242
43- // Represents the HIR node with the given node-id
43+ /// Represents the HIR node with the given node-id
4444 Hir ( D ) ,
4545
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.
4848 HirBody ( D ) ,
4949
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.
5252 MetaData ( D ) ,
5353
54- // Represents some piece of metadata global to its crate.
54+ /// Represents some piece of metadata global to its crate.
5555 GlobalMetaData ( D , GlobalMetaDataKind ) ,
5656
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.
5959 WorkProduct ( Arc < WorkProductId > ) ,
6060
6161 // Represents different phases in the compiler.
@@ -114,13 +114,13 @@ pub enum DepNode<D: Clone + Debug> {
114114 NeedsDrop ( D ) ,
115115 Layout ( D ) ,
116116
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.
124124 TraitImpls ( D ) ,
125125
126126 AllLocalTraitImpls ,
@@ -133,35 +133,35 @@ pub enum DepNode<D: Clone + Debug> {
133133 TraitItems ( D ) ,
134134 ReprHints ( D ) ,
135135
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.
161161 TraitSelect { trait_def_id : D , input_def_id : D } ,
162162
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.
165165 ProjectionCache { def_ids : Vec < D > } ,
166166
167167 ParamEnv ( D ) ,
0 commit comments