1. 23 3月, 2021 1 次提交
  2. 22 3月, 2021 32 次提交
    • B
      Auto merge of #82855 - jyn514:no-temporaries, r=GuillaumeGomez · 2b8fbe6b
      bors 提交于
      Avoid temporary allocations in `render_assoc_item`
      
      `render_assoc_item` came up as very hot in a profile of rustdoc on
      `bevy`.  This avoids some temporary allocations just to calculate the
      length of the header.
      
      This should be a strict improvement, since all string formatting was
      done twice before.
      
      cc #82845
      2b8fbe6b
    • B
      Auto merge of #83360 - Dylan-DPC:rollup-17xulpv, r=Dylan-DPC · 142c8318
      bors 提交于
      Rollup of 9 pull requests
      
      Successful merges:
      
       - #80193 (stabilize `feature(osstring_ascii)`)
       - #80771 (Make NonNull::as_ref (and friends) return refs with unbound lifetimes)
       - #81607 (Implement TrustedLen and TrustedRandomAccess for Range<integer>, array::IntoIter, VecDequeue's iterators)
       - #82554 (Fix invalid slice access in String::retain)
       - #82686 (Move `std::sys::unix::platform` to `std::sys::unix::ext`)
       - #82771 (slice: Stabilize IterMut::as_slice.)
       - #83329 (Cleanup LLVM debuginfo module docs)
       - #83336 (Fix ICE with `use clippy::a::b;`)
       - #83350 (Download a more recent LLVM version if `src/version` is modified)
      
      Failed merges:
      
      r? `@ghost`
      `@rustbot` modify labels: rollup
      142c8318
    • D
      Rollup merge of #83350 - jyn514:llvm-version, r=Mark-Simulacrum · 790c2ad4
      Dylan DPC 提交于
      Download a more recent LLVM version if `src/version` is modified
      
      When bumping the bootstrap version, the name of the generated LLVM
      shared object file is changed, even though it's the same contents as
      before. If bootstrap tries to use an older version, it will get linking
      errors:
      
      ```
      Building rustdoc for stage1 (x86_64-unknown-linux-gnu)
         Compiling rustdoc-tool v0.0.0 (/home/joshua/rustc/src/tools/rustdoc)
      error: linking with `cc` failed: exit code: 1
        |
        = note: "cc" "-Wl,--as-needed" ... lots of args ...
        = note: /usr/bin/ld: cannot find -lLLVM-12-rust-1.53.0-nightly
                clang: error: linker command failed with exit code 1 (use -v to see invocation)
      
      error: could not compile `rustdoc-tool`
      ```
      
      Helps with https://github.com/rust-lang/rust/issues/81930.
      790c2ad4
    • D
      Rollup merge of #83336 - camelid:tool-mod-ice, r=petrochenkov · ea5ba76d
      Dylan DPC 提交于
      Fix ICE with `use clippy::a::b;`
      
      Fixes #83317.
      ea5ba76d
    • D
      Rollup merge of #83329 - camelid:debuginfo-doc-cleanup, r=davidtwco · 85f16fb4
      Dylan DPC 提交于
      Cleanup LLVM debuginfo module docs
      
      - Move debuginfo docs from `doc.rs` module to `doc.md` file
      - Cleanup LLVM debuginfo module docs
      85f16fb4
    • D
      Rollup merge of #82771 - emilio:iter-mut-as-slice, r=m-ou-se · 34285def
      Dylan DPC 提交于
      slice: Stabilize IterMut::as_slice.
      
      Much like #72584.
      
      As per #58957 there's no blocker for this, and I wanted to use this
      today :-)
      
      Closes #58957
      34285def
    • D
      Rollup merge of #82686 - CDirkx:unix-platform, r=m-ou-se · c66d66e8
      Dylan DPC 提交于
      Move `std::sys::unix::platform` to `std::sys::unix::ext`
      
      This moves the operating system dependent alias `platform` (`std::os::{linux, android, ...}`) from `std::sys::unix` to `std::sys::unix::ext` (a.k.a. `std::os::unix`), removing the need for compatibility code in `unix_ext` when documenting on another platform.
      
      This is also a step in making it possible to properly move `std::sys::unix::ext` to `std::os::unix`, as ideally `std::sys` should not depend on the rest of `std`.
      c66d66e8
    • D
      Rollup merge of #82554 - SkiFire13:fix-string-retain-unsoundness, r=m-ou-se · da143d38
      Dylan DPC 提交于
      Fix invalid slice access in String::retain
      
      As noted in #78499, the previous fix was technically still unsound because it accessed elements of a slice outside its bounds (even though they were still inside the same allocation). This PR addresses that concern by switching to a dropguard approach.
      da143d38
    • D
      Rollup merge of #81607 - the8472:trustedrandomaccess-all-the-things, r=m-ou-se · 29a53e6e
      Dylan DPC 提交于
      Implement TrustedLen and TrustedRandomAccess for Range<integer>, array::IntoIter, VecDequeue's iterators
      
      This should make some `FromIterator` and `.zip()` specializations applicable in a few more cases.
      
      ``@rustbot`` label libs-impl
      29a53e6e
    • D
      Rollup merge of #80771 - thomcc:nonnull-refmut, r=dtolnay · ad8aa185
      Dylan DPC 提交于
      Make NonNull::as_ref (and friends) return refs with unbound lifetimes
      
      # Rationale:
      
      1. The documentation for all of these functions claims that this is what the functions already do, as they all come with this comment:
      
          > You must enforce Rust's aliasing rules, *since the returned lifetime 'a is arbitrarily chosen* and does not necessarily reflect the actual lifetime of the data...
      
          So I think it's just a bug that they weren't this way already. Note that had it not been for this part, I wouldn't be making this PR, so if we decide we won't take this change, I'll follow it up with a docs PR to fix this.
      
      2. This is how the equivalent raw pointer functions behave.
      
          They also take `self` and not `&self`/`&mut self`, but that can't be changed compatibly at this point. This is the next best thing.
      
      3. Without this fix, often code that uses these methods will find it has to expand the lifetime of the result.
      
          (I can't speak for others but even in unsafe-heavy code, needing to do this unexpectedly is a huge red flag -- if Rust thinks something should have a specific lifetime, I assume it's for a reason)
      
      ### Can this cause existing code to be unsound?
      
      I'm confident this can't cause new unsoundness since the reference exists for at most its lifetime, but you get a borrow checker error if you do something that would require/allow the reference to exist past its lifetime.
      
      Additionally, the aliasing rules of a reference only applies while the reference exists.
      
      This *must* be the case, as it is required by the rules used by safe code. (That said, the documentation in this file sort of contradicts it, but I think it's just ambiguity between the lifetime `'a` in `&'a T` and lifetime of the `&'a T` reference itself...)
      
      We are increasing the lifetime of these references, but they should already have hard bounds on that lifetime, or they'd have borrow checker errors.
      
      (CC ``@RalfJung`` because I have gone and done the mistake where I say something definitive about aliasing in Rust which is honestly outside the group of things I should make definitive comments about).
      
      # Caveats
      
      1. This is insta-stable (except for on the unstable functions ofc). I don't think there's any other alternative.
      
      2. I don't believe this is a breaking change in practice. In theory someone could be assigning `NonNull::as_ref` to a function pointer of type `fn(&NonNull<T>) -> &T`. Now they'd need to use a slightly different function pointer type which is (probably) incompatible. This seems pathological, but I guess crater could be used if there are concerns.
      
      3. This has no tests. The old version didn't either that I saw. I could add some stuff that fails to compile without it, if that would be useful.
      
      4. Sometimes the NLL borrow checker gives up and decides lifetimes live till the end of the scope, as opposed to the range where they're used. If this change can cause this to happen more, then my soundness rationale is wrong, and it's likely breaking.
      
          In practice this seems super unlikely.
      
      Anyway. That was a lot of typing.
      
      Fixes https://github.com/rust-lang/rust/issues/80183
      ad8aa185
    • D
      Rollup merge of #80193 - zseri:stabilize-osstring-ascii, r=m-ou-se · e9398bcc
      Dylan DPC 提交于
      stabilize `feature(osstring_ascii)`
      
      This PR stabilizes `feature(osstring_ascii)`.
      
      Fixes #70516.
      e9398bcc
    • B
      Auto merge of #79846 - the8472:inplace-tra, r=m-ou-se · 35385770
      bors 提交于
      Use TrustedRandomAccess for in-place iterators where possible
      
      This can speed up in-place iterators containing simple casts and transmutes from `Copy` types to any type of same size. `!Copy` types can't be optimized since `TrustedRandomAccess`  isn't implemented for those iterators.
      
      ```
       name                  on.b ns/iter     o1.b ns/iter     diff ns/iter   diff %  speedup
       vec::bench_transmute  20 (40000 MB/s)  12 (66666 MB/s)            -8  -40.00%   x 1.67
      ```
      35385770
    • T
      disable debug assertions in codegen test · 2d8be457
      The8472 提交于
      2d8be457
    • M
      Bump slice_iter_mut_as_slice stable version. · 2bd7c1b5
      Mara Bos 提交于
      2bd7c1b5
    • B
      Auto merge of #82834 - nikic:mutable-noalias, r=nagisa · 97663b66
      bors 提交于
      Enable mutable noalias for LLVM >= 12
      
      Enable mutable noalias by default on LLVM 12, as previously known miscompiles have been resolved. Now it's time to find the next one ;)
      
       * The `-Z mutable-noalias` option no longer has an explicit default and accepts `-Z mutable-noalias=yes` and `-Z mutable-noalias=no` to override the LLVM version based default behavior.
       * The decision on whether to apply the noalias attribute is moved into rustc_codegen_llvm. rustc_middle only provides us with the necessary information to make the decision.
       * `noalias` is not emitted for types that are `!Unpin`, as a heuristic for self-referential structures (see #54878 and #63818).
      97663b66
    • C
      Fix ICE with `use clippy::a::b;` · bfae41d7
      Camelid 提交于
      bfae41d7
    • N
      Update doc/reference submodule · 68a62b76
      Nikita Popov 提交于
      In particular this pulls in an update to the auto-deref
      recursion_limit example, to no longer rely on the Freeze query.
      68a62b76
    • N
      Don't compute optimized PointerKind for unoptimized builds · 6ac229ca
      Nikita Popov 提交于
      This saves us both the Freeze/Unpin queries, and avoids placing
      noalias attributes, which have a compile-time impact on LLVM
      even in optnone builds (due to always_inline functions).
      6ac229ca
    • T
      add codegen test · 17f4c2a4
      The8472 提交于
      17f4c2a4
    • T
      specialize in-place collection further via TrustedRandomAccess · 6c67e552
      The8472 提交于
      This allows the optimizer to turn certain iterator pipelines such as
      
      ```rust
      let vec = vec![0usize; 100];
      vec.into_iter().map(|e| e as isize).collect::<Vec<_>>()
      ```
      
      into a noop.
      
      The optimization only applies when iterator sources are  `T: Copy`
      since `impl TrustedRandomAccess for IntoIter<T>`.
      No such requirement applies to the output type (`Iterator::Item`).
      6c67e552
    • T
      add transmute-via-iterators bench · a1a04e08
      The8472 提交于
      a1a04e08
    • T
      implement TrustedRandomAccess for array::IntoIter · 08a1dd28
      The8472 提交于
      08a1dd28
    • T
      implement TrustedRandomAccess for Ranges over int types · 895d7a9a
      The8472 提交于
      895d7a9a
    • T
      use BITS constant · 1438207c
      The8472 提交于
      1438207c
    • T
      236c0cf1
    • N
      Enable mutable noalias by default for LLVM 12 · 39ed6439
      Nikita Popov 提交于
      We don't have any known noalias bugs for LLVM 12 ... yet.
      39ed6439
    • N
      Don't consider !Unpin references as noalias · c3f9403f
      Nikita Popov 提交于
      Such structures may contain self-references, in which case the
      same location may be accessible through a pointer that is not
      based-on the noalias pointer.
      
      This is still grey area as far as language semantics are concerned,
      but checking for !Unpin as an indicator for self-referential
      sturctures seems like a good approach for the meantime.
      c3f9403f
    • N
      Convert -Z mutable-noalias to Optional<bool> · 08c5ffd4
      Nikita Popov 提交于
      The default value will dependend on the LLVM version in the future,
      so don't specify one to start with.
      08c5ffd4
    • N
      Move decision aboute noalias into codegen_llvm · dfc4cafe
      Nikita Popov 提交于
      The frontend shouldn't be deciding whether or not to use mutable
      noalias attributes, as this is a pure LLVM concern. Only provide
      the necessary information and do the actual decision in
      codegen_llvm.
      dfc4cafe
    • M
      Bump osstring_ascii stabilization version to 1.53.0. · 0acdada1
      Mara Bos 提交于
      0acdada1
    • B
      Auto merge of #83053 - oli-obk:const_stab_version, r=m-ou-se · f8266419
      bors 提交于
      Fix const stability `since` versions.
      
      fixes #82085
      
      r? `@m-ou-se`
      f8266419
    • J
      Download a more recent LLVM version if `src/version` is modified · 40021713
      Joshua Nelson 提交于
      When bumping the bootstrap version, the name of the generated LLVM
      shared object file is changed, even though it's the same contents as
      before. If bootstrap tries to use an older version, it will get linking
      errors:
      
      ```
      Building rustdoc for stage1 (x86_64-unknown-linux-gnu)
         Compiling rustdoc-tool v0.0.0 (/home/joshua/rustc/src/tools/rustdoc)
      error: linking with `cc` failed: exit code: 1
        |
        = note: "cc" "-Wl,--as-needed" ... lots of args ...
        = note: /usr/bin/ld: cannot find -lLLVM-12-rust-1.53.0-nightly
                clang: error: linker command failed with exit code 1 (use -v to see invocation)
      
      error: could not compile `rustdoc-tool`
      ```
      40021713
  3. 21 3月, 2021 7 次提交