-
Notifications
You must be signed in to change notification settings - Fork 309
fix(macros): Allow #[tool]
to work even if Future is not in scope
#385
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
base: main
Are you sure you want to change the base?
fix(macros): Allow #[tool]
to work even if Future is not in scope
#385
Conversation
The current MSRV is 1.85.1, so I think by default |
e6670e2
to
e701044
Compare
As far I can tell that only applies to the 2024 edition. Previous editions do not have Anyway it seems like #351 changed this to use |
I am not saying to reject to support 2021 edition, just wondering in what case you have to use 2021 edtion instead 2024 edition. There was a developer also requested the compatibility for the 2021 edition, it's because he is still using windows 7.
You are right, I missed this when review code. |
It should have the same problem in the newly merged prompt macro's code, could you fix it together in this PR? |
e701044
to
f441670
Compare
#[tool]
to work even if Future is not in scope#[tool]
to work even if Future is not in scope
`#[tool]` generates code that uses Future by name for async functions. This means that consumers have to import Future. This commit fixes that by changing the macro expansion to use std::future::Future instead. The same applies to `#[prompt]` as well.
f441670
to
1f34864
Compare
The features added in the 2024 edition are small enough that actually doing the upgrade is just low on my priority list. It's not an MSRV constraint, I am still using the latest stable rustc with edition 2021.
I have updated the |
This changes the expansion of
#[tool]
to emitstd::future::Future
instead ofFuture
.Motivation and Context
This is a pretty small papercut, but if you use
#[tool]
on an async function then it requires thatFuture
be imported.How Has This Been Tested?
cargo check --all-targets
passesBreaking Changes
No
Types of changes
Checklist
Additional context