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 10 pull requests #93491

Closed
wants to merge 26 commits into from

Commits on Nov 7, 2021

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

Commits on Jan 15, 2022

  1. Configuration menu
    Copy the full SHA
    d671948 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    3f609b7 View commit details
    Browse the repository at this point in the history

Commits on Jan 21, 2022

  1. Compute indent never relative to current column

    Previously the pretty printer would compute indentation always relative
    to whatever column a block begins at, like this:
    
        fn demo(arg1: usize,
                arg2: usize);
    
    This is never the thing to do in the dominant contemporary Rust style.
    Rustfmt's default and the style used by the vast majority of Rust
    codebases is block indentation:
    
        fn demo(
            arg1: usize,
            arg2: usize,
        );
    
    where every indentation level is a multiple of 4 spaces and each level
    is indented relative to the indentation of the previous line, not the
    position that the block starts in.
    dtolnay committed Jan 21, 2022
    Configuration menu
    Copy the full SHA
    104961e View commit details
    Browse the repository at this point in the history
  2. Fix some double indents on exprs containing blocks

    The `print_expr` method already places an `ibox(INDENT_UNIT)` around
    every expr that gets printed. Some exprs were then using `self.head`
    inside of that, which does its own `cbox(INDENT_UNIT)`, resulting in two
    levels of indentation:
    
        while true {
                stuff;
            }
    
    This commit fixes those cases to produce the expected single level of
    indentation within every expression containing a block.
    
        while true {
            stuff;
        }
    dtolnay committed Jan 21, 2022
    Configuration menu
    Copy the full SHA
    956f1ca View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    03e4001 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    269b5a4 View commit details
    Browse the repository at this point in the history

Commits on Jan 26, 2022

  1. Configuration menu
    Copy the full SHA
    ecd06e1 View commit details
    Browse the repository at this point in the history
  2. Make char::DecodeUtf16::size_hist more precise

    New implementation takes into account contents of `self.buf` and rounds
    lower bound up instead of down.
    WaffleLapkin committed Jan 26, 2022
    Configuration menu
    Copy the full SHA
    cd4245d View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    9c8cd1f View commit details
    Browse the repository at this point in the history

Commits on Jan 28, 2022

  1. Fix wrong assumption in DecodeUtf16::size_hint

    `self.buf` can contain a surrogate, but only a leading one.
    WaffleLapkin committed Jan 28, 2022
    Configuration menu
    Copy the full SHA
    2c97d10 View commit details
    Browse the repository at this point in the history

Commits on Jan 29, 2022

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

Commits on Jan 30, 2022

  1. unix: Use metadata for DirEntry::file_type fallback

    When `DirEntry::file_type` fails to match a known `d_type`, we should
    fall back to `DirEntry::metadata` instead of a bare `lstat`, because
    this is faster and more reliable on targets with `fstatat`.
    cuviper committed Jan 30, 2022
    Configuration menu
    Copy the full SHA
    d70b9c0 View commit details
    Browse the repository at this point in the history
  2. Fix an edge case in chat::DecodeUtf16::size_hint

    There are cases, when data in the buf might or might not be an error.
    WaffleLapkin committed Jan 30, 2022
    Configuration menu
    Copy the full SHA
    17cd2cd View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    cde240c View commit details
    Browse the repository at this point in the history
  4. review the total_cmp documentation

    The documentation has been restructured to split out a brief summary
    paragraph out from the following elaborating paragraphs.
    
    I also attempted my hand at wording improvements and adding articles
    where I felt them missing, but being non-native english speaker these
    may need more thorough review.
    nagisa committed Jan 30, 2022
    Configuration menu
    Copy the full SHA
    78efb07 View commit details
    Browse the repository at this point in the history
  5. Rollup merge of rust-lang#90277 - pierwill:fix-70258-inference-terms,…

    … r=jackh726
    
    Improve terminology around "after typeck"
    
    Closes rust-lang#70258.
    matthiaskrgr authored Jan 30, 2022
    Configuration menu
    Copy the full SHA
    99fd534 View commit details
    Browse the repository at this point in the history
  6. Rollup merge of rust-lang#91607 - FabianWolff:issue-91560-const-span,…

    … r=jackh726
    
    Make `span_extend_to_prev_str()` more robust
    
    Fixes rust-lang#91560. The logic in `span_extend_to_prev_str()` is currently quite brittle and fails if there is extra whitespace or something else in between, and it also should return an `Option` but doesn't currently.
    matthiaskrgr authored Jan 30, 2022
    Configuration menu
    Copy the full SHA
    1b22492 View commit details
    Browse the repository at this point in the history
  7. Rollup merge of rust-lang#92918 - compiler-errors:gat-expr-lifetime-e…

    …lision, r=jackh726
    
    Allow eliding GATs in expression position
    
    Thoughts on whether this is worthwhile?
    
    Fixes rust-lang#92836
    
    r? `@jackh726`
    matthiaskrgr authored Jan 30, 2022
    Configuration menu
    Copy the full SHA
    ef64c52 View commit details
    Browse the repository at this point in the history
  8. Rollup merge of rust-lang#93039 - terrarier2111:fix-field-help, r=nagisa

    Don't suggest inaccessible fields
    
    Fixes: rust-lang#92999
    matthiaskrgr authored Jan 30, 2022
    Configuration menu
    Copy the full SHA
    781ed1e View commit details
    Browse the repository at this point in the history
  9. Rollup merge of rust-lang#93155 - dtolnay:blockindent, r=nagisa

    Switch pretty printer to block-based indentation
    
    This PR backports dtolnay/prettyplease@401d60c from the `prettyplease` crate into `rustc_ast_pretty`.
    
    A before and after:
    
    ```diff
    - let res =
    -     ((::alloc::fmt::format as
    -          for<'r> fn(Arguments<'r>) -> String {format})(((::core::fmt::Arguments::new_v1
    -                                                             as
    -                                                             fn(&[&'static str], &[ArgumentV1]) -> Arguments {Arguments::new_v1})((&([("test"
    -                                                                                                                                          as
    -                                                                                                                                          &str)]
    -                                                                                                                                        as
    -                                                                                                                                        [&str; 1])
    -                                                                                                                                      as
    -                                                                                                                                      &[&str; 1]),
    -                                                                                                                                  (&([]
    -                                                                                                                                        as
    -                                                                                                                                        [ArgumentV1; 0])
    -                                                                                                                                      as
    -                                                                                                                                      &[ArgumentV1; 0]))
    -                                                            as
    -                                                            Arguments))
    -         as String);
    + let res =
    +     ((::alloc::fmt::format as
    +             for<'r> fn(Arguments<'r>) -> String {format})(((::core::fmt::Arguments::new_v1
    +                 as
    +                 fn(&[&'static str], &[ArgumentV1]) -> Arguments {Arguments::new_v1})((&([("test"
    +                             as &str)] as [&str; 1]) as
    +                 &[&str; 1]),
    +             (&([] as [ArgumentV1; 0]) as &[ArgumentV1; 0])) as
    +             Arguments)) as String);
    ```
    
    Previously the pretty printer would compute indentation always relative to whatever column a block begins at, like this:
    
    ```rust
    fn demo(arg1: usize,
            arg2: usize);
    ```
    
    This is never the thing to do in the dominant contemporary Rust style. Rustfmt's default and the style used by the vast majority of Rust codebases is block indentation:
    
    ```rust
    fn demo(
        arg1: usize,
        arg2: usize,
    );
    ```
    
    where every indentation level is a multiple of 4 spaces and each level is indented relative to the indentation of the previous line, not the position that the block starts in.
    
    By itself this PR doesn't get perfect formatting in all cases, but it is the smallest possible step in clearly the right direction. More backports from `prettyplease` to tune the ibox/cbox indent levels around various AST node types are upcoming.
    matthiaskrgr authored Jan 30, 2022
    Configuration menu
    Copy the full SHA
    b3f609b View commit details
    Browse the repository at this point in the history
  10. Rollup merge of rust-lang#93347 - WaffleLapkin:better_char_decode_utf…

    …16_size_hint, r=dtolnay
    
    Make `char::DecodeUtf16::size_hist` more precise
    
    New implementation takes into account contents of `self.buf` and rounds lower bound up instead of down.
    
    Fixes rust-lang#88762
    Revival of rust-lang#88763
    matthiaskrgr authored Jan 30, 2022
    Configuration menu
    Copy the full SHA
    b984ac0 View commit details
    Browse the repository at this point in the history
  11. Rollup merge of rust-lang#93403 - nagisa:total-cmp-review, r=joshtrip…

    …lett
    
    review the total_cmp documentation
    
    The documentation has been restructured to split out a brief summary
    paragraph out from the following elaborating paragraphs.
    
    I also attempted my hand at wording improvements and adding articles
    where I felt them missing, but being non-native english speaker these
    may need more thorough review.
    
    cc rust-lang#72599
    matthiaskrgr authored Jan 30, 2022
    Configuration menu
    Copy the full SHA
    02b5ff3 View commit details
    Browse the repository at this point in the history
  12. Rollup merge of rust-lang#93462 - ChrisDenton:systime-doc, r=joshtrip…

    …lett
    
    Document `SystemTime` platform precision
    
    Fixes rust-lang#88822
    matthiaskrgr authored Jan 30, 2022
    Configuration menu
    Copy the full SHA
    ed50b23 View commit details
    Browse the repository at this point in the history
  13. Rollup merge of rust-lang#93471 - cuviper:direntry-file_type-stat, r=…

    …the8472
    
    unix: Use metadata for `DirEntry::file_type` fallback
    
    When `DirEntry::file_type` fails to match a known `d_type`, we should
    fall back to `DirEntry::metadata` instead of a bare `lstat`, because
    this is faster and more reliable on targets with `fstatat`.
    matthiaskrgr authored Jan 30, 2022
    Configuration menu
    Copy the full SHA
    6007644 View commit details
    Browse the repository at this point in the history
  14. Rollup merge of rust-lang#93485 - est31:remove_curly, r=joshtriplett

    core: Remove some redundant {}s from the sorting code
    matthiaskrgr authored Jan 30, 2022
    Configuration menu
    Copy the full SHA
    060bfcf View commit details
    Browse the repository at this point in the history