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 7 pull requests #88774

Closed
wants to merge 31 commits into from

Commits on Aug 31, 2021

  1. Emit proper errors when on missing closure braces

    This commit focuses on emitting clean errors for the following syntax
    error:
    
    ```
    Some(42).map(|a|
        dbg!(a);
        a
    );
    ```
    
    Previous implementation tried to recover after parsing the closure body
    (the `dbg` expression) by replacing the next `;` with a `,`, which made
    the next expression belong to the next function argument. As such, the
    following errors were emitted (among others):
      - the semicolon token was not expected,
      - a is not in scope,
      - Option::map is supposed to take one argument, not two.
    
    This commit allows us to gracefully handle this situation by adding
    giving the parser the ability to remember when it has just parsed a
    closure body inside a function call. When this happens, we can treat the
    unexpected `;` specifically and try to parse as much statements as
    possible in order to eat the whole block. When we can't parse statements
    anymore, we generate a clean error indicating that the braces are
    missing, and return an ExprKind::Err.
    Sasha Pourcelot committed Aug 31, 2021
    Configuration menu
    Copy the full SHA
    1f5568d View commit details
    Browse the repository at this point in the history

Commits on Sep 1, 2021

  1. Fix grammatical error in error message

    Sasha Pourcelot committed Sep 1, 2021
    Configuration menu
    Copy the full SHA
    3bdda1c View commit details
    Browse the repository at this point in the history
  2. Fix misplaced match arm

    Sasha Pourcelot committed Sep 1, 2021
    Configuration menu
    Copy the full SHA
    eabe41c View commit details
    Browse the repository at this point in the history
  3. Put the expr error inside the closure body

    Sasha Pourcelot committed Sep 1, 2021
    Configuration menu
    Copy the full SHA
    e8e76b7 View commit details
    Browse the repository at this point in the history
  4. Add ruby-style closure ui tests

    Sasha Pourcelot committed Sep 1, 2021
    Configuration menu
    Copy the full SHA
    dbe56f4 View commit details
    Browse the repository at this point in the history

Commits on Sep 2, 2021

  1. Configuration menu
    Copy the full SHA
    733bdd0 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    f23003d View commit details
    Browse the repository at this point in the history
  3. Add comment about ruby_style_closure status

    Sasha Pourcelot committed Sep 2, 2021
    Configuration menu
    Copy the full SHA
    3a334a0 View commit details
    Browse the repository at this point in the history

Commits on Sep 3, 2021

  1. Put some notes in a separate note block

    Sasha Pourcelot committed Sep 3, 2021
    Configuration menu
    Copy the full SHA
    191bb83 View commit details
    Browse the repository at this point in the history
  2. Merge branch 'master' into scrabsha/closure-missing-braces

    Sasha Pourcelot committed Sep 3, 2021
    Configuration menu
    Copy the full SHA
    1beee86 View commit details
    Browse the repository at this point in the history
  3. Fix merge imports

    Sasha Pourcelot committed Sep 3, 2021
    Configuration menu
    Copy the full SHA
    41ac2c6 View commit details
    Browse the repository at this point in the history
  4. Group closure-related spans in a structure

    Sasha Pourcelot committed Sep 3, 2021
    Configuration menu
    Copy the full SHA
    4107396 View commit details
    Browse the repository at this point in the history

Commits on Sep 4, 2021

  1. Use summary_opts() for Markdown summaries

    It was accidentally changed to use `opts()` in rust-lang#86451.
    
    I also renamed `opts()` to `main_body_opts()` to make this kind of
    accidental change less likely.
    camelid committed Sep 4, 2021
    Configuration menu
    Copy the full SHA
    208a5fd View commit details
    Browse the repository at this point in the history
  2. Enable all main body Markdown options for summaries

    This fixes odd renderings when these features are used in the first
    paragraph of documentation for an item. This is an extension of rust-lang#87270.
    camelid committed Sep 4, 2021
    Configuration menu
    Copy the full SHA
    2cc7b7c View commit details
    Browse the repository at this point in the history
  3. Rename clo -> closure

    Sasha Pourcelot committed Sep 4, 2021
    Configuration menu
    Copy the full SHA
    e9e8b61 View commit details
    Browse the repository at this point in the history
  4. last_closure_body -> current_closure

    Sasha Pourcelot committed Sep 4, 2021
    Configuration menu
    Copy the full SHA
    f91161d View commit details
    Browse the repository at this point in the history

Commits on Sep 6, 2021

  1. Slightly reword the error message

    Sasha Pourcelot committed Sep 6, 2021
    Configuration menu
    Copy the full SHA
    99c46c0 View commit details
    Browse the repository at this point in the history
  2. fix ICE on hidden tuple variant fields

    this also renders them as `_`, which rustdoc previously did not.
    Emilgardis committed Sep 6, 2021
    Configuration menu
    Copy the full SHA
    4a915ac View commit details
    Browse the repository at this point in the history

Commits on Sep 7, 2021

  1. test: add case for mutating iterator

    Note that this incorrectly suggests a shared borrow,
    but at least we know it's happening.
    notriddle committed Sep 7, 2021
    Configuration menu
    Copy the full SHA
    d6ff916 View commit details
    Browse the repository at this point in the history
  2. RustWrapper: avoid deleted unclear attribute methods

    These were deleted in https://reviews.llvm.org/D108614, and in C++ I
    definitely see the argument for their removal. I didn't try and
    propagate the changes up into higher layers of rustc in this change
    because my initial goal was to get rustc working against LLVM HEAD
    promptly, but I'm happy to follow up with some refactoring to make the
    API on the Rust side match the LLVM API more directly (though the way
    the enum works in Rust makes the API less scary IMO).
    
    r? @nagisa cc @nikic
    durin42 committed Sep 7, 2021
    Configuration menu
    Copy the full SHA
    532bb80 View commit details
    Browse the repository at this point in the history
  3. RustWrapper: just use the *AtIndex funcs directly

    Otherwise we're kind of reimplementing the inverse of the well-named
    methods, and that's not a direction we want to go.
    durin42 committed Sep 7, 2021
    Configuration menu
    Copy the full SHA
    484b79b View commit details
    Browse the repository at this point in the history

Commits on Sep 8, 2021

  1. RustWrapper: remove some uses of AttrBuilder

    Turns out we can also use Attribute::get*() methods here, and avoid the
    AttrBuilder and an extra helper method here.
    durin42 committed Sep 8, 2021
    Configuration menu
    Copy the full SHA
    4d04540 View commit details
    Browse the repository at this point in the history

Commits on Sep 9, 2021

  1. Improve error when an .rlib can't be parsed

    This usually describes either an error in the compiler itself or some
    sort of IO error. Either way, we should report it to the user rather
    than just saying "crate not found".
    
    This only gives an error if the crate couldn't be loaded at all - if the
    compiler finds another .rlib or .rmeta file which was valid, it will
    continue to compile the crate.
    
    Example output:
    ```
    error[E0785]: found invalid metadata files for crate `foo`
     --> bar.rs:3:24
      |
    3 |         println!("{}", foo::FOO_11_49[0]);
      |                        ^^^
      |
      = warning: failed to parse rlib '/home/joshua/test-rustdoc/libfoo.rlib': Invalid archive extended name offset
    ```
    jyn514 committed Sep 9, 2021
    Configuration menu
    Copy the full SHA
    8549598 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    c86c634 View commit details
    Browse the repository at this point in the history
  3. Rollup merge of rust-lang#88368 - jyn514:metadata-error, r=petrochenkov

     Improve error when an .rlib can't be parsed
    
    This usually describes either an error in the compiler itself or some
    sort of IO error. Either way, we should report it to the user rather
    than just saying "crate not found".
    
    This only gives an error if the crate couldn't be loaded at all - if the
    compiler finds another .rlib or .rmeta file which was valid, it will
    continue to compile the crate.
    
    Example output:
    ```
    error[E0785]: found invalid metadata files for crate `foo`
     --> bar.rs:3:24
      |
    3 |         println!("{}", foo::FOO_11_49[0]);
      |                        ^^^
      |
      = warning: failed to parse rlib '/home/joshua/test-rustdoc/libfoo.rlib': Invalid archive extended name offset
    ```
    
    cc `@ehuss`
    GuillaumeGomez authored Sep 9, 2021
    Configuration menu
    Copy the full SHA
    e8342de View commit details
    Browse the repository at this point in the history
  4. Rollup merge of rust-lang#88546 - scrabsha:scrabsha/closure-missing-b…

    …races, r=estebank
    
    Emit proper errors when on missing closure braces
    
    This commit focuses on emitting clean errors for the following syntax
    error:
    
    ```
    Some(42).map(|a|
        dbg!(a);
        a
    );
    ```
    
    Previous implementation tried to recover after parsing the closure body
    (the `dbg` expression) by replacing the next `;` with a `,`, which made
    the next expression belong to the next function argument. As such, the
    following errors were emitted (among others):
      - the semicolon token was not expected,
      - a is not in scope,
      - Option::map is supposed to take one argument, not two.
    
    This commit allows us to gracefully handle this situation by adding
    giving the parser the ability to remember when it has just parsed a
    closure body inside a function call. When this happens, we can treat the
    unexpected `;` specifically and try to parse as much statements as
    possible in order to eat the whole block. When we can't parse statements
    anymore, we generate a clean error indicating that the braces are
    missing, and return an ExprKind::Err.
    
    Closes rust-lang#88065.
    
    r? `@estebank`
    GuillaumeGomez authored Sep 9, 2021
    Configuration menu
    Copy the full SHA
    09de880 View commit details
    Browse the repository at this point in the history
  5. Rollup merge of rust-lang#88578 - notriddle:notriddle/suggest-add-ref…

    …erence-to-for-loop-iter, r=nagisa
    
    fix(rustc): suggest `items` be borrowed in `for i in items[x..]`
    
    Fixes rust-lang#87994
    GuillaumeGomez authored Sep 9, 2021
    Configuration menu
    Copy the full SHA
    2471041 View commit details
    Browse the repository at this point in the history
  6. Rollup merge of rust-lang#88632 - camelid:md-opts, r=CraftSpider

    Fix issues with Markdown summary options
    
    - Use `summary_opts()` for Markdown summaries
    - Enable all main body Markdown options for summaries
    GuillaumeGomez authored Sep 9, 2021
    Configuration menu
    Copy the full SHA
    ff0f5f9 View commit details
    Browse the repository at this point in the history
  7. Rollup merge of rust-lang#88639 - Emilgardis:fix-issue-88600, r=Guill…

    …aumeGomez
    
    rustdoc: Fix ICE with `doc(hidden)` on tuple variant fields
    
    Fixes rust-lang#88600.
    
    ```rust
    pub struct H;
    pub struct S;
    
    pub enum FooEnum {
        HiddenTupleItem(#[doc(hidden)] H),
        MultipleHidden(#[doc(hidden)] H, #[doc(hidden)] H),
        MixedHiddenFirst(#[doc(hidden)] H, S),
        MixedHiddenLast(S, #[doc(hidden)] H),
        HiddenStruct {
            #[doc(hidden)]
            h: H,
            s: S,
        },
    }
    ```
    
    Generates
    ![image](https://user-images.githubusercontent.com/1502855/132259152-382f9517-c2a0-41d8-acd0-64e5993931fc.png)
    GuillaumeGomez authored Sep 9, 2021
    Configuration menu
    Copy the full SHA
    fa7834a View commit details
    Browse the repository at this point in the history
  8. Rollup merge of rust-lang#88732 - durin42:llvm-14-attrs-2, r=nikic

    RustWrapper: avoid deleted unclear attribute methods
    
    These were deleted in https://reviews.llvm.org/D108614, and in C++ I
    definitely see the argument for their removal. I didn't try and
    propagate the changes up into higher layers of rustc in this change
    because my initial goal was to get rustc working against LLVM HEAD
    promptly, but I'm happy to follow up with some refactoring to make the
    API on the Rust side match the LLVM API more directly (though the way
    the enum works in Rust makes the API less scary IMO).
    
    r? `@nagisa` cc `@nikic`
    GuillaumeGomez authored Sep 9, 2021
    Configuration menu
    Copy the full SHA
    f31ac61 View commit details
    Browse the repository at this point in the history
  9. Rollup merge of rust-lang#88745 - hnj2:allow-trait-impl-missing-code,…

    … r=GuillaumeGomez
    
    Allow missing code examples in trait impls.
    
    Excludes Trait implementations from the items that need to have doc code examples when using the `rustdoc::missing_doc_code_examples` lint.
    
    For details see rust-lang#88741
    
    fixes rust-lang#88741
    
    r? `@jyn514`
    GuillaumeGomez authored Sep 9, 2021
    Configuration menu
    Copy the full SHA
    26a98a7 View commit details
    Browse the repository at this point in the history