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 5 pull requests #102908

Closed
wants to merge 32 commits into from

Commits on Oct 6, 2022

  1. Configuration menu
    Copy the full SHA
    99182dd View commit details
    Browse the repository at this point in the history
  2. std: add thread parking tests

    joboet committed Oct 6, 2022
    Configuration menu
    Copy the full SHA
    0ad4dd4 View commit details
    Browse the repository at this point in the history

Commits on Oct 7, 2022

  1. ADD - codegen_ssa initial diags translations machinery

    ADD - migrate MissingNativeStaticLibrary fatal error
    JhonnyBillM committed Oct 7, 2022
    Configuration menu
    Copy the full SHA
    b0b072d View commit details
    Browse the repository at this point in the history
  2. ADD - migrate lib.def write fatal error

    This diagnostic has no UI test 🤔 Should we add some? If so, how?
    JhonnyBillM committed Oct 7, 2022
    Configuration menu
    Copy the full SHA
    4e0de53 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    0a2d7f8 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    086e70f View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    d9197db View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    67eb01c View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    7548d95 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    0f97d4a View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    12aa84b View commit details
    Browse the repository at this point in the history
  10. Address PR comments

    - UPDATE - revert migration of logs
    
    - UPDATE - use derive on LinkRlibError enum
    
    - [Gardening] UPDATE - alphabetically sort fluent_messages
    
    - UPDATE - use PathBuf and unify both AddNativeLibrary to use Display (which is what PathBuf uses when conforming to IntoDiagnosticArg)
    
    - UPDATE - fluent messages sort after rebase
    JhonnyBillM committed Oct 7, 2022
    Configuration menu
    Copy the full SHA
    a25f939 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    13d4f27 View commit details
    Browse the repository at this point in the history

Commits on Oct 8, 2022

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

Commits on Oct 10, 2022

  1. macros: tidy up lint changes

    Small tweaks to changes made in a previous PR, unrelated to eager
    translation.
    
    Signed-off-by: David Wood <[email protected]>
    davidtwco committed Oct 10, 2022
    Configuration menu
    Copy the full SHA
    febbf71 View commit details
    Browse the repository at this point in the history
  2. errors: use HashMap to store diagnostic args

    Eager translation will enable subdiagnostics to be translated multiple
    times with different arguments - this requires the ability to replace
    the value of one argument with a new value, which is better suited to a
    `HashMap` than the previous storage, a `Vec`.
    
    Signed-off-by: David Wood <[email protected]>
    davidtwco committed Oct 10, 2022
    Configuration menu
    Copy the full SHA
    508d7e6 View commit details
    Browse the repository at this point in the history
  3. errors: AddToDiagnostic::add_to_diagnostic_with

    `AddToDiagnostic::add_to_diagnostic_with` is similar to the previous
    `AddToDiagnostic::add_to_diagnostic` but takes a function that can be
    used by the caller to modify diagnostic messages originating from the
    subdiagnostic (such as performing translation eagerly).
    
    `add_to_diagnostic` now just calls `add_to_diagnostic_with` with an
    empty closure.
    
    Signed-off-by: David Wood <[email protected]>
    davidtwco committed Oct 10, 2022
    Configuration menu
    Copy the full SHA
    b4ac262 View commit details
    Browse the repository at this point in the history
  4. errors: DiagnosticMessage::Eager

    Add variant of `DiagnosticMessage` for eagerly translated messages
    (messages in the target language which don't need translated by the
    emitter during emission). Also adds `eager_subdiagnostic` function which
    is intended to be invoked by the diagnostic derive for subdiagnostic
    fields which are marked as needing eager translation.
    
    Signed-off-by: David Wood <[email protected]>
    davidtwco committed Oct 10, 2022
    Configuration menu
    Copy the full SHA
    540b203 View commit details
    Browse the repository at this point in the history
  5. macros: #[subdiagnostic(eager)]

    Add support for `eager` argument to the `subdiagnostic` attribute which
    generates a call to `eager_subdiagnostic`.
    
    Signed-off-by: David Wood <[email protected]>
    davidtwco committed Oct 10, 2022
    Configuration menu
    Copy the full SHA
    291a473 View commit details
    Browse the repository at this point in the history
  6. query_system: finish migration

    Using eager translation, migrate the remaining repeated cycle stack
    diagnostic.
    
    Signed-off-by: David Wood <[email protected]>
    davidtwco committed Oct 10, 2022
    Configuration menu
    Copy the full SHA
    113e943 View commit details
    Browse the repository at this point in the history
  7. macros: separate suggestion fmt'ing and emission

    Diagnostic derives have previously had to take special care when
    ordering the generated code so that fields were not used after a move.
    
    This is unlikely for most fields because a field is either annotated
    with a subdiagnostic attribute and is thus likely a `Span` and copiable,
    or is a argument, in which case it is only used once by `set_arg`
    anyway.
    
    However, format strings for code in suggestions can result in fields
    being used after being moved if not ordered carefully. As a result, the
    derive currently puts `set_arg` calls last (just before emission), such
    as:
    
    ```rust
    let diag = { /* create diagnostic */ };
    
    diag.span_suggestion_with_style(
        span,
        fluent::crate::slug,
        format!("{}", __binding_0),
        Applicability::Unknown,
        SuggestionStyle::ShowAlways
    );
    /* + other subdiagnostic additions */
    
    diag.set_arg("foo", __binding_0);
    /* + other `set_arg` calls */
    
    diag.emit();
    ```
    
    For eager translation, this doesn't work, as the message being
    translated eagerly can assume that all arguments are available - so
    arguments _must_ be set first.
    
    Format strings for suggestion code are now separated into two parts - an
    initialization line that performs the formatting into a variable, and a
    usage in the subdiagnostic addition.
    
    By separating these parts, the initialization can happen before
    arguments are set, preserving the desired order so that code compiles,
    while still enabling arguments to be set before subdiagnostics are
    added.
    
    ```rust
    let diag = { /* create diagnostic */ };
    
    let __code_0 = format!("{}", __binding_0);
    /* + other formatting */
    
    diag.set_arg("foo", __binding_0);
    /* + other `set_arg` calls */
    
    diag.span_suggestion_with_style(
        span,
        fluent::crate::slug,
        __code_0,
        Applicability::Unknown,
        SuggestionStyle::ShowAlways
    );
    /* + other subdiagnostic additions */
    
    diag.emit();
    ```
    
    Signed-off-by: David Wood <[email protected]>
    davidtwco committed Oct 10, 2022
    Configuration menu
    Copy the full SHA
    7e20929 View commit details
    Browse the repository at this point in the history
  8. macros: simplify field ordering in diag derive

    Following the approach taken in earlier commits to separate formatting
    initialization from use in the subdiagnostic derive, simplify the
    diagnostic derive by removing the field-ordering logic that previously
    solved this problem.
    
    Signed-off-by: David Wood <[email protected]>
    davidtwco committed Oct 10, 2022
    Configuration menu
    Copy the full SHA
    fbac1f2 View commit details
    Browse the repository at this point in the history
  9. Allow compiling the wasm32-wasi std library with atomics

    The issue rust-lang#102157 demonstrates how currently the `-Z build-std` option
    will fail when re-compiling the standard library with `RUSTFLAGS` like
    `RUSTFLAGS="-C target-feature=+atomics,+bulk-memory -C
    link-args=--shared-memory"`. This change attempts to resolve those build
    issues by depending on the the WebAssembly `futex` module and providing
    an implementation for `env_lock`. Fixes rust-lang#102157.
    abrown committed Oct 10, 2022
    Configuration menu
    Copy the full SHA
    da638b3 View commit details
    Browse the repository at this point in the history
  10. Implement env_lock with RwLock

    Copying the approach of the Unix target, this change uses the standard
    `RwLock` to protect against concurrent access of libc's environment.
    This locking is only enabled when WebAssembly's `atomics` feature is
    also enabled.
    abrown committed Oct 10, 2022
    Configuration menu
    Copy the full SHA
    9530ba0 View commit details
    Browse the repository at this point in the history
  11. rustdoc: remove unneeded <div> wrapper from sidebar DOM

    When this was added, the sidebar had a bit more complex style. It can be
    removed, now.
    notriddle committed Oct 10, 2022
    Configuration menu
    Copy the full SHA
    b63b02f View commit details
    Browse the repository at this point in the history

Commits on Oct 11, 2022

  1. Remove outdated comment

    notriddle authored Oct 11, 2022
    Configuration menu
    Copy the full SHA
    44f466c View commit details
    Browse the repository at this point in the history
  2. Rollup merge of rust-lang#102372 - abrown:issue-102157, r=thomcc

    Allow compiling the `wasm32-wasi` std library with atomics
    
    The issue rust-lang#102157 demonstrates how currently the `-Z build-std` option will fail when re-compiling the standard library with `RUSTFLAGS` like `RUSTFLAGS="-C target-feature=+atomics,+bulk-memory -C link-args=--shared-memory"`. This change attempts to resolve those build issues by depending on the the WebAssembly `futex` module and providing an implementation for `env_lock`. Fixes rust-lang#102157.
    matthiaskrgr authored Oct 11, 2022
    Configuration menu
    Copy the full SHA
    ac478d4 View commit details
    Browse the repository at this point in the history
  3. Rollup merge of rust-lang#102612 - JhonnyBillM:migrate-codegen-ssa-to…

    …-diagnostics-structs, r=davidtwco
    
    Migrate `codegen_ssa` to diagnostics structs - [Part 1]
    
    Initial migration of `codegen_ssa`. Going to split this crate migration in at least two PRs in order to avoid a huge PR and to quick off some questions around:
    
    1. Translating messages from "external" crates.
    2. Interfacing with OS messages.
    3. Adding UI tests while migrating diagnostics.
    
    _See comments below._
    matthiaskrgr authored Oct 11, 2022
    Configuration menu
    Copy the full SHA
    4fb3495 View commit details
    Browse the repository at this point in the history
  4. Rollup merge of rust-lang#102623 - davidtwco:translation-eager, r=com…

    …piler-errors
    
    translation: eager translation
    
    Part of rust-lang#100717. See [Zulip thread](https://rust-lang.zulipchat.com/#narrow/stream/336883-i18n/topic/.23100717.20lists!/near/295010720) for additional context.
    
    - **Store diagnostic arguments in a `HashMap`**: Eager translation will enable subdiagnostics to be translated multiple times with different arguments - this requires the ability to replace the value of one argument with a new value, which is better suited to a `HashMap` than the previous storage, a `Vec`.
    - **Add `AddToDiagnostic::add_to_diagnostic_with`**: `AddToDiagnostic::add_to_diagnostic_with` is similar to the previous `AddToDiagnostic::add_to_diagnostic` but takes a function that can be used by the caller to modify diagnostic messages originating from the subdiagnostic (such as performing translation eagerly). `add_to_diagnostic` now just calls `add_to_diagnostic_with` with an empty closure.
    - **Add `DiagnosticMessage::Eager`**: Add variant of `DiagnosticMessage` for eagerly translated messages
    (messages in the target language which don't need translated by the emitter during emission). Also adds `eager_subdiagnostic` function which is intended to be invoked by the diagnostic derive for subdiagnostic fields which are marked as needing eager translation.
    - **Support `#[subdiagnostic(eager)]`**: Add support for `eager` argument to the `subdiagnostic` attribute which generates a call to `eager_subdiagnostic`.
    - **Finish migrating `rustc_query_system`**: Using eager translation, migrate the remaining repeated cycle stack diagnostic.
    - **Split formatting initialization and use in diagnostic derives**: Diagnostic derives have previously had to take special care when ordering the generated code so that fields were not used after a move.
    
      This is unlikely for most fields because a field is either annotated with a subdiagnostic attribute and is thus likely a `Span` and copiable, or is a argument, in which case it is only used once by `set_arg`
    anyway.
    
      However, format strings for code in suggestions can result in fields being used after being moved if not ordered carefully. As a result, the derive currently puts `set_arg` calls last (just before emission), such as:
    
          let diag = { /* create diagnostic */ };
    
          diag.span_suggestion_with_style(
              span,
              fluent::crate::slug,
              format!("{}", __binding_0),
              Applicability::Unknown,
              SuggestionStyle::ShowAlways
          );
          /* + other subdiagnostic additions */
    
          diag.set_arg("foo", __binding_0);
          /* + other `set_arg` calls */
    
          diag.emit();
    
      For eager translation, this doesn't work, as the message being translated eagerly can assume that all arguments are available - so arguments _must_ be set first.
    
      Format strings for suggestion code are now separated into two parts - an initialization line that performs the formatting into a variable, and a usage in the subdiagnostic addition.
    
      By separating these parts, the initialization can happen before arguments are set, preserving the desired order so that code compiles, while still enabling arguments to be set before subdiagnostics are added.
    
          let diag = { /* create diagnostic */ };
    
          let __code_0 = format!("{}", __binding_0);
          /* + other formatting */
    
          diag.set_arg("foo", __binding_0);
          /* + other `set_arg` calls */
    
          diag.span_suggestion_with_style(
              span,
              fluent::crate::slug,
              __code_0,
              Applicability::Unknown,
              SuggestionStyle::ShowAlways
          );
          /* + other subdiagnostic additions */
    
          diag.emit();
    
    - **Remove field ordering logic in diagnostic derive:** Following the approach taken in earlier commits to separate formatting initialization from use in the subdiagnostic derive, simplify the diagnostic derive by removing the field-ordering logic that previously solved this problem.
    
    r? `@compiler-errors`
    matthiaskrgr authored Oct 11, 2022
    Configuration menu
    Copy the full SHA
    a5dbef4 View commit details
    Browse the repository at this point in the history
  5. Rollup merge of rust-lang#102773 - joboet:apple_parker, r=thomcc

    Use semaphores for thread parking on Apple platforms
    
    Currently we use a mutex-condvar pair for thread parking on Apple systems. Unfortunately, `pthread_cond_timedwait` uses the real-time clock for measuring time, which causes problems when the system time changes. The parking implementation in this PR uses a semaphore instead, which measures monotonic time by default, avoiding these issues. As a further benefit, this has the potential to improve performance a bit, since `unpark` does not need to wait for a lock to be released.
    
    Since the Mach semaphores are poorly documented (I could not find availability or stability guarantees for instance), this uses a [dispatch semaphore](https://developer.apple.com/documentation/dispatch/dispatch_semaphore?language=objc) instead. While it adds a layer of indirection (it uses Mach semaphores internally), the overhead is probably negligible.
    
    Tested on macOS 12.5.
    
    r? `@thomcc`
    matthiaskrgr authored Oct 11, 2022
    Configuration menu
    Copy the full SHA
    e5faada View commit details
    Browse the repository at this point in the history
  6. Rollup merge of rust-lang#102898 - notriddle:notriddle/sidebar-block,…

    … r=GuillaumeGomez
    
    rustdoc: remove unneeded `<div>` wrapper from sidebar DOM
    
    When this was added, the sidebar had a bit more complex style. It can be removed, now.
    
    Preview: https://notriddle.com/notriddle-rustdoc-demos/sidebar-block/std/index.html
    matthiaskrgr authored Oct 11, 2022
    Configuration menu
    Copy the full SHA
    0f7b622 View commit details
    Browse the repository at this point in the history