1. 20 6月, 2022 5 次提交
    • Y
      Rollup merge of #97912 - Kixunil:stabilize_path_try_exists, r=dtolnay · 77316a4a
      Yuki Okushi 提交于
      Stabilize `Path::try_exists()` and improve doc
      
      This stabilizes the `Path::try_exists()` method which returns
      `Result<bool, io::Error>` instead of `bool` allowing handling of errors
      unrelated to the file not existing. (e.g permission errors)
      
      Along with the stabilization it also:
      
      * Warns that the `exists()` method is error-prone and suggests to use
        the newly stabilized one.
      * Suggests it instead of `metadata()` to handle errors.
      * Mentions TOCTOU bugs to avoid false assumption that `try_exists()` is
        completely safe fixed version of `exists()`.
      * Renames the feature of still-unstable `std::fs::try_exists()` to
        `fs_try_exists` to avoid name conflict.
      
      The tracking issue #83186 remains open to track `fs_try_exists`.
      77316a4a
    • Y
      Rollup merge of #95534 - jyn514:std-mem-copy, r=joshtriplett · 9d4e08e7
      Yuki Okushi 提交于
      Add `core::mem::copy` to complement `core::mem::drop`.
      
      This is useful for combinators. I didn't add `clone` since you can already
      use `Clone::clone` in its place; copy has no such corresponding function.
      9d4e08e7
    • J
      Add `core::mem::copy` to complement `core::mem::drop`. · 9ac6277b
      Joshua Nelson 提交于
      This is useful for combinators. I didn't add `clone` since you can already
      use `Clone::clone` in its place; copy has no such corresponding function.
      9ac6277b
    • B
      Auto merge of #98247 - jackh726:regionkind-rustc-type-ir, r=compiler-errors · bb8c2f41
      bors 提交于
      Move RegionKind to rustc_type_ir
      
      (Also UniverseIndex)
      
      r? rust-lang/types
      bb8c2f41
    • B
      Auto merge of #98224 - eddyb:proc-macro-spurious-repr, r=bjorn3 · 2b646bd5
      bors 提交于
      proc_macro/bridge: remove `#[repr(C)]` from non-ABI-relevant types.
      
      Not sure how this happened, maybe some of these were passed through the bridge a long time ago?
      
      r? `@bjorn3`
      2b646bd5
  2. 19 6月, 2022 27 次提交
  3. 18 6月, 2022 8 次提交
    • B
      Auto merge of #97924 - cuviper:unguarded-poison, r=Mark-Simulacrum · ec21d7ea
      bors 提交于
      Avoid `thread::panicking()` in non-poisoning methods of `Mutex` and `RwLock`
      
      `Mutex::lock()` and `RwLock::write()` are poison-guarded against panics,
      in that they set the poison flag if a panic occurs while they're locked.
      But if we're already in a panic (`thread::panicking()`), they leave the
      poison flag alone.
      
      That check is a bit of a waste for methods that never set the poison
      flag though, namely `get_mut()`, `into_inner()`, and `RwLock::read()`.
      These use-cases are now split to avoid that unnecessary call.
      ec21d7ea
    • J
      Add tests for fixed bugs · fca6dbd9
      Joshua Nelson 提交于
      fca6dbd9
    • J
      Pass all paths to `Step::run` at once when using `ShouldRun::krate` · 0da0a219
      Joshua Nelson 提交于
      This was surprisingly complicated. The main changes are:
      1. Invert the order of iteration in `StepDescription::run`.
      
          Previously, it did something like:
          ```python
          for path in paths:
          for (step, should_run) in should_runs:
              if let Some(set) = should_run.pathset_for_path(path):
              step.run(builder, set)
          ```
      
          That worked ok for individual paths, but didn't allow passing more than one path at a time to `Step::run`
          (since `pathset_for_paths` only had one path available to it).
          Change it to instead look at the intersection of `paths` and `should_run.paths`:
      
          ```python
          for (step, should_run) in should_runs:
          if let Some(set) = should_run.pathset_for_paths(paths):
              step.run(builder, set)
          ```
      
      2. Change `pathset_for_path` to take multiple pathsets.
      
          The goal is to avoid `x test library/alloc` testing *all* library crates, instead of just alloc.
          The changes here are similarly subtle, to use the intersection between the paths rather than all
          paths in `should_run.paths`. I added a test for the behavior to try and make it more clear.
      
          Note that we use pathsets instead of just paths to allow for sets with multiple aliases (*cough* `all_krates` *cough*).
          See the documentation added in the next commit for more detail.
      
      3. Change `StepDescription::run` to explicitly handle 0 paths.
      
         Before this was implicitly handled by the `for` loop, which just didn't excute when there were no paths.
         Now it needs a check, to avoid trying to run all steps (this is a problem for steps that use `default_condition`).
      
      4. Change `RunDescription` to have a list of pathsets, rather than a single path.
      
      5. Remove paths as they're matched
      
         This allows checking at the end that no invalid paths are left over.
         Note that if two steps matched the same path, this will no longer run both;
         but that's a bug anyway.
      
      6. Handle suite paths separately from regular sets.
      
         Running multiple suite paths at once instead of in separate `make_run` invocations is both tricky and not particularly useful.
         The respective test Steps already handle this by introspecting the original paths.
      
         Avoid having to deal with it by moving suite handling into a seperate loop than `PathSet::Set` checks.
      0da0a219
    • R
      make std not use &A: Allocator instance · b05d71f8
      Ralf Jung 提交于
      b05d71f8
    • R
      make btree not use &A: Allocator instance · 7952205b
      Ralf Jung 提交于
      7952205b
    • G
      Adding new eslint checks: · ec78ff4c
      Guillaume Gomez 提交于
       * no-sequences
       * no-throw-literal
      ec78ff4c
    • B
      Auto merge of #98004 - paolobarbolini:vecdeque-extend-trustedlen, r=the8472 · 2cec6874
      bors 提交于
      Add VecDeque::extend from TrustedLen specialization
      
      Continuation of #95904
      
      Inspired by how [`VecDeque::copy_slice` works](https://github.com/rust-lang/rust/blob/c08b235a5ce10167632bb0fddcd0c5d67f2d42e3/library/alloc/src/collections/vec_deque/mod.rs#L437-L454).
      
      ## Benchmarks
      
      Before
      
      ```
      test vec_deque::bench_extend_chained_bytes      ... bench:       1,026 ns/iter (+/- 17)
      test vec_deque::bench_extend_chained_trustedlen ... bench:       1,024 ns/iter (+/- 40)
      test vec_deque::bench_extend_trustedlen         ... bench:         637 ns/iter (+/- 693)
      ```
      
      After
      
      ```
      test vec_deque::bench_extend_chained_bytes      ... bench:         828 ns/iter (+/- 24)
      test vec_deque::bench_extend_chained_trustedlen ... bench:          25 ns/iter (+/- 1)
      test vec_deque::bench_extend_trustedlen         ... bench:          21 ns/iter (+/- 0)
      ```
      
      ## Why do it this way
      
      https://rust.godbolt.org/z/15qY1fMYh
      
      The Compiler Explorer example shows how "just" removing the capacity check, like the [`Vec` `TrustedLen` specialization](https://github.com/rust-lang/rust/blob/c08b235a5ce10167632bb0fddcd0c5d67f2d42e3/library/alloc/src/vec/spec_extend.rs#L22-L58) does, wouldn't have been enough for `VecDeque`. `wrap_add` would still have greatly limited what LLVM could do while optimizing.
      
      ---
      
      r? `@the8472`
      2cec6874
    • B
      Auto merge of #98153 - nnethercote:fix-MissingDoc-quadratic-behaviour, r=cjgillot · cdcc53b7
      bors 提交于
      Fix `MissingDoc` quadratic behaviour
      
      Best reviewed one commit at a time.
      
      r? `@cjgillot`
      cdcc53b7