Skip to content
This repository has been archived by the owner on Oct 30, 2019. It is now read-only.

improved error message for unused futures #32

Merged
merged 1 commit into from
May 16, 2019
Merged

improved error message for unused futures #32

merged 1 commit into from
May 16, 2019

Conversation

ibaryshnikov
Copy link
Member

@ibaryshnikov ibaryshnikov commented May 15, 2019

Follows #31 (comment)
I guess this variant was merged in rust-lang/rust. What about message for streams?

@yoshuawuyts
Copy link
Collaborator

@ibaryshnikov the same message can be used for streams

#[must_use = "streams do nothing unless you `.await` or poll them"]

@taiki-e
Copy link
Contributor

taiki-e commented May 16, 2019

@yoshuawuyts

#[must_use = "streams do nothing unless you `.await` or poll them"]

I think the message may be misleading, as streams cannot use .await directly.

Related: rust-lang/futures-rs#1600

@yoshuawuyts
Copy link
Collaborator

@taiki-e ah yeah, fair -- I guess the way we want to go is for x.await in y {} loops, but not sure how to mention that. "polled" is probably accurate (poll_next), but await... is currently only sort of accurate? Do you have a suggestion for something better?

@taiki-e
Copy link
Contributor

taiki-e commented May 16, 2019

@yoshuawuyts
I don't know what the more desirable error message is.
For example, .next().await may be more convenient, but this may not be appropriate because next is not a method of Stream trait. Also, we use must_use for impl Sink types, so I don't know if the message related to a specific method name is really good.
This also depends on how Stream trait is added in the language, so, for now, I think it is better to postpone the stream must_use message problem.

@taiki-e
Copy link
Contributor

taiki-e commented May 16, 2019

By the way, "improwed" in the commit message and the title looks like a typo.

@yoshuawuyts yoshuawuyts changed the title improwed error message for unused futures improved error message for unused futures May 16, 2019
@yoshuawuyts
Copy link
Collaborator

for now, I think it is better to postpone the stream must_use message problem.

@taiki-e that sounds reasonable (:

@yoshuawuyts yoshuawuyts merged commit 2e41ca0 into rustasync:master May 16, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants