Skip to content

Commit 4a44436

Browse files
authored
Rollup merge of rust-lang#82857 - pierwill:edit-ast-lowering-lib, r=Dylan-DPC
Edit ructc_ast_lowering docs Fixes some punctuation and formatting; also makes some small wording changes.
2 parents 754ce94 + 6b2eb0e commit 4a44436

File tree

1 file changed

+9
-7
lines changed
  • compiler/rustc_ast_lowering/src

1 file changed

+9
-7
lines changed

Diff for: compiler/rustc_ast_lowering/src/lib.rs

+9-7
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
//! For the simpler lowering steps, IDs and spans should be preserved. Unlike
1313
//! expansion we do not preserve the process of lowering in the spans, so spans
1414
//! 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()`.
1616
//!
1717
//! You must ensure that IDs are unique. That means that you should only use the
1818
//! ID from an AST node in a single HIR node (you can assume that AST node-IDs
@@ -26,7 +26,7 @@
2626
//! span and spans don't need to be kept in order, etc. Where code is preserved
2727
//! by lowering, it should have the same span as in the AST. Where HIR nodes are
2828
//! 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
3030
//! get confused if the spans from leaf AST nodes occur in multiple places
3131
//! in the HIR, especially for multiple identifiers.
3232
@@ -95,7 +95,7 @@ struct LoweringContext<'a, 'hir: 'a> {
9595
/// librustc_middle is independent of the parser, we use dynamic dispatch here.
9696
nt_to_tokenstream: NtToTokenstream,
9797

98-
/// Used to allocate HIR nodes
98+
/// Used to allocate HIR nodes.
9999
arena: &'hir Arena<'hir>,
100100

101101
/// The items being lowered are collected here.
@@ -128,7 +128,7 @@ struct LoweringContext<'a, 'hir: 'a> {
128128
is_in_trait_impl: bool,
129129
is_in_dyn_type: bool,
130130

131-
/// What to do when we encounter either an "anonymous lifetime
131+
/// What to do when we encounter an "anonymous lifetime
132132
/// reference". The term "anonymous" is meant to encompass both
133133
/// `'_` lifetimes as well as fully elided cases where nothing is
134134
/// written at all (e.g., `&T` or `std::cell::Ref<T>`).
@@ -238,11 +238,13 @@ enum ImplTraitContext<'b, 'a> {
238238
OtherOpaqueTy {
239239
/// Set of lifetimes that this opaque type can capture, if it uses
240240
/// them. This includes lifetimes bound since we entered this context.
241-
/// For example, in
241+
/// For example:
242242
///
243+
/// ```
243244
/// type A<'b> = impl for<'a> Trait<'a, Out = impl Sized + 'a>;
245+
/// ```
244246
///
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
246248
/// need to capture `'b` because it already inherits the lifetime
247249
/// parameter from `A`.
248250
// FIXME(impl_trait): but `required_region_bounds` will ICE later
@@ -2110,7 +2112,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
21102112
hir::FnRetTy::Return(self.arena.alloc(opaque_ty))
21112113
}
21122114

2113-
/// Transforms `-> T` into `Future<Output = T>`
2115+
/// Transforms `-> T` into `Future<Output = T>`.
21142116
fn lower_async_fn_output_type_to_future_bound(
21152117
&mut self,
21162118
output: &FnRetTy,

0 commit comments

Comments
 (0)