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 8 pull requests #102920

Closed
wants to merge 26 commits into from
Closed

Commits on Sep 14, 2022

  1. Warn about safety of fetch_update

    Specifically as it relates to the ABA problem.
    Riolku committed Sep 14, 2022
    Configuration menu
    Copy the full SHA
    3d28a1a View commit details
    Browse the repository at this point in the history

Commits on Sep 26, 2022

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

Commits on Sep 30, 2022

  1. Stabilize map_first_last

    est31 committed Sep 30, 2022
    Configuration menu
    Copy the full SHA
    2c72ea7 View commit details
    Browse the repository at this point in the history

Commits on Oct 5, 2022

  1. Interpret EH actions properly

    The EH actions stored in the LSDA follows the format of GCC except table
    (even for LLVM-generated code). An missing action in the table is the
    encoding for `Terminate`, see [1].
    
    The currently code interprets it as `None`, as a workaround for rust-lang#35011,
    an issue that seems to occur in LLVM 3.7 and not after 3.9. These are
    very old versions of LLVM and we don't support them anymore, so remove
    this workaround and interpret them properly.
    
    Note that LLVM currently does not emit any `Terminate` actions, but GCC
    does. Although GCC backend currently doesn't do unwinding, removing it
    preemptively would prevent future developers from wasting time to figure
    out what's wrong.
    
    [1]: https://github.com/gcc-mirror/gcc/blob/master/libstdc%2B%2B-v3/libsupc%2B%2B/eh_personality.cc#L522-L526
    nbdd0121 committed Oct 5, 2022
    Configuration menu
    Copy the full SHA
    8bda133 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 10, 2022

  1. Configuration menu
    Copy the full SHA
    c1c159f View commit details
    Browse the repository at this point in the history
  2. fix rust-lang#102878

    TaKO8Ki committed Oct 10, 2022
    Configuration menu
    Copy the full SHA
    6826028 View commit details
    Browse the repository at this point in the history

Commits on Oct 11, 2022

  1. Configuration menu
    Copy the full SHA
    152cd63 View commit details
    Browse the repository at this point in the history
  2. Rollup merge of rust-lang#100387 - cjgillot:hygiene-trait-impl, r=pet…

    …rochenkov
    
    Check uniqueness of impl items by trait item when applicable.
    
    When checking uniqueness of item names in impl blocks, we currently use the same definition of hygiene as for toplevel items.  This means that a plain item and one generated by a macro 2.0 do not collide.
    
    This hygiene rule does not match with how impl items resolve to associated trait items. As a consequence, we misdiagnose the trait impls.
    
    This PR proposes to consider that trait impl items are uses of the corresponding trait items during resolution, instead of checking for duplicates later. An error is emitted when a trait impl item is used twice.
    
    There should be no stable breakage, since macros 2.0 are still unstable.
    
    r? `@petrochenkov`
    cc `@RalfJung`
    
    Fixes rust-lang#71614.
    Dylan-DPC authored Oct 11, 2022
    Configuration menu
    Copy the full SHA
    6be5db8 View commit details
    Browse the repository at this point in the history
  3. Rollup merge of rust-lang#101727 - est31:stabilize_map_first_last, r=…

    …m-ou-se
    
    Stabilize map_first_last
    
    Stabilizes the following functions:
    
    ```Rust
    impl<T> BTreeSet<T> {
        pub fn first(&self) -> Option<&T> where T: Ord;
        pub fn last(&self) -> Option<&T> where T: Ord;
        pub fn pop_first(&mut self) -> Option<T> where T: Ord;
        pub fn pop_last(&mut self) -> Option<T> where T: Ord;
    }
    
    impl<K, V> BTreeMap<K, V> {
        pub fn first_key_value(&self) -> Option<(&K, &V)> where K: Ord;
        pub fn last_key_value(&self) -> Option<(&K, &V)> where K: Ord;
        pub fn first_entry(&mut self) -> Option<OccupiedEntry<'_, K, V>> where K: Ord;
        pub fn last_entry(&mut self) -> Option<OccupiedEntry<'_, K, V>> where K: Ord;
        pub fn pop_first(&mut self) -> Option<(K, V)> where K: Ord;
        pub fn pop_last(&mut self) -> Option<(K, V)> where K: Ord;
    }
    ```
    
    Closes rust-lang#62924
    
    ~~Blocked on the [FCP](rust-lang#62924 (comment)) finishing.~~ Edit: It finished!
    Dylan-DPC authored Oct 11, 2022
    Configuration menu
    Copy the full SHA
    9bf2e53 View commit details
    Browse the repository at this point in the history
  4. Rollup merge of rust-lang#101774 - Riolku:atomic-update-aba, r=m-ou-se

    Warn about safety of `fetch_update`
    
    Specifically as it relates to the ABA problem.
    
    `fetch_update` is a useful function, and one that isn't provided by, say, C++. However, this does mean the function is magic. It is implemented in terms of `compare_exchange_weak`, and in particular, suffers from the ABA problem. See the following code, which is a naive implementation of `pop` in a lock-free queue:
    
    ```rust
    fn pop(&self) -> Option<i32> {
        self.front.fetch_update(Ordering::Relaxed, Ordering::Acquire, |front| {
            if front == ptr::null_mut() {
                None
            }
            else {
                Some(unsafe { (*front).next })
            }
        }.ok()
    }
    ```
    
    This code is unsound if called from multiple threads because of the ABA problem. Specifically, suppose nodes are allocated with `Box`. Suppose the following sequence happens:
    
    ```
    Initial: Queue is X -> Y.
    
    Thread A: Starts popping, is pre-empted.
    Thread B: Pops successfully, twice, leaving the queue empty.
    Thread C: Pushes, and `Box` returns X (very common for allocators)
    Thread A: Wakes up, sees the head is still X, and stores Y as the new head.
    ```
    
    But `Y` is deallocated. This is undefined behaviour.
    
    Adding a note about this problem to `fetch_update` should hopefully prevent users from being misled, and also, a link to this common problem is, in my opinion, an improvement to our docs on atomics.
    Dylan-DPC authored Oct 11, 2022
    Configuration menu
    Copy the full SHA
    3f4b987 View commit details
    Browse the repository at this point in the history
  5. Rollup merge of rust-lang#102227 - devnexen:solarish_get_path, r=m-ou-se

    fs::get_path solarish version.
    
    similar to linux, albeit there is no /proc/self notion on solaris
     based system thus flattening the difference for simplification sake.
    Dylan-DPC authored Oct 11, 2022
    Configuration menu
    Copy the full SHA
    16914c9 View commit details
    Browse the repository at this point in the history
  6. 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._
    Dylan-DPC authored Oct 11, 2022
    Configuration menu
    Copy the full SHA
    4be1c94 View commit details
    Browse the repository at this point in the history
  7. Rollup merge of rust-lang#102685 - nbdd0121:unwind, r=m-ou-se

    Interpret EH actions properly
    
    The EH actions stored in the LSDA follows the format of GCC except table (even for LLVM-generated code). An missing action in the table is the encoding for `Terminate`, see https://github.com/gcc-mirror/gcc/blob/master/libstdc%2B%2B-v3/libsupc%2B%2B/eh_personality.cc#L522-L526.
    
    The currently code interprets it as `None`, as a workaround for rust-lang#35011, an issue that seems to occur in LLVM 3.7 and not after 3.9. These are very old versions of LLVM and we don't support them anymore, so remove this workaround and interpret them properly.
    
    Note that LLVM currently does not emit any `Terminate` actions, but GCC does. Although GCC backend currently doesn't do unwinding, removing it preemptively would prevent future developers from wasting time to figure out what's wrong.
    
    `@rustbot` label: +T-compiler
    Dylan-DPC authored Oct 11, 2022
    Configuration menu
    Copy the full SHA
    638ce35 View commit details
    Browse the repository at this point in the history
  8. 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 11, 2022
    Configuration menu
    Copy the full SHA
    18325e9 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    2e26805 View commit details
    Browse the repository at this point in the history