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 #102880

Closed
wants to merge 18 commits into from
Closed

Commits on Oct 7, 2022

  1. Clean up rustdoc startup.

    rustc's startup has several layers, including:
    - `interface::run_compiler` passes a closure, `f`, to
      `run_in_thread_pool_with_globals`, which creates a thread pool, sets
      up session globals, and passes `f` to `create_compiler_and_run`.
    - `create_compiler_and_run` creates a `Session`, a `Compiler`, sets the
      source map, and calls `f`.
    
    rustdoc is a bit different.
    - `main_args` calls `main_options` via
      `run_in_thread_pool_with_globals`, which (again) creates a thread pool
      (hardcoded to a single thread!) and sets up session globals.
    - `main_options` has four different paths.
      - The second one calls `interface::run_compiler`, which redoes the
        `run_in_thread_pool_with_globals`! This is bad.
      - The fourth one calls `interface::create_compiler_and_run`, which is
        reasonable.
      - The first and third ones don't do anything of note involving the
        above functions, except for some symbol interning which requires
        session globals.
    
    In other words, rustdoc calls into `rustc_interface` at three different
    levels. It's a bit confused, and feels like code where functionality has
    been added by different people at different times without fully
    understanding how the globally accessible stuff is set up.
    
    This commit tidies things up. It removes the
    `run_in_thread_pool_with_globals` call in `main_args`, and adjust the
    four paths in `main_options` as follows.
    - `markdown::test` calls `test::test_main`, which provides its own
      parallelism and so doesn't need a thread pool. It had one small use of
      symbol interning, which required session globals, but the commit
      removes this.
    - `doctest::run` already calls `interface::run_compiler`, so it doesn't
      need further adjustment.
    - `markdown::render` is simple but needs session globals for interning
      (which can't easily be removed), so it's now wrapped in
      `create_session_globals_then`.
    - The fourth path now uses `interface::run_compiler`, which is
      equivalent to the old `run_in_thread_pool_with_globals` +
      `create_compiler_and_run` pairing.
    nnethercote committed Oct 7, 2022
    Configuration menu
    Copy the full SHA
    bf135de View commit details
    Browse the repository at this point in the history
  2. Merge main_options into main_args.

    There is no longer any need for them to be separate.
    nnethercote committed Oct 7, 2022
    Configuration menu
    Copy the full SHA
    c461f3a View commit details
    Browse the repository at this point in the history
  3. Inline and remove scoped_thread.

    It has a single call site, and removing it slightly improves the
    confusing tangle of nested closures present at startup.
    nnethercote committed Oct 7, 2022
    Configuration menu
    Copy the full SHA
    d156a90 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    226387a View commit details
    Browse the repository at this point in the history
  5. Inline and remove create_compiler_and_run.

    It has a single call site.
    nnethercote committed Oct 7, 2022
    Configuration menu
    Copy the full SHA
    c00937f View commit details
    Browse the repository at this point in the history
  6. Apply Lrc later to sess and codegen_backend.

    This avoids the need for a degenerate `Lrc::get_mut` call.
    nnethercote committed Oct 7, 2022
    Configuration menu
    Copy the full SHA
    8067016 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    1f0463a View commit details
    Browse the repository at this point in the history

Commits on Oct 10, 2022

  1. Configuration menu
    Copy the full SHA
    0571b0a View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    6934853 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    c1c159f View commit details
    Browse the repository at this point in the history
  4. rustdoc: clean up overly complex .trait-impl CSS selectors

    When added in 4596436, these multi-class
    selectors were present in the initial commit, but no reason was given why
    the shorter selector wouldn't work.
    notriddle committed Oct 10, 2022
    Configuration menu
    Copy the full SHA
    03fe005 View commit details
    Browse the repository at this point in the history
  5. let is not allowed in struct field definitions

    Co-authored-by: jyn514 <[email protected]>
    Co-authored-by: Esteban Kuber <[email protected]>
    3 people committed Oct 10, 2022
    Configuration menu
    Copy the full SHA
    6071b4b View commit details
    Browse the repository at this point in the history
  6. Rollup merge of rust-lang#101360 - compiler-errors:multiple-closure-b…

    …ounds, r=petrochenkov
    
    Point out incompatible closure bounds
    
    Fixes rust-lang#100295
    Dylan-DPC authored Oct 10, 2022
    Configuration menu
    Copy the full SHA
    b5a59cf View commit details
    Browse the repository at this point in the history
  7. Rollup merge of rust-lang#101789 - gimbles:let, r=estebank

    `let`'s not needed in struct field definitions
    
    Fixes rust-lang#101683
    Dylan-DPC authored Oct 10, 2022
    Configuration menu
    Copy the full SHA
    8d606ef View commit details
    Browse the repository at this point in the history
  8. Rollup merge of rust-lang#102769 - nnethercote:rustdoc-startup, r=jyn514

    Clean up rustdoc startup
    
    Startup is pretty hairy, in both rustdoc and rustc. The first commit here improves the rustdoc situation quite a bit. The remaining commits are smaller but also help.
    
    Best reviewed one commit at a time.
    
    r? `@jyn514`
    Dylan-DPC authored Oct 10, 2022
    Configuration menu
    Copy the full SHA
    133e945 View commit details
    Browse the repository at this point in the history
  9. Rollup merge of rust-lang#102830 - compiler-errors:constness-parity, …

    …r=fee1-dead
    
    Unify `tcx.constness` query and param env constness checks
    
    The checks that we do in the `constness` query seem inconsistent with the checks that we do to determine if an item's param-env is const, so I merged them into the `constness` query and call that from the `param_env` query.
    
    I'm not sure if this totally makes sense -- is there a case where `tcx.param_env()` would return a const param-env for an item whose `tcx.constness()` is `Constness::NotConst`? Because if not, it seems a bit dangerous that these two differ.
    
    Luckily, not many places actually use `tcx.constness()`, and the checks in `tcx.param_env()` seem stricter than the checks in `tcx.constness()` (at least for the types of items we type-check).
    
    Also, due to the way that `tcx.param_env()` is implemented, it _never_ used to return a const param-env for a item coming from a different crate, which also seems dangerous (though also probably not weaponizable currently, because we seldom actually compute the param-env for a non-local item).
    Dylan-DPC authored Oct 10, 2022
    Configuration menu
    Copy the full SHA
    56be8ab View commit details
    Browse the repository at this point in the history
  10. Rollup merge of rust-lang#102871 - notriddle:notriddle/trait-impl-anc…

    …hor, r=GuillaumeGomez
    
    rustdoc: clean up overly complex `.trait-impl` CSS selectors
    
    When added in 4596436, these multi-class selectors were present in the initial commit, but no reason was given why the shorter selector wouldn't work.
    Dylan-DPC authored Oct 10, 2022
    Configuration menu
    Copy the full SHA
    0492622 View commit details
    Browse the repository at this point in the history
  11. Rollup merge of rust-lang#102876 - SparrowLii:import-candidate, r=fee…

    …1-dead
    
    suggest candidates for unresolved import
    
    Currently we prompt suggestion of candidates(help notes of `use xxx::yyy`) for names which cannot be resolved, but we don't do that for import statements themselves that couldn't be resolved. It seems reasonable to add candidate help information for these statements as well.
    Fixes rust-lang#102711
    Dylan-DPC authored Oct 10, 2022
    Configuration menu
    Copy the full SHA
    a7a8c70 View commit details
    Browse the repository at this point in the history