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

Rollup of 9 pull requests #69796

Merged
merged 32 commits into from
Mar 7, 2020
Merged

Rollup of 9 pull requests #69796

merged 32 commits into from
Mar 7, 2020

Commits on Feb 16, 2020

  1. Parse & reject postfix operators after casts

    This adds parsing for expressions like 'x as Ty[0]' which will
    immediately error out, but still give the rest of the parser a valid
    parse tree to continue.
    daboross committed Feb 16, 2020
    Configuration menu
    Copy the full SHA
    940f657 View commit details
    Browse the repository at this point in the history
  2. Refactor out error case & apply suggestions.

    This is almost entirely refactoring and message changing, with the
    single behavioral change of panicking for unexpected output.
    daboross committed Feb 16, 2020
    Configuration menu
    Copy the full SHA
    5ce9b80 View commit details
    Browse the repository at this point in the history
  3. Type ascription outputs a Type, not Cast

    Previously this just errored out on all usages of type ascription,
    which isn't helpful.
    daboross committed Feb 16, 2020
    Configuration menu
    Copy the full SHA
    4fc0532 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    0cf2049 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    f82ca8b View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    5dd6464 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    e3eefe2 View commit details
    Browse the repository at this point in the history
  8. Remove trailing whitespace

    daboross committed Feb 16, 2020
    Configuration menu
    Copy the full SHA
    c2d7ffb View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    8ef3da0 View commit details
    Browse the repository at this point in the history

Commits on Feb 22, 2020

  1. Configuration menu
    Copy the full SHA
    fa1f547 View commit details
    Browse the repository at this point in the history
  2. Use multipart suggestion

    This is a modified version of estebank's suggestion, with a bit of
    extra cleanup now that we don't need the different cases for if we can
    turn a span into a string or not.
    daboross committed Feb 22, 2020
    Configuration menu
    Copy the full SHA
    f434c6e View commit details
    Browse the repository at this point in the history

Commits on Feb 29, 2020

  1. Replace ptr hashing with ptr casting

    Implementes suggeseted changes by Centril.
    
    This checks whether the memory location of the cast remains the same
    after atttempting to parse a postfix operator after a cast has been
    parsed. If the address is not the same, an illegal postfix operator
    was parsed.
    
    Previously the code generated a hash of the pointer, which was overly
    complex and inefficent. Casting the pointers and comparing them
    is simpler and more effcient.
    daboross committed Feb 29, 2020
    Configuration menu
    Copy the full SHA
    453c505 View commit details
    Browse the repository at this point in the history

Commits on Mar 3, 2020

  1. Configuration menu
    Copy the full SHA
    d3e5177 View commit details
    Browse the repository at this point in the history

Commits on Mar 4, 2020

  1. test(pattern): add tests for combinations of pattern features

    Reference issue rust-lang#67311
    
    Tests combinations of the following pattern features:
    - bindings_after_at
    - or_patterns
    - slice_patterns
    - box_patterns
    thekuom committed Mar 4, 2020
    Configuration menu
    Copy the full SHA
    5456114 View commit details
    Browse the repository at this point in the history
  2. test(pattern): harden tests for or-patterns with slice-patterns

    Some of the nested OR paths were being missed
    thekuom committed Mar 4, 2020
    Configuration menu
    Copy the full SHA
    b4788a7 View commit details
    Browse the repository at this point in the history
  3. fix tidy error

    thekuom committed Mar 4, 2020
    Configuration menu
    Copy the full SHA
    ea7b3c3 View commit details
    Browse the repository at this point in the history
  4. Use subslice patterns in slice methods

    For all of the methods that pick off the first or last element, we can
    use subslice patterns to implement them directly, rather than relying on
    deeper indexing function calls. At a minimum, this means the generated
    code will rely less on inlining for performance, but in some cases it
    also optimizes better.
    cuviper committed Mar 4, 2020
    Configuration menu
    Copy the full SHA
    53be0cc View commit details
    Browse the repository at this point in the history

Commits on Mar 6, 2020

  1. Update deprecation version to 1.42 for Error::description

    Error::description is deprecated as of version 1.42, as the commit was
    not in the release for 1.41.
    dylnuge committed Mar 6, 2020
    Configuration menu
    Copy the full SHA
    9afbf28 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    2d0c5b4 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    83980ac View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    1631b4d View commit details
    Browse the repository at this point in the history
  5. Add a regression test

    JohnTitor committed Mar 6, 2020
    Configuration menu
    Copy the full SHA
    3d67649 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    125159f View commit details
    Browse the repository at this point in the history

Commits on Mar 7, 2020

  1. Rollup merge of rust-lang#67741 - estebank:point-at-pat-def, r=Centril

    When encountering an Item in a pat context, point at the item def
    
    ```
    error[E0308]: mismatched types
      --> $DIR/const-in-struct-pat.rs:8:17
       |
    LL | struct foo;
       | ----------- `foo` defined here
    ...
    LL |     let Thing { foo } = t;
       |                 ^^^ expected struct `std::string::String`, found struct `foo`
       |
       = note: `foo` is interpreted as a unit struct, not a new binding
    help: you can bind the struct field to a different name
       |
    LL |     let Thing { foo: other_foo } = t;
       |                 ^^^^^^^^^^^^^^
    ```
    ```
    error[E0308]: mismatched types
      --> $DIR/const.rs:14:9
       |
    LL | const FOO: Foo = Foo{bar: 5};
       | ----------------------------- constant defined here
    ...
    LL |         FOO => {},
       |         ^^^
       |         |
       |         expected `&Foo`, found struct `Foo`
       |         `FOO` is interpreted as a constant, not a new binding
       |         help: use different name to introduce a new binding: `other_foo`
    ```
    
    Fix rust-lang#55631, fix rust-lang#48062, cc rust-lang#42876.
    Centril authored Mar 7, 2020
    Configuration menu
    Copy the full SHA
    e8bb6c0 View commit details
    Browse the repository at this point in the history
  2. Rollup merge of rust-lang#68985 - daboross:fix-35813, r=Centril

    Parse & reject postfix operators after casts
    
    This adds an explicit error messages for when parsing `x as Type[0]` or similar expressions. Our add an extra parse case for parsing any postfix operator (dot, indexing, method calls, await) that triggers directly after parsing `as` expressions.
    
    My friend and I worked on this together, but they're still deciding on a github username and thus I'm submitting this for both of us.
    
    It will immediately error out, but will also provide the rest of the parser with a useful parse tree to deal with.
    
    There's one decision we made in how this produces the parse tree. In the situation `&x as T[0]`, one could imagine this parsing as either `&((x as T)[0])` or `((&x) as T)[0]`. We chose the latter for ease of implementation, and as it seemed the most intuitive.
    
    Feedback welcome! This is our first change to the parser section, and it might be completely horrible.
    
    Fixes rust-lang#35813.
    Centril authored Mar 7, 2020
    Configuration menu
    Copy the full SHA
    111724f View commit details
    Browse the repository at this point in the history
  3. Rollup merge of rust-lang#69656 - matthiaskrgr:iter_nth_zero, r=oli-obk

    Use .next() instead of .nth(0) on iterators.
    Centril authored Mar 7, 2020
    Configuration menu
    Copy the full SHA
    5d1433b View commit details
    Browse the repository at this point in the history
  4. Rollup merge of rust-lang#69680 - petrochenkov:nont4, r=Centril

    rustc_expand: Factor out `Annotatable::into_tokens` to a separate method
    
    Minor refactoring salvaged from rust-lang#69594.
    r? @Centril
    Centril authored Mar 7, 2020
    Configuration menu
    Copy the full SHA
    e9c3ddc View commit details
    Browse the repository at this point in the history
  5. Rollup merge of rust-lang#69690 - thekuom:test/67311-extend-bindings-…

    …after-at-tests, r=Centril
    
    test(pattern): add tests for combinations of pattern features
    
    Reference issue rust-lang#67311
    
    Tests combinations of the following pattern features:
    - bindings_after_at
    - or_patterns
    - slice_patterns
    - box_patterns
    
    r? @Centril
    Centril authored Mar 7, 2020
    Configuration menu
    Copy the full SHA
    ba1f6cb View commit details
    Browse the repository at this point in the history
  6. Rollup merge of rust-lang#69706 - cuviper:subslice-methods, r=Centril

    Use subslice patterns in slice methods
    
    For all of the methods that pick off the first or last element, we can
    use subslice patterns to implement them directly, rather than relying on
    deeper indexing function calls. At a minimum, this means the generated
    code will rely less on inlining for performance, but in some cases it
    also optimizes better.
    Centril authored Mar 7, 2020
    Configuration menu
    Copy the full SHA
    b25fb9e View commit details
    Browse the repository at this point in the history
  7. Rollup merge of rust-lang#69727 - JohnTitor:sugg-unwrap, r=estebank

    Avoid using `unwrap()` in suggestions
    
    Fixes rust-lang#69725
    
    r? @estebank
    Centril authored Mar 7, 2020
    Configuration menu
    Copy the full SHA
    93a57cf View commit details
    Browse the repository at this point in the history
  8. Rollup merge of rust-lang#69754 - Dylnuge:dylnuge/dep-version, r=Mark…

    …-Simulacrum
    
    Update deprecation version to 1.42 for Error::description
    
    Error::description is deprecated as of version 1.42, as the commit was
    not in the release for 1.41.
    
    Fixes rust-lang#69751
    Centril authored Mar 7, 2020
    Configuration menu
    Copy the full SHA
    ca90c3d View commit details
    Browse the repository at this point in the history
  9. Rollup merge of rust-lang#69782 - matthiaskrgr:redundant_field_name_r…

    …ep, r=cramertj
    
    Don't redundantly repeat field names (clippy::redundant_field_names)
    Centril authored Mar 7, 2020
    Configuration menu
    Copy the full SHA
    709325a View commit details
    Browse the repository at this point in the history