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

TY: several type inference fixes #8835

Merged
merged 4 commits into from
May 17, 2022
Merged

TY: several type inference fixes #8835

merged 4 commits into from
May 17, 2022

Conversation

vlad20012
Copy link
Member

@vlad20012 vlad20012 commented May 13, 2022

  1. Fix lambda parameter type inference. This fixes a case where a lambda is assigned to a variable and types on lambda parameters should be inferred later:
fn main() {
    let a = |b| {
        b;
    };//^ i32
    foo(a);
}

fn foo<T: FnOnce(i32)>(_: T) {}
  1. Fix ? operator with Try trait. The (unstable) Try trait was moved to core::ops::try_trait::Try and its associated types was renamed. Now ? works for Poll<Result>, for example.
use std::task::Poll;
fn foo(p: Poll<Result<i32, ()>>) -> Result<(), ()> {
    let a = p?;
    a;
  //^ Poll<i32>
    Ok(())
}
  1. Fix for loop over type parameter implementing Iterator:
fn foo<I: Iterator<Item = i32>>(a: I) {
    for b in a {
        b;
    } //^ i32
}
  1. Derive recently added unstable Destruct trait for all types. It is used as a trait bound in stdlib

@vlad20012 vlad20012 added the fix Pull requests that fix some bug(s) label May 13, 2022
@vlad20012 vlad20012 self-assigned this May 13, 2022
Copy link
Member

@mchernyavsky mchernyavsky left a comment

Choose a reason for hiding this comment

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

bors r+

@mchernyavsky mchernyavsky added this to In Progress in To test via automation May 17, 2022
@bors
Copy link
Contributor

bors bot commented May 17, 2022

Build succeeded:

@bors bors bot merged commit 9482e47 into master May 17, 2022
To test automation moved this from In Progress to Test May 17, 2022
@bors bors bot deleted the ty-fixes branch May 17, 2022 15:02
@github-actions github-actions bot added this to the v171 milestone May 17, 2022
@mili-l mili-l self-assigned this May 18, 2022
@mili-l mili-l moved this from Test to Done in To test May 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix Pull requests that fix some bug(s)
Projects
To test
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

3 participants