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 12 pull requests #126016

Merged
merged 41 commits into from
Jun 5, 2024
Merged

Commits on May 13, 2024

  1. Add size_of, size_of_val, align_of, and align_of_val to the p…

    …relude
    
    Many, many projects use `size_of` to get the size of a type. However,
    it's also often equally easy to hardcode a size (e.g. `8` instead of
    `size_of::<u64>()`). Minimizing friction in the use of `size_of` helps
    ensure that people use it and make code more self-documenting.
    
    The name `size_of` is unambiguous: the name alone, without any prefix or
    path, is self-explanatory and unmistakeable for any other functionality.
    Adding it to the prelude cannot produce any name conflicts, as any local
    definition will silently shadow the one from the prelude. Thus, we don't
    need to wait for a new edition prelude to add it.
    
    Add `size_of_val`, `align_of`, and `align_of_val` as well, with similar
    justification: widely useful, self-explanatory, unmistakeable for
    anything else, won't produce conflicts.
    joshtriplett committed May 13, 2024
    Configuration menu
    Copy the full SHA
    a5a60d7 View commit details
    Browse the repository at this point in the history

Commits on May 28, 2024

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

Commits on Jun 2, 2024

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

Commits on Jun 3, 2024

  1. Allow static mut definitions with #[linkage]

    Unlike static declarations with #[linkage], for definitions rustc
    doesn't rewrite it to add an extra indirection.
    bjorn3 committed Jun 3, 2024
    Configuration menu
    Copy the full SHA
    07dc3eb View commit details
    Browse the repository at this point in the history

Commits on Jun 4, 2024

  1. Configuration menu
    Copy the full SHA
    8f08625 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    e9957b9 View commit details
    Browse the repository at this point in the history
  3. bootstrap: implement new feature bootstrap-self-test

    Some of the bootstrap logics should be ignored during unit tests because they either
    make the tests take longer or cause them to fail. Therefore we need to be able to exclude
    them from the bootstrap when it's called by unit tests. This change introduces a new feature
    called `bootstrap-self-test`, which is enabled on bootstrap unit tests by default. This allows
    us to keep the logic separate between compiler builds and bootstrap tests without needing messy
    workarounds (like checking if target names match those in the unit tests).
    
    Signed-off-by: onur-ozkan <work@onurozkan.dev>
    onur-ozkan committed Jun 4, 2024
    Configuration menu
    Copy the full SHA
    8f677e8 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    2bad3d1 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    59e2074 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    5d26f58 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    ac96fa4 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    ec8fa17 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    2a21937 View commit details
    Browse the repository at this point in the history

Commits on Jun 5, 2024

  1. UNICODE_ARRAY and ASCII_ARRAY fixes.

    - Avoid unnecessary escaping of single quotes within string literals.
    - Add a missing blank line between two `UNICODE_ARRAY` sections.
    nnethercote committed Jun 5, 2024
    Configuration menu
    Copy the full SHA
    e1ae0fa View commit details
    Browse the repository at this point in the history
  2. Don't use the word "parse" for lexing operations.

    Lexing converts source text into a token stream. Parsing converts a
    token stream into AST fragments. This commit renames several lexing
    operations that have "parse" in the name. I think these names have been
    subtly confusing me for years.
    
    This is just a `s/parse/lex/` on function names, with one exception:
    `parse_stream_from_source_str` becomes `source_str_to_stream`, to make
    it consistent with the existing `source_file_to_stream`. The commit also
    moves that function's location in the file to be just above
    `source_file_to_stream`.
    
    The commit also cleans up a few comments along the way.
    nnethercote committed Jun 5, 2024
    Configuration menu
    Copy the full SHA
    d1215da View commit details
    Browse the repository at this point in the history
  3. Inline and remove error_malformed_cfg_attr_missing.

    It has a single call site.
    
    This also means `CFG_ATTR_{GRAMMAR_HELP,NOTE_REF}` can be moved into
    `parse_cfg_attr`, now that it's the only function that uses them.
    And the commit removes the line break in the URL.
    nnethercote committed Jun 5, 2024
    Configuration menu
    Copy the full SHA
    f657624 View commit details
    Browse the repository at this point in the history
  4. Rename maybe_file_to_stream as maybe_source_file_to_stream.

    Because it takes an `Lrc<SourceFile>`, and for consistency with
    `source_file_to_stream`.
    nnethercote committed Jun 5, 2024
    Configuration menu
    Copy the full SHA
    769ca3f View commit details
    Browse the repository at this point in the history
  5. Remove stream_to_parser.

    It's a zero-value wrapper of `Parser::new`.
    nnethercote committed Jun 5, 2024
    Configuration menu
    Copy the full SHA
    3c321b9 View commit details
    Browse the repository at this point in the history
  6. Improve panictry_buffer!.

    - Convert it from a macro to a function, which is nicer.
    - Rename it as `unwrap_or_emit_fatal`, which is clearer.
    - Fix the comment. In particular, `panictry!` no longer exists.
    - Remove the unnecessary `use` declaration.
    nnethercote committed Jun 5, 2024
    Configuration menu
    Copy the full SHA
    af13b48 View commit details
    Browse the repository at this point in the history
  7. Remove low-value comments.

    The first one is out-of-date -- there are no longer functions expr,
    item, stmt. And I don't know what a "HOF" is.
    
    The second one doesn't really tell you anything.
    nnethercote committed Jun 5, 2024
    Configuration menu
    Copy the full SHA
    29e6e28 View commit details
    Browse the repository at this point in the history
  8. Rename maybe_source_file_to_parser as `maybe_new_parser_from_source…

    …_file`.
    
    For consistency with `new_parser_from_{file,source_str}` and
    `maybe_new_parser_from_source_str`.
    nnethercote committed Jun 5, 2024
    Configuration menu
    Copy the full SHA
    191b76e View commit details
    Browse the repository at this point in the history
  9. Use source_str_to_stream in a test file.

    It does exactly what is required.
    nnethercote committed Jun 5, 2024
    Configuration menu
    Copy the full SHA
    8964106 View commit details
    Browse the repository at this point in the history
  10. Inline and remove parse_crate{,_attrs}_from_{file,source_str}.

    All four functions are simple and have a single call site.
    
    This requires making `Parser::parse_inner_attributes` public, which is
    no big deal.
    nnethercote committed Jun 5, 2024
    Configuration menu
    Copy the full SHA
    25972ae View commit details
    Browse the repository at this point in the history
  11. Reorder source_str_to_stream arguments.

    It's the only one of these functions where `psess` isn't the first
    argument.
    nnethercote committed Jun 5, 2024
    Configuration menu
    Copy the full SHA
    ab192a0 View commit details
    Browse the repository at this point in the history
  12. Inline and remove source_file_to_stream.

    It has a single call site.
    nnethercote committed Jun 5, 2024
    Configuration menu
    Copy the full SHA
    264dbe4 View commit details
    Browse the repository at this point in the history
  13. Make top-level rustc_parse functions fallible.

    Currently we have an awkward mix of fallible and infallible functions:
    ```
           new_parser_from_source_str
     maybe_new_parser_from_source_str
           new_parser_from_file
    (maybe_new_parser_from_file)        // missing
          (new_parser_from_source_file) // missing
     maybe_new_parser_from_source_file
           source_str_to_stream
     maybe_source_file_to_stream
    ```
    We could add the two missing functions, but instead this commit removes
    of all the infallible ones and renames the fallible ones leaving us with
    these which are all fallible:
    ```
    new_parser_from_source_str
    new_parser_from_file
    new_parser_from_source_file
    source_str_to_stream
    source_file_to_stream
    ```
    This requires making `unwrap_or_emit_fatal` public so callers of
    formerly infallible functions can still work.
    
    This does make some of the call sites slightly more verbose, but I think
    it's worth it for the simpler API. Also, there are two `catch_unwind`
    calls and one `catch_fatal_errors` call in this diff that become
    removable thanks this change. (I will do that in a follow-up PR.)
    nnethercote committed Jun 5, 2024
    Configuration menu
    Copy the full SHA
    b903733 View commit details
    Browse the repository at this point in the history
  14. rustfmt: Remove an unnecessary catch_unwind use.

    The `Input::File` and `Input::Text` cases should be very similar.
    However, currently the `Input::File` case uses `catch_unwind` because,
    until recently (rust-lang#125815) there was a fallible version of
    `new_parser_from_source_str` but only an infallible version of
    `new_parser_from_file`. This difference wasn't fundamental, just an
    overlooked gap in the API of `rustc_parse`.
    
    Both of those operations are now fallible, so the `Input::File` and
    `Input::Text` cases can made more similar, with no need for
    `catch_unwind`. This also lets us simplify an `Option<Vec<Diag>>` to
    `Vec<Diag>`.
    nnethercote committed Jun 5, 2024
    Configuration menu
    Copy the full SHA
    2d4e7df View commit details
    Browse the repository at this point in the history
  15. Add another test for hidden types capturing lifetimes that outlive bu…

    …t arent mentioned in substs
    compiler-errors committed Jun 5, 2024
    Configuration menu
    Copy the full SHA
    dd6bca5 View commit details
    Browse the repository at this point in the history
  16. Rollup merge of rust-lang#123168 - joshtriplett:size-of-prelude, r=Am…

    …anieu
    
    Add `size_of` and `size_of_val` and `align_of` and `align_of_val` to the prelude
    
    (Note: need to update the PR to add `align_of` and `align_of_val`, and remove the second commit with the myriad changes to appease the lint.)
    
    Many, many projects use `size_of` to get the size of a type. However,
    it's also often equally easy to hardcode a size (e.g. `8` instead of
    `size_of::<u64>()`). Minimizing friction in the use of `size_of` helps
    ensure that people use it and make code more self-documenting.
    
    The name `size_of` is unambiguous: the name alone, without any prefix or
    path, is self-explanatory and unmistakeable for any other functionality.
    Adding it to the prelude cannot produce any name conflicts, as any local
    definition will silently shadow the one from the prelude. Thus, we don't
    need to wait for a new edition prelude to add it.
    workingjubilee committed Jun 5, 2024
    Configuration menu
    Copy the full SHA
    9ccc7b7 View commit details
    Browse the repository at this point in the history
  17. Rollup merge of rust-lang#125273 - onur-ozkan:bootstrap-self-test, r=…

    …albertlarsan68
    
    bootstrap: implement new feature `bootstrap-self-test`
    
    Some of the bootstrap logics should be ignored during unit tests because they either make the tests take longer or cause them to fail. Therefore we need to be able to exclude them from the bootstrap when it's called by unit tests. This change introduces a new feature called `bootstrap-self-test`, which is enabled on bootstrap unit tests by default. This allows us to keep the logic separate between compiler builds and bootstrap tests without needing messy workarounds (like checking if target names match those in the unit tests).
    
    Also, resolves rust-lang#122090 (without having to create separate modules)
    workingjubilee committed Jun 5, 2024
    Configuration menu
    Copy the full SHA
    0f86182 View commit details
    Browse the repository at this point in the history
  18. Rollup merge of rust-lang#125683 - Oneirical:patience-testing-test, r…

    …=jieyouxu
    
    Rewrite `suspicious-library`, `resolve-rename` and `incr-prev-body-beyond-eof` `run-make` tests in `rmake.rs` format
    
    Part of rust-lang#121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html).
    
    Some oddly specific ignore flags in `incr-prev-body-beyond-eof`:
    
    ```rs
    // ignore-none
    // ignore-nvptx64-nvidia-cuda
    ```
    
    it could be interesting to run a try job, but it seems there is no nvidia-cuda in the CI settings (`jobs.yml`).
    
    try-job: armhf-gnu
    workingjubilee committed Jun 5, 2024
    Configuration menu
    Copy the full SHA
    0f2b34a View commit details
    Browse the repository at this point in the history
  19. Rollup merge of rust-lang#125815 - nnethercote:rustc_parse-top-level-…

    …cleanups, r=spastorino
    
    `rustc_parse` top-level cleanups
    
    A bunch of improvements in and around `compiler/rustc_parse/src/lib.rs`. Many of the changes streamline the API in that file from this (12 functions and one macro):
    ```
        name                              args                  return type
        ----                              ----                  -----------
        panictry_buffer!                  Result<T, Vec<Diag>>  T
    
    pub parse_crate_from_file             path                  PResult<Crate>
    pub parse_crate_attrs_from_file       path                  PResult<AttrVec>
    pub parse_crate_from_source_str       name,src              PResult<Crate>
    pub parse_crate_attrs_from_source_str name,src              PResult<AttrVec>
    
    pub new_parser_from_source_str        name,src              Parser
    pub maybe_new_parser_from_source_str  name,src              Result<Parser, Vec<Diag>>
    pub new_parser_from_file              path,error_sp         Parser
        maybe_source_file_to_parser       srcfile               Result<Parser, Vec<Diag>>
    
    pub parse_stream_from_source_str      name,src,override_sp  TokenStream
    pub source_file_to_stream             srcfile,override_sp   TokenStream
        maybe_file_to_stream              srcfile,override_sp   Result<TokenStream, Vec<Diag>>
    
    pub stream_to_parser                  stream,subparser_name Parser
    ```
    to this:
    ```
        name                              args                  return type
        ----                              ----                  -----------
        unwrap_or_emit_fatal              Result<T, Vec<Diag>>  T
    
    pub new_parser_from_source_str        name,src              Result<Parser, Vec<Diag>>
    pub new_parser_from_file              path,error_sp         Result<Parser, Vec<Diag>>
        new_parser_from_source_file       srcfile               Result<Parser, Vec<Diag>>
    
    pub source_str_to_stream              name,src,override_sp  Result<TokenStream, Vec<Diag>>
        source_file_to_stream             srcfile,override_sp   Result<TokenStream, Vec<Diag>>
    ```
    I found the old API quite confusing, with lots of similar-sounding function names and no clear structure. I think the new API is much better.
    
    r? `@spastorino`
    workingjubilee committed Jun 5, 2024
    Configuration menu
    Copy the full SHA
    05b4674 View commit details
    Browse the repository at this point in the history
  20. Rollup merge of rust-lang#125903 - petrochenkov:upctxt3, r=nnethercote

    rustc_span: Inline some hot functions
    
    Found while benchmarking rust-lang#125829.
    workingjubilee committed Jun 5, 2024
    Configuration menu
    Copy the full SHA
    0096138 View commit details
    Browse the repository at this point in the history
  21. Rollup merge of rust-lang#125906 - compiler-errors:simplify-method-er…

    …ror-args, r=fmease
    
    Remove a bunch of redundant args from `report_method_error`
    
    Rebased on top of rust-lang#125397 because I had originally asked there (rust-lang#125397 (comment)) for this change to be made, but I just chose to do it myself.
    
    r? fmease
    workingjubilee committed Jun 5, 2024
    Configuration menu
    Copy the full SHA
    78d9a7e View commit details
    Browse the repository at this point in the history
  22. Rollup merge of rust-lang#125920 - bjorn3:allow_static_mut_linkage_de…

    …f, r=Urgau
    
    Allow static mut definitions with #[linkage]
    
    Unlike static declarations with #[linkage], for definitions rustc doesn't rewrite it to add an extra indirection.
    
    This was accidentally disallowed in rust-lang#125046.
    
    cc rust-lang#125800 (comment)
    workingjubilee committed Jun 5, 2024
    Configuration menu
    Copy the full SHA
    2b89c1b View commit details
    Browse the repository at this point in the history
  23. Rollup merge of rust-lang#125982 - xTachyon:fix-linked-list, r=jhpratt

    Make deleting on LinkedList aware of the allocator
    
    Fixed rust-lang#125950
    workingjubilee committed Jun 5, 2024
    Configuration menu
    Copy the full SHA
    448159c View commit details
    Browse the repository at this point in the history
  24. Rollup merge of rust-lang#125995 - kpreid:const-uninit-stable, r=Nils…

    …trieb
    
    Use inline const blocks to create arrays of `MaybeUninit`.
    
    This PR contains 2 changes enabled by the fact that [`inline_const` is now stable](rust-lang#104087), and was split out of rust-lang#125082.
    
    1. Use inline const instead of `unsafe` to construct arrays in `MaybeUninit` examples.
    
       Rationale: Demonstrate good practice of avoiding `unsafe` code where it is not strictly necessary.
    
    4. Use inline const instead of `unsafe` to implement `MaybeUninit::uninit_array()`.
    
        This is arguably giving the compiler more work to do, in exchange for eliminating just one single internal unsafe block, so it's less certain that this is good on net.
    
    r​? `@Nilstrieb`
    workingjubilee committed Jun 5, 2024
    Configuration menu
    Copy the full SHA
    6b6b698 View commit details
    Browse the repository at this point in the history
  25. Rollup merge of rust-lang#125996 - tmiasko:closure-recursively-reacha…

    …ble, r=oli-obk
    
    Closures are recursively reachable
    
    Fixes rust-lang#126012.
    workingjubilee committed Jun 5, 2024
    Configuration menu
    Copy the full SHA
    eb2819e View commit details
    Browse the repository at this point in the history
  26. Rollup merge of rust-lang#126003 - Lokathor:new-co-maintainer, r=comp…

    …iler-errors
    
    Add a co-maintainer for the two ARMv4T targets
    
    This adds a second maintainer to the `armv4t-none-eabi` and `thumbv4t-none-eabi` targets, a necessary step on the path to Tier 2
    workingjubilee committed Jun 5, 2024
    Configuration menu
    Copy the full SHA
    669935e View commit details
    Browse the repository at this point in the history
  27. Rollup merge of rust-lang#126004 - compiler-errors:captures-soundness…

    …-test, r=lcnr
    
    Add another test for hidden types capturing lifetimes that outlive but arent mentioned in substs
    
    Another test to make sure future implementations of rust-lang#116040 don't have any subtle unsoundness 🤔
    
    r? types
    workingjubilee committed Jun 5, 2024
    Configuration menu
    Copy the full SHA
    f12fe3a View commit details
    Browse the repository at this point in the history