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 6 pull requests #110990

Closed
wants to merge 16 commits into from

Commits on Apr 21, 2023

  1. Configuration menu
    Copy the full SHA
    2bf5f77 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    4edba55 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    eb00459 View commit details
    Browse the repository at this point in the history

Commits on Apr 28, 2023

  1. Configuration menu
    Copy the full SHA
    dc94522 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    10c77b1 View commit details
    Browse the repository at this point in the history
  3. rustdoc: fix weird margins between Deref impl items

    In the old setup, if the dereffed-to item has multiple impl blocks,
    each one gets its own `div.impl-items` in the section, but there
    are no headers separating them. Since the last method in a
    `div.impl-items` has no bottom margin, and there are no margins
    between these divs, there is no margin between the last method
    of one impl and the first method of the following impl.
    
    This patch fixes it by simplifying the HTML. Each Deref block gets
    exactly one `div.impl-items`, no matter how many impl blocks it
    actually has.
    notriddle committed Apr 28, 2023
    Configuration menu
    Copy the full SHA
    2299ba1 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    fb252b9 View commit details
    Browse the repository at this point in the history

Commits on Apr 29, 2023

  1. Deny the unsafe_op_in_unsafe_fn lint in

    `rustc_arena`.
    JohnBobbo96 committed Apr 29, 2023
    Configuration menu
    Copy the full SHA
    47fb8e6 View commit details
    Browse the repository at this point in the history
  2. windows: kill rust-analyzer-proc-macro-srv before deleting stage0 dir…

    …ectory
    
    This fixes the following recurring error on windows:
    ```
    Traceback (most recent call last):
      File "C:\Users\jyn\src\rust\x.py", line 29, in <module>
        bootstrap.main()
      File "C:\Users\jyn\src\rust\src\bootstrap\bootstrap.py", line 963, in main
        bootstrap(args)
      File "C:\Users\jyn\src\rust\src\bootstrap\bootstrap.py", line 927, in bootstrap
        build.download_toolchain()
      File "C:\Users\jyn\src\rust\src\bootstrap\bootstrap.py", line 437, in download_toolchain
        shutil.rmtree(bin_root)
      File "C:\Users\jyn\AppData\Local\Programs\Python\Python311\Lib\shutil.py", line 759, in rmtree
        return _rmtree_unsafe(path, onerror)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "C:\Users\jyn\AppData\Local\Programs\Python\Python311\Lib\shutil.py", line 617, in _rmtree_unsafe
        _rmtree_unsafe(fullname, onerror)
      File "C:\Users\jyn\AppData\Local\Programs\Python\Python311\Lib\shutil.py", line 622, in _rmtree_unsafe
        onerror(os.unlink, fullname, sys.exc_info())
      File "C:\Users\jyn\AppData\Local\Programs\Python\Python311\Lib\shutil.py", line 620, in _rmtree_unsafe
        os.unlink(fullname)
    PermissionError: [WinError 5] Access is denied: 'C:\\Users\\jyn\\src\\rust\\build\\x86_64-pc-windows-msvc\\stage0\\bin\\rust-analyzer-proc-macro-srv.exe'
    ```
    jyn514 committed Apr 29, 2023
    Configuration menu
    Copy the full SHA
    500c19c View commit details
    Browse the repository at this point in the history
  3. Add rustdoc::unescaped_backtick lint

    Lukas Markeffsky committed Apr 29, 2023
    Configuration menu
    Copy the full SHA
    4f15a77 View commit details
    Browse the repository at this point in the history
  4. Rollup merge of rust-lang#105848 - lukas-code:backticks, r=GuillaumeG…

    …omez,jyn514,notriddle
    
    rustdoc: Add a new lint for broken inline code
    
    This patch adds `rustdoc::unescaped_backticks`, a new rustdoc lint that will detect broken inline code nodes.
    
    The lint woks by finding stray backticks and with some heuristics tries to guess where the second backtick might be missing.
    
    Here is how it looks:
    ```rust
    #![warn(rustdoc::unescaped_backticks)]
    
    /// `add(a, b) is the same as `add(b, a)`.
    pub fn add(a: i32, b: i32) -> i32 { a + b }
    ```
    ```text
    warning: unescaped backtick
     --> src/lib.rs:3:41
      |
    3 | /// `add(a, b) is the same as `add(b, a)`.
      |                                         ^
      |
    help: a previous inline code might be longer than expected
      |
    3 | /// `add(a, b)` is the same as `add(b, a)`.
      |               +
    help: if you meant to use a literal backtick, escape it
      |
    3 | /// `add(a, b) is the same as `add(b, a)\`.
      |                                         +
    ```
    
    If we can't get proper spans, for example if the doc comment comes from a macro expansion, we print the suggestion in help messages instead. Here's a [real-world example](https://docs.rs/tracing-subscriber/0.3.17/tracing_subscriber/layer/trait.Filter.html#method.max_level_hint):
    
    ```text
    warning: unescaped backtick
        --> /tracing-subscriber-0.3.17/src/layer/mod.rs:1400:9
         |
    1400 | /         /// Returns an optional hint of the highest [verbosity level][level] that
    1401 | |         /// this `Filter` will enable.
    1402 | |         ///
    1403 | |         /// If this method returns a [`LevelFilter`], it will be used as a hint to
    ...    |
    1427 | |         /// [`Interest`]: tracing_core::subscriber::Interest
    1428 | |         /// [rebuild]: tracing_core::callsite::rebuild_interest_cache
         | |_____________________________________________________________________^
         |
         = help: a previous inline code might be longer than expected
                  change: Therefore, if the `Filter will change the value returned by this
                 to this: Therefore, if the `Filter` will change the value returned by this
         = help: if you meant to use a literal backtick, escape it
                  change: [`rebuild_interest_cache`][rebuild] is called after the value of the max
                 to this: [`rebuild_interest_cache\`][rebuild] is called after the value of the max
    ```
    
    You can find more examples [here](https://gist.github.com/lukas-code/7678ddf5c608aee97b3a669de80d3465).
    
    A limitation of the current implementation is, that it cannot suggest removing misplaced backticks, for example [here](https://docs.rs/tikv-jemalloc-sys/0.5.3+5.3.0-patched/tikv_jemalloc_sys/fn.mallctl.html).
    
    The lint is allowed by default ~~and nightly-only~~ for now, ~~but without a feature gate. This is similar to how `rustdoc::invalid_html_tags` and `rustdoc::bare_urls` were handled.~~
    GuillaumeGomez authored Apr 29, 2023
    Configuration menu
    Copy the full SHA
    97d363c View commit details
    Browse the repository at this point in the history
  5. Rollup merge of rust-lang#109421 - mhammerly:extern-force-option, r=p…

    …etrochenkov
    
    Add `force` option for `--extern` flag
    
    When `--extern force:foo=libfoo.so` is passed to `rustc` and `foo` is not actually used in the crate, ~inject an `extern crate foo;` statement into the AST~ force it to be resolved anyway in `CrateLoader::postprocess()`. This allows you to, for instance, inject a `#[panic_handler]` implementation into a `#![no_std]` crate without modifying its source so that it can be built as a `dylib`. It may also be useful for `#![panic_runtime]` or `#[global_allocator]`/`#![default_lib_allocator]` implementations.
    
    My work previously involved integrating Rust into an existing C/C++ codebase which was built with Buck and shipped on, among other platforms, Android. When targeting Android, Buck builds all "native" code with shared linkage* so it can be loaded from Java/Kotlin. My project was not itself `#![no_std]`, but many of our dependencies were, and they would fail to build with shared linkage due to a lack of a panic handler. With this change, that project can add the new `force` option to the `std` dependency it already explicitly provides to every crate to solve this problem.
    
    *This is an oversimplification - Buck has a couple features for aggregating dependencies into larger shared libraries, but none that I think sustainably solve this problem.
    
    ~The AST injection happens after macro expansion around where we similarly inject a test harness and proc-macro harness. The resolver's list of actually-used extern flags is populated during macro expansion, and if any of our `--extern` arguments have the `force` option and weren't already used, we inject an `extern crate` statement for them. The injection logic was added in `rustc_builtin_macros` as that's where similar injections for tests, proc-macros, and std/core already live.~
    
    (New contributor - grateful for feedback and guidance!)
    GuillaumeGomez authored Apr 29, 2023
    Configuration menu
    Copy the full SHA
    828c080 View commit details
    Browse the repository at this point in the history
  6. Rollup merge of rust-lang#110644 - pietroalbini:pa-json-formatting-te…

    …sts, r=Mark-Simulacrum
    
    Update tests for libtest `--format json`
    
    This PR makes the test work on beta and stable, and adds a test ensuring the option is not available on beta and stable. Backported these commits from rust-lang#110414.
    GuillaumeGomez authored Apr 29, 2023
    Configuration menu
    Copy the full SHA
    7736e83 View commit details
    Browse the repository at this point in the history
  7. Rollup merge of rust-lang#110950 - JohnBobbo96:rustc_arena_unsafe_fn,…

    … r=Nilstrieb
    
    Deny the `unsafe_op_in_unsafe_fn` lint in `rustc_arena`.
    
    r? `@Nilstrieb`
    GuillaumeGomez authored Apr 29, 2023
    Configuration menu
    Copy the full SHA
    4a702c0 View commit details
    Browse the repository at this point in the history
  8. Rollup merge of rust-lang#110964 - notriddle:notriddle/deref-impl, r=…

    …GuillaumeGomez
    
    rustdoc: fix weird margins between Deref impl items
    
    ## Before
    
    ![image](https://user-images.githubusercontent.com/1593513/235245977-90770591-22c1-4a27-9464-248a3729a2b7.png)
    
    ## After
    
    ![image](https://user-images.githubusercontent.com/1593513/235246009-0e83113e-42b7-4e29-981d-969f9d20af01.png)
    
    ## Description
    
    In the old setup, if the dereffed-to item has multiple impl blocks, each one gets its own `div.impl-items` in the section, but there are no headers separating them. Since the last method in a `div.impl-items` has no bottom margin, and there are no margins between these divs, there is no margin between the last method of one impl and the first method of the following impl.
    
    This patch fixes it by simplifying the HTML. Each Deref block gets exactly one `div.impl-items`, no matter how many impl blocks it actually has.
    GuillaumeGomez authored Apr 29, 2023
    Configuration menu
    Copy the full SHA
    7a341ff View commit details
    Browse the repository at this point in the history
  9. Rollup merge of rust-lang#110979 - jyn514:windows-locking, r=ChrisDenton

    windows: kill rust-analyzer-proc-macro-srv before deleting stage0 directory
    
    This fixes the following recurring error on windows:
    ```
    Traceback (most recent call last):
      File "C:\Users\jyn\src\rust\x.py", line 29, in <module>
        bootstrap.main()
      File "C:\Users\jyn\src\rust\src\bootstrap\bootstrap.py", line 963, in main
        bootstrap(args)
      File "C:\Users\jyn\src\rust\src\bootstrap\bootstrap.py", line 927, in bootstrap
        build.download_toolchain()
      File "C:\Users\jyn\src\rust\src\bootstrap\bootstrap.py", line 437, in download_toolchain
        shutil.rmtree(bin_root)
      File "C:\Users\jyn\AppData\Local\Programs\Python\Python311\Lib\shutil.py", line 759, in rmtree
        return _rmtree_unsafe(path, onerror)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "C:\Users\jyn\AppData\Local\Programs\Python\Python311\Lib\shutil.py", line 617, in _rmtree_unsafe
        _rmtree_unsafe(fullname, onerror)
      File "C:\Users\jyn\AppData\Local\Programs\Python\Python311\Lib\shutil.py", line 622, in _rmtree_unsafe
        onerror(os.unlink, fullname, sys.exc_info())
      File "C:\Users\jyn\AppData\Local\Programs\Python\Python311\Lib\shutil.py", line 620, in _rmtree_unsafe
        os.unlink(fullname)
    PermissionError: [WinError 5] Access is denied: 'C:\\Users\\jyn\\src\\rust\\build\\x86_64-pc-windows-msvc\\stage0\\bin\\rust-analyzer-proc-macro-srv.exe'
    ```
    
    Fixes rust-lang#107018.
    
    r? `@ChrisDenton`
    GuillaumeGomez authored Apr 29, 2023
    Configuration menu
    Copy the full SHA
    627aaae View commit details
    Browse the repository at this point in the history