|
12 | 12 | //! For the simpler lowering steps, IDs and spans should be preserved. Unlike
|
13 | 13 | //! expansion we do not preserve the process of lowering in the spans, so spans
|
14 | 14 | //! should not be modified here. When creating a new node (as opposed to
|
15 |
| -//! 'folding' an existing one), then you create a new ID using `next_id()`. |
| 15 | +//! "folding" an existing one), create a new ID using `next_id()`. |
16 | 16 | //!
|
17 | 17 | //! You must ensure that IDs are unique. That means that you should only use the
|
18 | 18 | //! ID from an AST node in a single HIR node (you can assume that AST node-IDs
|
|
26 | 26 | //! span and spans don't need to be kept in order, etc. Where code is preserved
|
27 | 27 | //! by lowering, it should have the same span as in the AST. Where HIR nodes are
|
28 | 28 | //! new it is probably best to give a span for the whole AST node being lowered.
|
29 |
| -//! All nodes should have real spans, don't use dummy spans. Tools are likely to |
| 29 | +//! All nodes should have real spans; don't use dummy spans. Tools are likely to |
30 | 30 | //! get confused if the spans from leaf AST nodes occur in multiple places
|
31 | 31 | //! in the HIR, especially for multiple identifiers.
|
32 | 32 |
|
@@ -95,7 +95,7 @@ struct LoweringContext<'a, 'hir: 'a> {
|
95 | 95 | /// librustc_middle is independent of the parser, we use dynamic dispatch here.
|
96 | 96 | nt_to_tokenstream: NtToTokenstream,
|
97 | 97 |
|
98 |
| - /// Used to allocate HIR nodes |
| 98 | + /// Used to allocate HIR nodes. |
99 | 99 | arena: &'hir Arena<'hir>,
|
100 | 100 |
|
101 | 101 | /// The items being lowered are collected here.
|
@@ -128,7 +128,7 @@ struct LoweringContext<'a, 'hir: 'a> {
|
128 | 128 | is_in_trait_impl: bool,
|
129 | 129 | is_in_dyn_type: bool,
|
130 | 130 |
|
131 |
| - /// What to do when we encounter either an "anonymous lifetime |
| 131 | + /// What to do when we encounter an "anonymous lifetime |
132 | 132 | /// reference". The term "anonymous" is meant to encompass both
|
133 | 133 | /// `'_` lifetimes as well as fully elided cases where nothing is
|
134 | 134 | /// written at all (e.g., `&T` or `std::cell::Ref<T>`).
|
@@ -238,11 +238,13 @@ enum ImplTraitContext<'b, 'a> {
|
238 | 238 | OtherOpaqueTy {
|
239 | 239 | /// Set of lifetimes that this opaque type can capture, if it uses
|
240 | 240 | /// them. This includes lifetimes bound since we entered this context.
|
241 |
| - /// For example, in |
| 241 | + /// For example: |
242 | 242 | ///
|
| 243 | + /// ``` |
243 | 244 | /// type A<'b> = impl for<'a> Trait<'a, Out = impl Sized + 'a>;
|
| 245 | + /// ``` |
244 | 246 | ///
|
245 |
| - /// the inner opaque type captures `'a` because it uses it. It doesn't |
| 247 | + /// Here the inner opaque type captures `'a` because it uses it. It doesn't |
246 | 248 | /// need to capture `'b` because it already inherits the lifetime
|
247 | 249 | /// parameter from `A`.
|
248 | 250 | // FIXME(impl_trait): but `required_region_bounds` will ICE later
|
@@ -2110,7 +2112,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
|
2110 | 2112 | hir::FnRetTy::Return(self.arena.alloc(opaque_ty))
|
2111 | 2113 | }
|
2112 | 2114 |
|
2113 |
| - /// Transforms `-> T` into `Future<Output = T>` |
| 2115 | + /// Transforms `-> T` into `Future<Output = T>`. |
2114 | 2116 | fn lower_async_fn_output_type_to_future_bound(
|
2115 | 2117 | &mut self,
|
2116 | 2118 | output: &FnRetTy,
|
|
0 commit comments