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

Move SourceMap initialization #122811

Merged
merged 3 commits into from
Apr 16, 2024
Merged

Commits on Apr 16, 2024

  1. Factor out common code in interface tests.

    Replacing `mk_session` with `sess_and_cfgs`, which does a bit more of
    the shared stuff -- the option parsing and the `build_configuration`
    call.
    nnethercote committed Apr 16, 2024
    Configuration menu
    Copy the full SHA
    ff2e4ed View commit details
    Browse the repository at this point in the history
  2. Construct SourceMap at the same time as SessionGlobals.

    Currently `SourceMap` is constructed slightly later than
    `SessionGlobals`, and inserted. This commit changes things so they are
    done at the same time.
    
    Benefits:
    - `SessionGlobals::source_map` changes from
      `Lock<Option<Lrc<SourceMap>>>` to `Option<Lrc<SourceMap>>`. It's still
      optional, but mutability isn't required because it's initialized at
      construction.
    - `set_source_map` is removed, simplifying `run_compiler`, which is
      good because that's a critical function and it's nice to make it
      simpler.
    
    This requires moving things around a bit, so the necessary inputs are
    available when `SessionGlobals` is created, in particular the `loader`
    and `hash_kind`, which are no longer computed by `build_session`. These
    inputs are captured by the new `SourceMapInputs` type, which is threaded
    through various places.
    nnethercote committed Apr 16, 2024
    Configuration menu
    Copy the full SHA
    62c32ae View commit details
    Browse the repository at this point in the history
  3. Move initialize_checked_jobserver.

    Currently it's a method on `EarlyDiagCtxt`, which is not the right place
    for it at all -- `EarlyDiagCtxt` is used to issue diagnostics, but
    shouldn't be doing any of the actual checking.
    
    This commit moves it into a standalone function that takes an
    `EarlyDiagCtxt` as an argument, which is more sensible. This does
    require adding `EarlyDiagCtxt::early_struct_warn`, so a warning can be
    returned and then modified with a note. (And that likely explains why
    somebody put `initialize_checked_jobserver` into `EarlyDiagCtxt` in the
    first place.)
    nnethercote committed Apr 16, 2024
    Configuration menu
    Copy the full SHA
    9b0ced0 View commit details
    Browse the repository at this point in the history