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

impl Trait doesn't understand that empty functions return () #36379

Closed
Stebalien opened this issue Sep 10, 2016 · 3 comments · Fixed by #42230
Closed

impl Trait doesn't understand that empty functions return () #36379

Stebalien opened this issue Sep 10, 2016 · 3 comments · Fixed by #42230
Labels
A-traits Area: Trait system A-typesystem Area: The type system E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added.

Comments

@Stebalien
Copy link
Contributor

The following should compile because (): Default:

#![feature(conservative_impl_trait)]
fn test() -> impl Default {}

However, it fails with:

error[E0282]: unable to infer enough type information about `_`
 --> tmp.rs:2:14
  |
2 | fn test() -> impl Default {}
  |              ^^^^^^^^^^^^ cannot infer type for `_`
  |
  = note: type annotations or generic parameter binding required

(Obviously, nobody will ever run into this in practice...)

@apasel422 apasel422 added A-traits Area: Trait system A-typesystem Area: The type system labels Dec 28, 2016
@Mark-Simulacrum
Copy link
Member

This works today; E-needstest.

@Mark-Simulacrum Mark-Simulacrum added the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label May 18, 2017
@venkatagiri
Copy link
Contributor

@Mark-Simulacrum would a run-pass be fine for this?

@Mark-Simulacrum
Copy link
Member

Let's go with a compile-fail test that look something like this one; meaningful part being these two lines. Let me know if you have any more questions!

venkatagiri added a commit to venkatagiri/rust that referenced this issue May 25, 2017
Mark-Simulacrum added a commit to Mark-Simulacrum/rust that referenced this issue May 26, 2017
frewsxcv added a commit to frewsxcv/rust that referenced this issue May 26, 2017
frewsxcv added a commit to frewsxcv/rust that referenced this issue May 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-traits Area: Trait system A-typesystem Area: The type system E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants