Hi,
Is there any progress on Rust equivalent of decltype? It seems that using traits or structs with futures is currently impossible without either:
Implementing future by hand and using unsafe (error prone and has boilerplate)
Using dyn Future and boxing it (pays performance penalty)
I think you're looking for
opened 06:12AM - 28 Jul 19 UTC
A-impl-trait
B-RFC-approved
B-unstable
C-tracking-issue
F-type_alias_impl_trait
T-lang
requires-nightly
This is a tracking issue for the RFC "Permit impl Trait in type aliases" (rust-l… ang/rfcs#2515) under the feature gate `#![feature(type_alias_impl_trait)]`.
### About tracking issues
Tracking issues are used to record the overall progress of implementation.
They are also uses as hubs connecting to other relevant issues, e.g., bugs or open design questions.
A tracking issue is however *not* meant for large scale discussion, questions, or bug reports about a feature.
Instead, open a dedicated issue for the specific matter and add the relevant feature gate label.
### Steps
- [x] Implement the RFC (cc @alexreg @varkor)
- [ ] Adjust documentation ([see instructions on rustc-guide][doc-guide])
- [ ] Stabilization PR ([see instructions on rustc-guide][stabilization-guide])
[stabilization-guide]: https://rust-lang.github.io/rustc-guide/stabilization_guide.html#stabilization-pr
[doc-guide]: https://rust-lang.github.io/rustc-guide/stabilization_guide.html#documentation-prs
### Unresolved questions
- [ ] Exactly what should count as "defining uses" for opaque types? E.g. currently `static`s and `const`s are not counted, but rust-lang/rfcs#2071 specifies that they should be. https://github.com/rust-lang/rust/issues/77898
- [ ] Should the set of "defining uses" for an opaque type in an impl be just items of the impl, or include nested items within the impl functions etc? ([see here for example](https://github.com/rust-lang/rust/pull/52650#discussion_r204893239))
1 Like
there are cases where it'd be very handy to name the type of a value, e.g. for writing macros that just have the value passed in, but not the type.
Something like:
macro_rules! m {
($v:expr) => {
<typeof($v)>::AssociatedType::f($v)
};
}
7 Likes
system
Closed
October 9, 2021, 10:32pm
5
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.