Skip to content

Commit a4cec97

Browse files
committedJun 15, 2022
Auto merge of #98131 - JohnTitor:rollup-c17vjdy, r=JohnTitor
Rollup of 3 pull requests Successful merges: - #95118 (Implement stabilization of `#[feature(io_safety)]`.) - #98110 (Make `ExprKind::Closure` a struct variant.) - #98115 (Remove `rustc_deprecated` diagnostics) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents ebe184a + b1e5472 commit a4cec97

File tree

96 files changed

+563
-537
lines changed

Some content is hidden

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

96 files changed

+563
-537
lines changed
 

‎compiler/rustc_ast_lowering/src/expr.rs

+20-20
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
577577
};
578578

579579
// The closure/generator `FnDecl` takes a single (resume) argument of type `input_ty`.
580-
let decl = self.arena.alloc(hir::FnDecl {
580+
let fn_decl = self.arena.alloc(hir::FnDecl {
581581
inputs: arena_vec![self; input_ty],
582582
output,
583583
c_variadic: false,
@@ -598,7 +598,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
598598
};
599599
let params = arena_vec![self; param];
600600

601-
let body_id = self.lower_body(move |this| {
601+
let body = self.lower_body(move |this| {
602602
this.generator_kind = Some(hir::GeneratorKind::Async(async_gen_kind));
603603

604604
let old_ctx = this.task_context;
@@ -609,13 +609,13 @@ impl<'hir> LoweringContext<'_, 'hir> {
609609
});
610610

611611
// `static |_task_context| -> <ret_ty> { body }`:
612-
let generator_kind = hir::ExprKind::Closure(
612+
let generator_kind = hir::ExprKind::Closure {
613613
capture_clause,
614-
decl,
615-
body_id,
616-
self.lower_span(span),
617-
Some(hir::Movability::Static),
618-
);
614+
fn_decl,
615+
body,
616+
fn_decl_span: self.lower_span(span),
617+
movability: Some(hir::Movability::Static),
618+
};
619619
let generator = hir::Expr {
620620
hir_id: self.lower_node_id(closure_node_id),
621621
kind: generator_kind,
@@ -840,7 +840,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
840840
body: &Expr,
841841
fn_decl_span: Span,
842842
) -> hir::ExprKind<'hir> {
843-
let (body_id, generator_option) = self.with_new_scopes(move |this| {
843+
let (body, generator_option) = self.with_new_scopes(move |this| {
844844
let prev = this.current_item;
845845
this.current_item = Some(fn_decl_span);
846846
let mut generator_kind = None;
@@ -858,13 +858,13 @@ impl<'hir> LoweringContext<'_, 'hir> {
858858
// Lower outside new scope to preserve `is_in_loop_condition`.
859859
let fn_decl = self.lower_fn_decl(decl, None, FnDeclKind::Closure, None);
860860

861-
hir::ExprKind::Closure(
861+
hir::ExprKind::Closure {
862862
capture_clause,
863863
fn_decl,
864-
body_id,
865-
self.lower_span(fn_decl_span),
866-
generator_option,
867-
)
864+
body,
865+
fn_decl_span: self.lower_span(fn_decl_span),
866+
movability: generator_option,
867+
}
868868
}
869869

870870
fn generator_movability_for_fn(
@@ -911,7 +911,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
911911
let outer_decl =
912912
FnDecl { inputs: decl.inputs.clone(), output: FnRetTy::Default(fn_decl_span) };
913913

914-
let body_id = self.with_new_scopes(|this| {
914+
let body = self.with_new_scopes(|this| {
915915
// FIXME(cramertj): allow `async` non-`move` closures with arguments.
916916
if capture_clause == CaptureBy::Ref && !decl.inputs.is_empty() {
917917
struct_span_err!(
@@ -950,13 +950,13 @@ impl<'hir> LoweringContext<'_, 'hir> {
950950
// closure argument types.
951951
let fn_decl = self.lower_fn_decl(&outer_decl, None, FnDeclKind::Closure, None);
952952

953-
hir::ExprKind::Closure(
953+
hir::ExprKind::Closure {
954954
capture_clause,
955955
fn_decl,
956-
body_id,
957-
self.lower_span(fn_decl_span),
958-
None,
959-
)
956+
body,
957+
fn_decl_span: self.lower_span(fn_decl_span),
958+
movability: None,
959+
}
960960
}
961961

962962
/// Destructure the LHS of complex assignments.

‎compiler/rustc_ast_passes/src/feature_gate.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -406,8 +406,7 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
406406

407407
// Emit errors for non-staged-api crates.
408408
if !self.features.staged_api {
409-
if attr.has_name(sym::rustc_deprecated)
410-
|| attr.has_name(sym::unstable)
409+
if attr.has_name(sym::unstable)
411410
|| attr.has_name(sym::stable)
412411
|| attr.has_name(sym::rustc_const_unstable)
413412
|| attr.has_name(sym::rustc_const_stable)

0 commit comments

Comments
 (0)
Please sign in to comment.