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

Tasks that are using &'static args broke #2734

Closed
Ddystopia opened this issue Mar 25, 2024 · 3 comments
Closed

Tasks that are using &'static args broke #2734

Ddystopia opened this issue Mar 25, 2024 · 3 comments

Comments

@Ddystopia
Copy link
Contributor

Error:

cargo  check
    Checking embassy_executor_min v0.1.0 (/home/ddystopia/code/embassy_executor_min)
error: concrete type differs from previous defining opaque type use
 --> src/main.rs:7:1
  |
7 | #[embassy_executor::task]
  | ^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Fut`, got `impl Future<Output = ()>`
  |
note: previous use here
 --> src/main.rs:7:1
  |
7 | #[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: could not compile `embassy_executor_min` (bin "embassy_executor_min") due to 1 previous error

Rust:

rustc 1.79.0-nightly (2f090c30d 2024-03-23)
binary: rustc
commit-hash: 2f090c30ddd6b3bbe5c81c087579a5166e7c7278
commit-date: 2024-03-23
host: x86_64-unknown-linux-gnu
release: 1.79.0-nightly
LLVM version: 18.1.2
#![feature(type_alias_impl_trait)]

fn main() {
    println!("Hello, world!");
}

#[embassy_executor::task]
async fn my_task(_a: &'static i32) {}

Carto.toml

[package]
name = "embassy_executor_min"
version = "0.1.0"
edition = "2021"

[dependencies]
embassy-executor = { version = "0.5.0", features=["nightly"], default-features = false }

Cargo.lock

```toml # This file is automatically @generated by Cargo. # It is not intended for manual editing. version = 3

[[package]]
name = "critical-section"
version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7059fff8937831a9ae6f0fe4d658ffabf58f2ca96aa9dec1c889f936f705f216"

[[package]]
name = "darling"
version = "0.20.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "54e36fcd13ed84ffdfda6f5be89b31287cbb80c439841fe69e04841435464391"
dependencies = [
"darling_core",
"darling_macro",
]

[[package]]
name = "darling_core"
version = "0.20.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c2cf1c23a687a1feeb728783b993c4e1ad83d99f351801977dd809b48d0a70f"
dependencies = [
"fnv",
"ident_case",
"proc-macro2",
"quote",
"strsim",
"syn",
]

[[package]]
name = "darling_macro"
version = "0.20.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a668eda54683121533a393014d8692171709ff57a7d61f187b6e782719f8933f"
dependencies = [
"darling_core",
"quote",
"syn",
]

[[package]]
name = "document-features"
version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ef5282ad69563b5fc40319526ba27e0e7363d552a896f0297d54f767717f9b95"
dependencies = [
"litrs",
]

[[package]]
name = "embassy-executor"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec648daedd2143466eff4b3e8002024f9f6c1de4ab7666bb679688752624c925"
dependencies = [
"critical-section",
"document-features",
"embassy-executor-macros",
]

[[package]]
name = "embassy-executor-macros"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ad454accf80050e9cf7a51e994132ba0e56286b31f9317b68703897c328c59b5"
dependencies = [
"darling",
"proc-macro2",
"quote",
"syn",
]

[[package]]
name = "embassy_executor_min"
version = "0.1.0"
dependencies = [
"embassy-executor",
]

[[package]]
name = "fnv"
version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"

[[package]]
name = "ident_case"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"

[[package]]
name = "litrs"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b4ce301924b7887e9d637144fdade93f9dfff9b60981d4ac161db09720d39aa5"

[[package]]
name = "proc-macro2"
version = "1.0.79"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e835ff2298f5721608eb1a980ecaee1aef2c132bf95ecc026a11b7bf3c01c02e"
dependencies = [
"unicode-ident",
]

[[package]]
name = "quote"
version = "1.0.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef"
dependencies = [
"proc-macro2",
]

[[package]]
name = "strsim"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"

[[package]]
name = "syn"
version = "2.0.55"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "002a1b3dbf967edfafc32655d0f377ab0bb7b994aa1d32c8cc7e9b8bf3ebb8f0"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]

[[package]]
name = "unicode-ident"
version = "1.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"

</details>
@Ddystopia
Copy link
Contributor Author

Maybe related:
rust-lang/rust#122775

@Ddystopia
Copy link
Contributor Author

That version of code compiles:

#![feature(type_alias_impl_trait)]

fn main() {
    println!("Hello, world!");
}

struct Arg(&'static i32);

#[embassy_executor::task]
async fn my_task(_a: Arg) {}

@Ddystopia Ddystopia changed the title Task that are using &'static args broke Tasks that are using &'static args broke Mar 25, 2024
@Dirbaio
Copy link
Member

Dirbaio commented Mar 25, 2024

duplicate of #2709. It's a rust bug: rust-lang/rust#122775

You can either:

  • stick to nightly-2024-03-15 or older
  • use embassy-executor from git
  • disable feature nightly
  • wait until this is fixed in Rust in a future nightly.

@Dirbaio Dirbaio closed this as completed Mar 25, 2024
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

2 participants