diff options
| author | Raul Alimbekov <[email protected]> | 2025-12-16 09:05:22 +0300 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-12-16 09:05:22 +0300 |
| commit | c9a04b4b732b7a3b696eb8223664c1a7942b1875 (patch) | |
| tree | 6dbe5c02e66eed8d8762f13f95afd24f8db2b38c /embassy-executor-macros | |
| parent | cde24a3ef1117653ba5ed4184102b33f745782fb (diff) | |
| parent | 5ae6e060ec1c90561719aabdc29d5b6e7b8b0a82 (diff) | |
Merge branch 'main' into main
Diffstat (limited to 'embassy-executor-macros')
| -rw-r--r-- | embassy-executor-macros/Cargo.toml | 2 | ||||
| -rw-r--r-- | embassy-executor-macros/src/macros/main.rs | 4 | ||||
| -rw-r--r-- | embassy-executor-macros/src/macros/task.rs | 8 | ||||
| -rw-r--r-- | embassy-executor-macros/src/util.rs | 2 |
4 files changed, 10 insertions, 6 deletions
diff --git a/embassy-executor-macros/Cargo.toml b/embassy-executor-macros/Cargo.toml index 9c2b40d03..3eeed5e4d 100644 --- a/embassy-executor-macros/Cargo.toml +++ b/embassy-executor-macros/Cargo.toml | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | [package] | 1 | [package] |
| 2 | name = "embassy-executor-macros" | 2 | name = "embassy-executor-macros" |
| 3 | version = "0.7.0" | 3 | version = "0.7.0" |
| 4 | edition = "2021" | 4 | edition = "2024" |
| 5 | license = "MIT OR Apache-2.0" | 5 | license = "MIT OR Apache-2.0" |
| 6 | description = "macros for creating the entry point and tasks for embassy-executor" | 6 | description = "macros for creating the entry point and tasks for embassy-executor" |
| 7 | repository = "https://github.com/embassy-rs/embassy" | 7 | repository = "https://github.com/embassy-rs/embassy" |
diff --git a/embassy-executor-macros/src/macros/main.rs b/embassy-executor-macros/src/macros/main.rs index dc470e51c..c259c003f 100644 --- a/embassy-executor-macros/src/macros/main.rs +++ b/embassy-executor-macros/src/macros/main.rs | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | use std::str::FromStr; | 1 | use std::str::FromStr; |
| 2 | 2 | ||
| 3 | use darling::export::NestedMeta; | ||
| 4 | use darling::FromMeta; | 3 | use darling::FromMeta; |
| 4 | use darling::export::NestedMeta; | ||
| 5 | use proc_macro2::TokenStream; | 5 | use proc_macro2::TokenStream; |
| 6 | use quote::quote; | 6 | use quote::quote; |
| 7 | use syn::{ReturnType, Type}; | 7 | use syn::{ReturnType, Type}; |
| @@ -183,7 +183,7 @@ For example: `#[embassy_executor::main(entry = ..., executor = \"some_crate::Exe | |||
| 183 | quote!(!), | 183 | quote!(!), |
| 184 | quote! { | 184 | quote! { |
| 185 | unsafe fn __make_static<T>(t: &mut T) -> &'static mut T { | 185 | unsafe fn __make_static<T>(t: &mut T) -> &'static mut T { |
| 186 | ::core::mem::transmute(t) | 186 | unsafe { ::core::mem::transmute(t) } |
| 187 | } | 187 | } |
| 188 | 188 | ||
| 189 | let mut executor = #executor::new(); | 189 | let mut executor = #executor::new(); |
diff --git a/embassy-executor-macros/src/macros/task.rs b/embassy-executor-macros/src/macros/task.rs index 755948882..8ce8d6726 100644 --- a/embassy-executor-macros/src/macros/task.rs +++ b/embassy-executor-macros/src/macros/task.rs | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | use std::str::FromStr; | 1 | use std::str::FromStr; |
| 2 | 2 | ||
| 3 | use darling::export::NestedMeta; | ||
| 4 | use darling::FromMeta; | 3 | use darling::FromMeta; |
| 4 | use darling::export::NestedMeta; | ||
| 5 | use proc_macro2::{Span, TokenStream}; | 5 | use proc_macro2::{Span, TokenStream}; |
| 6 | use quote::{format_ident, quote}; | 6 | use quote::{format_ident, quote}; |
| 7 | use syn::visit::{self, Visit}; | 7 | use syn::visit::{self, Visit}; |
| @@ -287,7 +287,11 @@ fn check_arg_ty(errors: &mut TokenStream, ty: &Type) { | |||
| 287 | } | 287 | } |
| 288 | 288 | ||
| 289 | fn visit_type_impl_trait(&mut self, i: &'ast syn::TypeImplTrait) { | 289 | fn visit_type_impl_trait(&mut self, i: &'ast syn::TypeImplTrait) { |
| 290 | error(self.errors, i, "`impl Trait` is not allowed in task arguments. It is syntax sugar for generics, and tasks can't be generic."); | 290 | error( |
| 291 | self.errors, | ||
| 292 | i, | ||
| 293 | "`impl Trait` is not allowed in task arguments. It is syntax sugar for generics, and tasks can't be generic.", | ||
| 294 | ); | ||
| 291 | } | 295 | } |
| 292 | } | 296 | } |
| 293 | 297 | ||
diff --git a/embassy-executor-macros/src/util.rs b/embassy-executor-macros/src/util.rs index ebd032a62..5a13f2121 100644 --- a/embassy-executor-macros/src/util.rs +++ b/embassy-executor-macros/src/util.rs | |||
| @@ -3,7 +3,7 @@ use std::fmt::Display; | |||
| 3 | use proc_macro2::{TokenStream, TokenTree}; | 3 | use proc_macro2::{TokenStream, TokenTree}; |
| 4 | use quote::{ToTokens, TokenStreamExt}; | 4 | use quote::{ToTokens, TokenStreamExt}; |
| 5 | use syn::parse::{Parse, ParseStream}; | 5 | use syn::parse::{Parse, ParseStream}; |
| 6 | use syn::{braced, bracketed, token, AttrStyle, Attribute, Signature, Token, Visibility}; | 6 | use syn::{AttrStyle, Attribute, Signature, Token, Visibility, braced, bracketed, token}; |
| 7 | 7 | ||
| 8 | pub fn token_stream_with_error(mut tokens: TokenStream, error: syn::Error) -> TokenStream { | 8 | pub fn token_stream_with_error(mut tokens: TokenStream, error: syn::Error) -> TokenStream { |
| 9 | tokens.extend(error.into_compile_error()); | 9 | tokens.extend(error.into_compile_error()); |
