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

could type inference fill in the _ in expr as Box<_> when expecting Box<Trait> ? #22221

Closed
pnkfelix opened this issue Feb 12, 2015 · 4 comments
Closed
Labels
A-typesystem Area: The type system

Comments

@pnkfelix
Copy link
Member

Could type inference fill in expr as Box<_> when expecting Box<Trait> ?

From what I have seen, it seems to make no attempt to use the surrounding context to fill in gaps like the _ in Box<_> above.

spawned from #22086

@pnkfelix pnkfelix changed the title could type inference fill in expr as Box<_> when expecting Box<Trait> could type inference fill in expr as Box<_> when expecting Box<Trait> ? Feb 12, 2015
@pnkfelix
Copy link
Member Author

cc #22181

@steveklabnik steveklabnik added the A-typesystem Area: The type system label Feb 13, 2015
@pnkfelix pnkfelix changed the title could type inference fill in expr as Box<_> when expecting Box<Trait> ? could type inference fill in the _ in expr as Box<_> when expecting Box<Trait> ? Feb 16, 2015
@steveklabnik
Copy link
Member

Triage: box stuff is still up for debate.

@Mark-Simulacrum
Copy link
Member

I'm not quite sure how to triage this, since this doesn't compile at all today. Perhaps this should be closed until as Box<_> becomes possible?

error: non-scalar cast: `i32` as `std::boxed::Box<std::fmt::Display>`
 --> test.rs:4:27
  |
4 |     let t: Box<Display> = 10 as Box<_>;
  |                           ^^^^^^^^^^^^

error: aborting due to previous error

@Mark-Simulacrum
Copy link
Member

Per discussion on IRC with @aturon I'm going to close. It doesn't seem helpful to track this, since in almost all or all cases, inferring the trait would likely lead to surprising behavior, and so we probably don't want to do this anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-typesystem Area: The type system
Projects
None yet
Development

No branches or pull requests

3 participants