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

embassy-executor-macros fails to compile on the latest Rust Nightly. #2709

Closed
danclive opened this issue Mar 19, 2024 · 5 comments
Closed

embassy-executor-macros fails to compile on the latest Rust Nightly. #2709

danclive opened this issue Mar 19, 2024 · 5 comments

Comments

@danclive
Copy link

see: https://github.com/esp-rs/esp-hal/actions/runs/8342745449/job/22831570036#step:7:609

   Compiling examples v0.0.0 (/home/runner/work/esp-hal/esp-hal/examples)
error: concrete type differs from previous defining opaque type use
  --> src/bin/embassy_usb_serial_jtag.rs:27:1
   |
27 | #[embassy_executor::task]
   | ^^^^^^^^^^^^^^^^^^^^^^^^^ expected `writer::Fut`, got `impl Future<Output = ()>`
   |
note: previous use here
  --> src/bin/embassy_usb_serial_jtag.rs:27:1
   |
27 | #[embassy_executor::task]
   | ^^^^^^^^^^^^^^^^^^^^^^^^^
   = note: this error originates in the attribute macro `embassy_executor::task` (in Nightly builds, run with -Z macro-backtrace for more info)

error: concrete type differs from previous defining opaque type use
  --> src/bin/embassy_usb_serial_jtag.rs:47:1
   |
47 | #[embassy_executor::task]
   | ^^^^^^^^^^^^^^^^^^^^^^^^^ expected `reader::Fut`, got `impl Future<Output = ()>`
   |
note: previous use here
  --> src/bin/embassy_usb_serial_jtag.rs:47:1
   |
47 | #[embassy_executor::task]
   | ^^^^^^^^^^^^^^^^^^^^^^^^^
   = note: this error originates in the attribute macro `embassy_executor::task` (in Nightly builds, run with -Z macro-backtrace for more info)
@danclive
Copy link
Author

This may be due to the recent Rust Nightly having a destructive impact on embassy-executor-macros.

#[cfg(feature = "nightly")]
let mut task_outer: ItemFn = parse_quote! {
#visibility fn #task_ident(#fargs) -> ::embassy_executor::SpawnToken<impl Sized> {
type Fut = impl ::core::future::Future + 'static;
const POOL_SIZE: usize = #pool_size;
static POOL: ::embassy_executor::raw::TaskPool<Fut, POOL_SIZE> = ::embassy_executor::raw::TaskPool::new();
unsafe { POOL._spawn_async_fn(move || #task_inner_ident(#(#full_args,)*)) }
}
};

@jessebraham
Copy link
Contributor

I understand that the stated policy here is that only the nightly version in the rust-toolchain.toml file is officially supported, but how are HAL developers expected to accommodate this? This is a pretty rigid restriction that I'm not really comfortable applying to our HAL.

@Dirbaio
Copy link
Member

Dirbaio commented Mar 20, 2024

You can use nightly but not enable the nightly feature in embassy-executor. This'll make it use the task arena which works on stable, so it's not subject to the nightly breakages. With this you can choose any nightly version that works best for you.

I still have to look into this particular breakage and update it to work on newer nightlies. Perhaps merging #2574.

@Dirbaio
Copy link
Member

Dirbaio commented Mar 20, 2024

seems a rust regression to me. Filed rust-lang/rust#122775

Seems #2574 is not affected

@Dirbaio
Copy link
Member

Dirbaio commented Mar 20, 2024

fixed in #2574

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants