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

[wg-async-await] Drop async fn arguments in async block #59135

Closed
wants to merge 7 commits into from

Commits on Mar 24, 2019

  1. Add test for drop order in async functions.

    This tests that async functions drop parameters in the same order as
    regular functions.
    davidtwco committed Mar 24, 2019
    Configuration menu
    Copy the full SHA
    5ce3540 View commit details
    Browse the repository at this point in the history
  2. Introduce LocalSource into the AST.

    This will be used to keep track of the origin of a local in the AST. In
    particular, it will be used by `async fn` lowering for the locals in
    `let <pat>: <ty> = __arg0;` statements.
    davidtwco committed Mar 24, 2019
    Configuration menu
    Copy the full SHA
    d1be529 View commit details
    Browse the repository at this point in the history
  3. Add AsyncArgument to AST.

    This commit adds an `AsyncArgument` struct to the AST that contains the
    generated argument and statement that will be used in HIR lowering, name
    resolution and def collection.
    davidtwco committed Mar 24, 2019
    Configuration menu
    Copy the full SHA
    70b7b78 View commit details
    Browse the repository at this point in the history
  4. Move async fn arguments into closure.

    This commit takes advantage of `AsyncArgument` type that was added in a
    previous commit to replace the arguments of the `async fn` in the HIR
    and add statements to move the bindings from the new arguments to the
    pattern from the old argument.
    
    For example, the async function `foo` below:
    
        async fn foo((x, _y): (T, V)) {
            async move {
            }
        }
    
    becomes:
    
        async fn foo(__arg0: (T, V)) {
            async move {
                let (x, _y) = __arg0;
            }
        }
    davidtwco committed Mar 24, 2019
    Configuration menu
    Copy the full SHA
    f566e98 View commit details
    Browse the repository at this point in the history
  5. Enforce consistent drop order w/ async methods.

    This commit extends the previous commit to apply to trait methods as
    well as free functions.
    davidtwco committed Mar 24, 2019
    Configuration menu
    Copy the full SHA
    f8150f4 View commit details
    Browse the repository at this point in the history
  6. Do not specify type in generated let bindings.

    This avoids issues with `impl_trait_in_bindings` as the type from the
    argument is normally used as the let binding, but `impl Trait` is
    unstable in binding position.
    davidtwco committed Mar 24, 2019
    Configuration menu
    Copy the full SHA
    ea93cb5 View commit details
    Browse the repository at this point in the history
  7. Introduce ArgSource for diagnostics.

    This commit introduces an `ArgSource` enum that is lowered into the HIR
    so that diagnostics can correctly refer to the argument pattern's
    original name rather than the generated pattern.
    davidtwco committed Mar 24, 2019
    Configuration menu
    Copy the full SHA
    468bbb8 View commit details
    Browse the repository at this point in the history