Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 4 pull requests #102292

Merged
merged 19 commits into from
Sep 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
adcc55d
Cleanups in SessionDiagnostic derive
Xiretza Sep 10, 2022
2e72387
Ensure code= in #[suggestion(...)] is only set once
Xiretza Sep 10, 2022
ec85a1b
Ensure #[suggestion] is only applied to correct tuple types
Xiretza Sep 10, 2022
efb20bc
Point to previous applicability when declared multiple times
Xiretza Sep 10, 2022
d4a1a6f
Make SetOnce nicer to use
Xiretza Sep 11, 2022
e7251cc
Extract subdiagnostic attribute parsing
Xiretza Sep 12, 2022
57679fb
Better error recovery in Subdiagnostic derive
Xiretza Sep 12, 2022
ae56d2a
Add missing code="" attributes to suggestion subdiagnostics
Xiretza Sep 14, 2022
336a72a
Unify subdiagnostic attribute parsing
Xiretza Sep 14, 2022
a20672c
Clarify Iterator::rposition code example
GuillaumeGomez Sep 25, 2022
a7c25b2
rustdoc: clean up `.out-of-band`/`.in-band` CSS
notriddle Sep 25, 2022
4ba4031
rustdoc: update test cases now that code-header is used without in-band
notriddle Sep 25, 2022
a50081e
Round offset to whole integer
notriddle Sep 25, 2022
730ead8
Only generate closure def id for async fns with body
compiler-errors Sep 24, 2022
e99f6fe
Only lower async fn body if it actually has a body
compiler-errors Sep 24, 2022
1a93028
Rollup merge of #101851 - Xiretza:diagnostic-derive-cleanups, r=david…
fee1-dead Sep 26, 2022
c807277
Rollup merge of #102244 - compiler-errors:issue-102219, r=cjgillot
fee1-dead Sep 26, 2022
beb2240
Rollup merge of #102263 - GuillaumeGomez:iterator-rposition-example, …
fee1-dead Sep 26, 2022
a7d45de
Rollup merge of #102280 - notriddle:notriddle/band, r=GuillaumeGomez
fee1-dead Sep 26, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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