Skip to content

Commit

Permalink
Auto merge of #102292 - fee1-dead-contrib:rollup-61ptdkt, r=fee1-dead
Browse files Browse the repository at this point in the history
Rollup of 4 pull requests

Successful merges:

 - #101851 (Clean up (sub)diagnostic derives)
 - #102244 (Only generate closure def id for async fns with body)
 - #102263 (Clarify Iterator::rposition code example)
 - #102280 (rustdoc: clean up `.out-of-band`/`.in-band` CSS)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
  • Loading branch information
bors committed Sep 26, 2022
2 parents 3288d3a + a7d45de commit fe217c2
Show file tree
Hide file tree
Showing 77 changed files with 1,097 additions and 940 deletions.
13 changes: 6 additions & 7 deletions compiler/rustc_ast_lowering/src/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1055,9 +1055,9 @@ impl<'hir> LoweringContext<'_, 'hir> {
asyncness: Async,
body: Option<&Block>,
) -> hir::BodyId {
let closure_id = match asyncness {
Async::Yes { closure_id, .. } => closure_id,
Async::No => return self.lower_fn_body_block(span, decl, body),
let (closure_id, body) = match (asyncness, body) {
(Async::Yes { closure_id, .. }, Some(body)) => (closure_id, body),
_ => return self.lower_fn_body_block(span, decl, body),
};

self.lower_body(|this| {
Expand Down Expand Up @@ -1199,16 +1199,15 @@ impl<'hir> LoweringContext<'_, 'hir> {
parameters.push(new_parameter);
}

let body_span = body.map_or(span, |b| b.span);
let async_expr = this.make_async_expr(
CaptureBy::Value,
closure_id,
None,
body_span,
body.span,
hir::AsyncGeneratorKind::Fn,
|this| {
// Create a block from the user's function body:
let user_body = this.lower_block_expr_opt(body_span, body);
let user_body = this.lower_block_expr(body);

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

(
this.arena.alloc_from_iter(parameters),
this.expr(body_span, async_expr, AttrVec::new()),
this.expr(body.span, async_expr, AttrVec::new()),
)
})
}
Expand Down
488 changes: 165 additions & 323 deletions compiler/rustc_macros/src/diagnostics/diagnostic_builder.rs

Large diffs are not rendered by default.

Loading

0 comments on commit fe217c2

Please sign in to comment.