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

Type inference of impl Trait RFC 1522 #1692

Closed
vlad20012 opened this issue Sep 4, 2017 · 1 comment
Closed

Type inference of impl Trait RFC 1522 #1692

vlad20012 opened this issue Sep 4, 2017 · 1 comment
Labels
E-easy Issue required minimal knowledge about platform and project codebase E-mentor Issues with known solution and most likely with instruction how to fix/implement it help wanted rust Issues about new language features rust 2018 Issues related to 2018 Rust edition

Comments

@vlad20012
Copy link
Member

vlad20012 commented Sep 4, 2017

RFC 1522

trait Trait {
    fn bar() {}
}     //X
fn foo() -> impl Trait { unimplemented!() }
fn main() {
    foo().bar();
}        //^

I know that impl Trait is an unstable feature, but is used increasingly in rustc itself, and I tired of stumbling over type inference failures caused by this =D

It is pretty easy to implement - just create new type TyAnon in package org.rust.lang.core.types.ty with single field of type List<BoundElement<RsTraitItem>>, instantiate it in Declarations.inferTypeReferenceType for element of type RsImplTraitType and then add a special case for it in the ImplLookup.findImplsAndTraits just like TyTypeParameter.


You can find more info about how to start contributing to Intellij-Rust in CONTRIBUTING.md, and some info about our architecure in ARCHITECTURE.md. If you have any questions about this issue, you can ask them right here or in our gitter. If you decided to grab this issue, please leave a comment here and put yourself in the worklist.

@vlad20012 vlad20012 added E-easy Issue required minimal knowledge about platform and project codebase help wanted labels Sep 4, 2017
@vlad20012 vlad20012 added the E-mentor Issues with known solution and most likely with instruction how to fix/implement it label Sep 20, 2017
oleg-semenov added a commit to oleg-semenov/intellij-rust that referenced this issue Nov 19, 2017
@oleg-semenov
Copy link
Contributor

Hi @vlad20012, i decided to try to do this.

oleg-semenov added a commit to oleg-semenov/intellij-rust that referenced this issue Nov 19, 2017
oleg-semenov added a commit to oleg-semenov/intellij-rust that referenced this issue Nov 20, 2017
oleg-semenov added a commit to oleg-semenov/intellij-rust that referenced this issue Nov 20, 2017
oleg-semenov added a commit to oleg-semenov/intellij-rust that referenced this issue Nov 21, 2017
oleg-semenov added a commit to oleg-semenov/intellij-rust that referenced this issue Nov 22, 2017
bors bot added a commit that referenced this issue Nov 22, 2017
2048: (TY): add inference of `impl Trait` r=vlad20012 a=oleg-semenov

This fulfills the issue:
#1692

<!--
Hello and thank you for the pull request!

We don't have any strict rules about pull requests, but you might check
https://github.com/intellij-rust/intellij-rust/blob/master/CONTRIBUTING.md
for some hints!

Note that we need an electronic CLA for contributions:
https://github.com/intellij-rust/intellij-rust/blob/master/CONTRIBUTING.md#cla

After you sign the CLA, please add your name to
https://github.com/intellij-rust/intellij-rust/blob/master/CONTRIBUTORS.txt

:)
-->
@Undin Undin added rust Issues about new language features rust 2018 Issues related to 2018 Rust edition labels Jul 2, 2018
@Undin Undin mentioned this issue Jul 2, 2018
37 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-easy Issue required minimal knowledge about platform and project codebase E-mentor Issues with known solution and most likely with instruction how to fix/implement it help wanted rust Issues about new language features rust 2018 Issues related to 2018 Rust edition
Projects
None yet
Development

No branches or pull requests

3 participants