-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Compilation error for lifetimes in associated type used by async-fn-in-trait #102681
Labels
Comments
Dupe of #102682 |
I looked into this a bit more. We should probably be denying associated types in AFITs for now. See the corresponding non-AFIT code: #![feature(inherent_associated_types)]
struct Foo<'a>(&'a ());
trait Trait<'a> {
type Assoc;
}
impl<'a> Trait<'a> for Foo<'a> {
type Assoc = ();
}
impl<'a> Foo<'a> {
async fn foo() -> <Self as Trait<'a>>::Assoc {}
} Which errors like:
This error exists because of a |
chrysn
added a commit
to chrysn-pull-requests/embedded-nal
that referenced
this issue
Nov 18, 2022
This removes the lifetimes from the Connect associated types; leaving them would cause errors (possibly related to [12681]), but I think that stacks whose sockets are not 'static can work around this by implementing the stack traits on a &'short stack instead. [12681]: rust-lang/rust#102681
The code is now accepted, and the test has been updated. |
chrysn
added a commit
to chrysn-pull-requests/embedded-nal
that referenced
this issue
Dec 2, 2022
This removes the lifetimes from the Connect associated types; leaving them would cause errors (possibly related to [12681]), but I think that stacks whose sockets are not 'static can work around this by implementing the stack traits on a &'short stack instead. [12681]: rust-lang/rust#102681
eldruin
pushed a commit
to rust-embedded-community/embedded-nal
that referenced
this issue
Jan 17, 2023
* gitignore: Also ignore target inside nested crate * async: Add UDP traits Closes: #71 * async UDP: Simplify to 2 rather than 3 traits * async UDP: Documentation fixes; receive_into consistency One trait's receive_into still used the old receive name. * async UDP: Make accessible through lib.rs * async UDP: Fix lifetimes of send and receive functions Elided lifetimes would have asked too little of the data / buffer references. * async UDP: Better names for bound sockets * UDP: use async-fn-in-trait instead of associated types that are Future This removes the lifetimes from the Connect associated types; leaving them would cause errors (possibly related to [12681]), but I think that stacks whose sockets are not 'static can work around this by implementing the stack traits on a &'short stack instead. [12681]: rust-lang/rust#102681 * async/UDP: Remove connect_default helper The connect method can now be provided properly. * async/CHANGELOG: Add UDP * async/UDP: rustfmt * async/UDP: Tie socket's error types to stack's
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The following UI test (
async-associated-types.rs
from #102642) currently does not compileI expected to see this happen: successful compilation
Instead, this happened:
Meta
rustc --version --verbose
:The text was updated successfully, but these errors were encountered: