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

Array inference #1103

Merged
merged 3 commits into from
Apr 7, 2019
Merged

Array inference #1103

merged 3 commits into from
Apr 7, 2019

Conversation

Lapz
Copy link
Contributor

@Lapz Lapz commented Apr 3, 2019

Fixes the final item in #394. The only problem is that infering the repeat cause some types to be infered twices.
i.e

fn test() {
    let y = unknown;
    [y, &y];
}

results in the following diff:

[11; 48) '{     ...&y]; }': ()
[21; 22) 'y': &{unknown}
[25; 32) 'unknown': &{unknown}
-[38; 45) '[y, &y]': [&&{unknown}]
+[38; 45) '[y, &y]': [&&{unknown};usize]
[39; 40) 'y': &{unknown}
+[39; 40) 'y': &{unknown}
[42; 44) '&y': &&{unknown}
[43; 44) 'y': &{unknown}

Should the code produce two inference results for 'y' and if not could any tell me what needs to change.

@Lapz Lapz force-pushed the array-inference branch from 1a934d1 to cbfa23e Compare April 5, 2019 09:59
@Lapz Lapz marked this pull request as ready for review April 5, 2019 10:00
@Lapz Lapz force-pushed the array-inference branch from aea9156 to 0cda050 Compare April 5, 2019 21:02
Copy link
Member

@flodiebold flodiebold left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, let's just remove the remaining repeat method :)

@Lapz Lapz force-pushed the array-inference branch from 4b11244 to 0a7336f Compare April 6, 2019 15:07
@@ -17,8 +17,8 @@ pub use self::{
generated::*,
traits::*,
tokens::*,
extensions::{PathSegmentKind, StructKind, FieldKind, SelfParamKind},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like you removed this use, probably while rebasing, that's why it's currently not building

Lapz added 3 commits April 7, 2019 13:23
changed the  display for fixed array types,
Added Array Enum to ra_hir/expr
@Lapz Lapz force-pushed the array-inference branch from 0504c49 to b27fa33 Compare April 7, 2019 12:27
@flodiebold
Copy link
Member

Thanks!

bors r+

bors bot added a commit that referenced this pull request Apr 7, 2019
1103: Array inference r=flodiebold a=Lapz

Fixes the final item in #394. The only problem is that infering the repeat cause some types to be infered twices.
i.e 
```rust
fn test() {
    let y = unknown;
    [y, &y];
}
```

results in the following diff:

```diff
[11; 48) '{     ...&y]; }': ()
[21; 22) 'y': &{unknown}
[25; 32) 'unknown': &{unknown}
-[38; 45) '[y, &y]': [&&{unknown}]
+[38; 45) '[y, &y]': [&&{unknown};usize]
[39; 40) 'y': &{unknown}
+[39; 40) 'y': &{unknown}
[42; 44) '&y': &&{unknown}
[43; 44) 'y': &{unknown}
```

Should the code produce two inference results for 'y' and if not could any tell me what needs to change.

Co-authored-by: Lenard Pratt <l3np27@gmail.com>
@bors
Copy link
Contributor

bors bot commented Apr 7, 2019

Build succeeded

@bors bors bot merged commit b27fa33 into rust-lang:master Apr 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants