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 15 pull requests #88824

Merged
merged 38 commits into from
Sep 11, 2021
Merged

Rollup of 15 pull requests #88824

merged 38 commits into from
Sep 11, 2021

Commits on Jun 9, 2021

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

Commits on Jul 28, 2021

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

Commits on Aug 31, 2021

  1. Configuration menu
    Copy the full SHA
    f56034e 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

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

Commits on Sep 5, 2021

  1. Tweak write_fmt doc.

    Previous version wrongly used `but` while the two parts of the sentence are not contradicting but completing with each other.
    kraktus authored Sep 5, 2021
    Configuration menu
    Copy the full SHA
    bfb2b02 View commit details
    Browse the repository at this point in the history

Commits on Sep 6, 2021

  1. 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. Configuration menu
    Copy the full SHA
    32188d7 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    021b8ff View commit details
    Browse the repository at this point in the history
  3. 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. Configuration menu
    Copy the full SHA
    0bf16af View commit details
    Browse the repository at this point in the history
  2. Emit proper errors 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 Sep 9, 2021
    Configuration menu
    Copy the full SHA
    b21425d View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    79adda9 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    57fcb2e View commit details
    Browse the repository at this point in the history

Commits on Sep 10, 2021

  1. Configuration menu
    Copy the full SHA
    81ff53f View commit details
    Browse the repository at this point in the history
  2. Fix typo option -> options.

    gz authored Sep 10, 2021
    Configuration menu
    Copy the full SHA
    5d4d3bd View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    64344cc View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    eda4cfb View commit details
    Browse the repository at this point in the history
  5. Rollup merge of rust-lang#85200 - FabianWolff:issue-84647, r=nikomats…

    …akis
    
    Ignore derived Clone and Debug implementations during dead code analysis
    
    This pull request fixes rust-lang#84647. Derived implementations of `Clone` and `Debug` always trivially read all fields, so "field is never read" dead code warnings are never triggered. Arguably, though, a user most likely will only be interested in whether _their_ code ever reads those fields, which is the behavior I have implemented here.
    
    Note that implementations of `Clone` and `Debug` are only ignored if they are `#[derive(...)]`d; a custom `impl Clone/Debug for ...` will still be analyzed normally (i.e. if a custom `Clone` implementation uses all fields of the struct, this will continue to suppress dead code warnings about unused fields); this seemed like the least intrusive change to me (although it would be easy to change — just drop the `&& [impl_]item.span.in_derive_expansion()` in the if conditions).
    
    The only thing that I am slightly unsure about is that in rust-lang#84647, `@matklad` said
    > Doesn't seem easy to fix though :(
    
    However, it _was_ pretty straightforward to fix, so did I perhaps overlook something obvious? `@matklad,` could you weigh in on this?
    Manishearth authored Sep 10, 2021
    Configuration menu
    Copy the full SHA
    acfe7c4 View commit details
    Browse the repository at this point in the history
  6. Rollup merge of rust-lang#86165 - m-ou-se:proc-macro-span-shrink, r=d…

    …tolnay
    
    Add proc_macro::Span::{before, after}.
    
    This adds `proc_macro::Span::before()` and `proc_macro::Span::after()` to get a zero width span at the start or end of the span.
    
    These are equivalent to rustc's `Span::shrink_to_lo()` and `Span::shrink_to_hi()` but with a less cryptic name. They are useful when generating diagnostlics like "missing \<thing\> after \<thing\>".
    
    E.g.
    
    ```rust
    syn::Error::new(ident.span().after(), "missing `:` after field name").into_compile_error()
    ```
    Manishearth authored Sep 10, 2021
    Configuration menu
    Copy the full SHA
    000dbd2 View commit details
    Browse the repository at this point in the history
  7. Rollup merge of rust-lang#87088 - FabianWolff:issue-87060, r=estebank

    Fix stray notes when the source code is not available
    
    Fixes rust-lang#87060. To reproduce it with a local build of rustc, you have to copy the compiler (e.g. `build/x86_64-unknown-linux-gnu/stage1/`) somewhere and then rename the compiler source directory (maybe there is a smarter way as well). Then, rustc won't find the standard library sources and report stray notes such as
    ```
    note: deref defined here
    ```
    with no location for "here". Another example I've found is this:
    ```rust
    use std::ops::Add;
    
    fn foo<T: Add<Output=()>>(x: T) {
        x + x;
    }
    
    fn main() {}
    ```
    ```
    error[E0382]: use of moved value: `x`
      --> binop.rs:4:9
       |
    3  | fn foo<T: Add<Output=()>>(x: T) {
       |                           - move occurs because `x` has type `T`, which does not implement the `Copy` trait
    4  |     x + x;
       |     ----^
       |     |   |
       |     |   value used here after move
       |     `x` moved due to usage in operator
       |
    note: calling this operator moves the left-hand side
    help: consider further restricting this bound
       |
    3  | fn foo<T: Add<Output=()> + Copy>(x: T) {
       |                          ^^^^^^
    
    error: aborting due to previous error
    ```
    where, again, the note is supposed to point somewhere but doesn't. I have fixed this by checking whether the corresponding source code is actually available before emitting the note.
    Manishearth authored Sep 10, 2021
    Configuration menu
    Copy the full SHA
    e422612 View commit details
    Browse the repository at this point in the history
  8. Rollup merge of rust-lang#87441 - ibraheemdev:i-86865, r=cjgillot

    Emit suggestion when passing byte literal to format macro
    
    Closes rust-lang#86865
    Manishearth authored Sep 10, 2021
    Configuration menu
    Copy the full SHA
    358a018 View commit details
    Browse the repository at this point in the history
  9. 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`
    Manishearth authored Sep 10, 2021
    Configuration menu
    Copy the full SHA
    dc003dd View commit details
    Browse the repository at this point in the history
  10. 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
    Manishearth authored Sep 10, 2021
    Configuration menu
    Copy the full SHA
    257f5ad View commit details
    Browse the repository at this point in the history
  11. 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
    Manishearth authored Sep 10, 2021
    Configuration menu
    Copy the full SHA
    1043549 View commit details
    Browse the repository at this point in the history
  12. 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)
    Manishearth authored Sep 10, 2021
    Configuration menu
    Copy the full SHA
    0438048 View commit details
    Browse the repository at this point in the history
  13. Rollup merge of rust-lang#88667 - kraktus:patch-1, r=dtolnay

    Tweak `write_fmt` doc.
    
    Found this weird sentence while reading the docs.
    Manishearth authored Sep 10, 2021
    Configuration menu
    Copy the full SHA
    8368af0 View commit details
    Browse the repository at this point in the history
  14. Rollup merge of rust-lang#88720 - GuillaumeGomez:rustdoc-coverage-fie…

    …lds-count, r=Manishearth
    
    Rustdoc coverage fields count
    
    Follow-up of rust-lang#88688.
    
    Instead of requiring enum tuple variant fields and tuple struct fields to be documented, we count them if they are documented, otherwise we don't include them in the count.
    
    r? `@Manishearth`
    Manishearth authored Sep 10, 2021
    Configuration menu
    Copy the full SHA
    e0e3d85 View commit details
    Browse the repository at this point in the history
  15. 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``
    Manishearth authored Sep 10, 2021
    Configuration menu
    Copy the full SHA
    1c091e4 View commit details
    Browse the repository at this point in the history
  16. Rollup merge of rust-lang#88742 - GuillaumeGomez:fix-table-in-docbloc…

    …ks, r=nbdd0121
    
    Fix table in docblocks
    
    "Overwrite" of rust-lang#88702.
    
    Instead of adding a z-index to the sidebar (which only hides the issue, doesn't fix it), I wrap `<table>` elements inside a `<div>` and limit all chidren of `.docblock` elements' width to prevent having the scrollbar on the whole doc block.
    
    ![Screenshot from 2021-09-08 15-11-24](https://user-images.githubusercontent.com/3050060/132515740-71796515-e74f-429f-ba98-2596bdbf781c.png)
    
    Thanks `@nbdd0121` for `overflow-x: auto;`. ;)
    
    r? `@notriddle`
    Manishearth authored Sep 10, 2021
    Configuration menu
    Copy the full SHA
    130e2e1 View commit details
    Browse the repository at this point in the history
  17. Rollup merge of rust-lang#88776 - dns2utf8:rustdoc_workaround_1000_el…

    …ements_grid_bug, r=GuillaumeGomez
    
    Workaround blink/chromium grid layout limitation of 1000 rows
    
    I made this in case we don't come up with a better solution in time.
    
    See rust-lang#88545 for more details.
    
    A rendered version of the standard library is hosted here:
    https://data.estada.ch/rustdoc-nightly_497ee321af_2021-09-09/core/arch/arm/index.html
    
    r? `@GuillaumeGomez` `@jsha`
    Manishearth authored Sep 10, 2021
    Configuration menu
    Copy the full SHA
    3aaec55 View commit details
    Browse the repository at this point in the history
  18. Rollup merge of rust-lang#88807 - jruderman:which_reverses, r=joshtri…

    …plett
    
    Fix typo in docs for iterators
    Manishearth authored Sep 10, 2021
    Configuration menu
    Copy the full SHA
    0055303 View commit details
    Browse the repository at this point in the history
  19. Rollup merge of rust-lang#88812 - gz:patch-1, r=ehuss

    Fix typo `option` -> `options`.
    Manishearth authored Sep 10, 2021
    Configuration menu
    Copy the full SHA
    f77311b View commit details
    Browse the repository at this point in the history