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 8 pull requests #120067

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
c4b1054
Move PointIndex to mir_dataflow.
cjgillot Dec 3, 2023
da235ce
Do not recompute liveness for DestinationPropagation.
cjgillot Dec 3, 2023
3082028
Fix comment.
cjgillot Dec 3, 2023
1d6723a
Use for_each instead of fold.
cjgillot Jan 7, 2024
adce3fd
Enable Static Builds for FreeBSD
rellerreller Jan 11, 2024
7df054b
Change return type of unstable `Waker::noop()` from `Waker` to `&Waker`.
kpreid Jan 15, 2024
219b00d
Remove unnecessary `let`s and borrowing from `Waker::noop()` usage.
kpreid Jan 15, 2024
2683c2b
Remove unused features
clubby789 Jan 14, 2024
9a8f117
Don't create the array type twice
oli-obk Jan 15, 2024
7052188
Document why `Waker::noop()`'s implementation is the shape it is.
kpreid Jan 15, 2024
ee370a1
Consistently unset RUSTC_BOOTSTRAP when compiling bootstrap
dtolnay Jan 15, 2024
3599c18
Skip dead code checks on items that failed typeck
oli-obk Jan 16, 2024
8bb1eae
Introduce helper that deals with moving async args into the coroutine
compiler-errors Jan 14, 2024
450cb5e
Don't ICE if TAIT-defining fn contains a closure with `_` in return type
Jan 14, 2024
22833c1
add test for non-defining use of TAIT in foreign function item
Jan 15, 2024
f1ee076
Async closures will move params into the future always
compiler-errors Jan 14, 2024
f4e35c6
Fix async closure call suggestion
compiler-errors Jan 15, 2024
04a5ee6
Deal with additional wrapping of async closure body in clippy
compiler-errors Jan 15, 2024
e8bf52c
Rollup merge of #115291 - cjgillot:dest-prop-save, r=JakobDegen
compiler-errors Jan 17, 2024
9d094bb
Rollup merge of #119855 - rellerreller:freebsd-static, r=wesleywiser
compiler-errors Jan 17, 2024
276d072
Rollup merge of #119968 - clubby789:unused-feature, r=compiler-errors
compiler-errors Jan 17, 2024
4560c0c
Rollup merge of #119975 - lukas-code:inferring-return-types-and-opaqu…
compiler-errors Jan 17, 2024
93ebcf0
Rollup merge of #119978 - compiler-errors:async-closure-captures, r=o…
compiler-errors Jan 17, 2024
4389d13
Rollup merge of #119984 - kpreid:waker-noop, r=dtolnay
compiler-errors Jan 17, 2024
f92cee2
Rollup merge of #120001 - dtolnay:bootstrapbootstrap, r=onur-ozkan
compiler-errors Jan 17, 2024
c297753
Rollup merge of #120020 - oli-obk:long_const_eval_err_taint, r=compil…
compiler-errors Jan 17, 2024
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
2 changes: 0 additions & 2 deletions compiler/rustc_ast/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,11 @@
#![feature(rustdoc_internals)]
#![feature(associated_type_bounds)]
#![feature(box_patterns)]
#![feature(const_trait_impl)]
#![feature(if_let_guard)]
#![feature(let_chains)]
#![feature(min_specialization)]
#![feature(negative_impls)]
#![feature(stmt_expr_attributes)]
#![recursion_limit = "256"]
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]

Expand Down
4 changes: 0 additions & 4 deletions compiler/rustc_ast_lowering/messages.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ ast_lowering_assoc_ty_parentheses =
ast_lowering_async_coroutines_not_supported =
`async` coroutines are not yet supported

ast_lowering_async_non_move_closure_not_supported =
`async` non-`move` closures with parameters are not currently supported
.help = consider using `let` statements to manually capture variables by reference before entering an `async move` closure

ast_lowering_att_syntax_only_x86 =
the `att_syntax` option is only supported on x86

Expand Down
8 changes: 0 additions & 8 deletions compiler/rustc_ast_lowering/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,14 +145,6 @@ pub struct ClosureCannotBeStatic {
pub fn_decl_span: Span,
}

#[derive(Diagnostic, Clone, Copy)]
#[help]
#[diag(ast_lowering_async_non_move_closure_not_supported, code = "E0708")]
pub struct AsyncNonMoveClosureNotSupported {
#[primary_span]
pub fn_decl_span: Span,
}

#[derive(Diagnostic, Clone, Copy)]
#[diag(ast_lowering_functional_record_update_destructuring_assignment)]
pub struct FunctionalRecordUpdateDestructuringAssignment {
Expand Down
39 changes: 15 additions & 24 deletions compiler/rustc_ast_lowering/src/expr.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use super::errors::{
AsyncCoroutinesNotSupported, AsyncNonMoveClosureNotSupported, AwaitOnlyInAsyncFnAndBlocks,
BaseExpressionDoubleDot, ClosureCannotBeStatic, CoroutineTooManyParameters,
AsyncCoroutinesNotSupported, AwaitOnlyInAsyncFnAndBlocks, BaseExpressionDoubleDot,
ClosureCannotBeStatic, CoroutineTooManyParameters,
FunctionalRecordUpdateDestructuringAssignment, InclusiveRangeWithNoEnd, MatchArmWithNoBody,
NeverPatternWithBody, NeverPatternWithGuard, NotSupportedForLifetimeBinderAsyncClosure,
UnderscoreExprLhsAssign,
Expand All @@ -13,7 +13,6 @@ use rustc_ast::*;
use rustc_data_structures::stack::ensure_sufficient_stack;
use rustc_hir as hir;
use rustc_hir::def::{DefKind, Res};
use rustc_middle::span_bug;
use rustc_session::errors::report_lit_error;
use rustc_span::source_map::{respan, Spanned};
use rustc_span::symbol::{kw, sym, Ident, Symbol};
Expand Down Expand Up @@ -1028,51 +1027,43 @@ impl<'hir> LoweringContext<'_, 'hir> {
fn_decl_span: Span,
fn_arg_span: Span,
) -> hir::ExprKind<'hir> {
let CoroutineKind::Async { closure_id: inner_closure_id, .. } = coroutine_kind else {
span_bug!(fn_decl_span, "`async gen` and `gen` closures are not supported, yet");
};

if let &ClosureBinder::For { span, .. } = binder {
self.dcx().emit_err(NotSupportedForLifetimeBinderAsyncClosure { span });
}

let (binder_clause, generic_params) = self.lower_closure_binder(binder);

let outer_decl =
FnDecl { inputs: decl.inputs.clone(), output: FnRetTy::Default(fn_decl_span) };

let body = self.with_new_scopes(fn_decl_span, |this| {
// FIXME(cramertj): allow `async` non-`move` closures with arguments.
if capture_clause == CaptureBy::Ref && !decl.inputs.is_empty() {
this.dcx().emit_err(AsyncNonMoveClosureNotSupported { fn_decl_span });
}

// Transform `async |x: u8| -> X { ... }` into
// `|x: u8| || -> X { ... }`.
let body_id = this.lower_fn_body(&outer_decl, |this| {
let body_id = this.lower_body(|this| {
let async_ret_ty = if let FnRetTy::Ty(ty) = &decl.output {
let itctx = ImplTraitContext::Disallowed(ImplTraitPosition::AsyncBlock);
Some(hir::FnRetTy::Return(this.lower_ty(ty, &itctx)))
} else {
None
};

let async_body = this.make_desugared_coroutine_expr(
capture_clause,
inner_closure_id,
async_ret_ty,
let (parameters, expr) = this.lower_coroutine_body_with_moved_arguments(
decl,
|this| this.with_new_scopes(fn_decl_span, |this| this.lower_expr_mut(body)),
body.span,
hir::CoroutineDesugaring::Async,
coroutine_kind,
hir::CoroutineSource::Closure,
|this| this.with_new_scopes(fn_decl_span, |this| this.lower_expr_mut(body)),
async_ret_ty,
);
let hir_id = this.lower_node_id(inner_closure_id);

let hir_id = this.lower_node_id(coroutine_kind.closure_id());
this.maybe_forward_track_caller(body.span, closure_hir_id, hir_id);
hir::Expr { hir_id, kind: async_body, span: this.lower_span(body.span) }

(parameters, expr)
});
body_id
});

let outer_decl =
FnDecl { inputs: decl.inputs.clone(), output: FnRetTy::Default(fn_decl_span) };

let bound_generic_params = self.lower_lifetime_binder(closure_id, generic_params);
// We need to lower the declaration outside the new scope, because we
// have to conserve the state of being inside a loop condition for the
Expand Down
Loading
Loading