Skip to content

Commit

Permalink
Add a deprecation notice about async constructors
Browse files Browse the repository at this point in the history
Resolves #3976
  • Loading branch information
danielronnkvist committed Jan 9, 2025
1 parent c9ee617 commit a32bc1b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions crates/macro-support/src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1418,6 +1418,11 @@ impl MacroParse<&ClassMarker> for &mut syn::ImplItemFn {
FunctionPosition::Impl { self_ty: class },
)?;
let method_kind = if opts.constructor().is_some() {
if function.r#async {
self.attrs.push(syn::parse_quote! {
#[deprecated(note = "constructors cannot be async")]
});
}
ast::MethodKind::Constructor
} else {
let is_static = method_self.is_none();
Expand Down

0 comments on commit a32bc1b

Please sign in to comment.