Skip to content

Commit fe217c2

Browse files
committed
Auto merge of rust-lang#102292 - fee1-dead-contrib:rollup-61ptdkt, r=fee1-dead
Rollup of 4 pull requests Successful merges: - rust-lang#101851 (Clean up (sub)diagnostic derives) - rust-lang#102244 (Only generate closure def id for async fns with body) - rust-lang#102263 (Clarify Iterator::rposition code example) - rust-lang#102280 (rustdoc: clean up `.out-of-band`/`.in-band` CSS) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents 3288d3a + a7d45de commit fe217c2

File tree

77 files changed

+1097
-940
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+1097
-940
lines changed

compiler/rustc_ast_lowering/src/item.rs

+6-7
Original file line numberDiff line numberDiff line change
@@ -1055,9 +1055,9 @@ impl<'hir> LoweringContext<'_, 'hir> {
10551055
asyncness: Async,
10561056
body: Option<&Block>,
10571057
) -> hir::BodyId {
1058-
let closure_id = match asyncness {
1059-
Async::Yes { closure_id, .. } => closure_id,
1060-
Async::No => return self.lower_fn_body_block(span, decl, body),
1058+
let (closure_id, body) = match (asyncness, body) {
1059+
(Async::Yes { closure_id, .. }, Some(body)) => (closure_id, body),
1060+
_ => return self.lower_fn_body_block(span, decl, body),
10611061
};
10621062

10631063
self.lower_body(|this| {
@@ -1199,16 +1199,15 @@ impl<'hir> LoweringContext<'_, 'hir> {
11991199
parameters.push(new_parameter);
12001200
}
12011201

1202-
let body_span = body.map_or(span, |b| b.span);
12031202
let async_expr = this.make_async_expr(
12041203
CaptureBy::Value,
12051204
closure_id,
12061205
None,
1207-
body_span,
1206+
body.span,
12081207
hir::AsyncGeneratorKind::Fn,
12091208
|this| {
12101209
// Create a block from the user's function body:
1211-
let user_body = this.lower_block_expr_opt(body_span, body);
1210+
let user_body = this.lower_block_expr(body);
12121211

12131212
// Transform into `drop-temps { <user-body> }`, an expression:
12141213
let desugared_span =
@@ -1240,7 +1239,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
12401239

12411240
(
12421241
this.arena.alloc_from_iter(parameters),
1243-
this.expr(body_span, async_expr, AttrVec::new()),
1242+
this.expr(body.span, async_expr, AttrVec::new()),
12441243
)
12451244
})
12461245
}

compiler/rustc_macros/src/diagnostics/diagnostic_builder.rs

+165-323
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)