1. 23 5月, 2020 6 次提交
  2. 22 5月, 2020 34 次提交
    • B
      Auto merge of #72464 - RalfJung:rollup-xhm7w7u, r=RalfJung · 215f2d32
      bors 提交于
      Rollup of 7 pull requests
      
      Successful merges:
      
       - #71829 (Fix suggestion to borrow in struct)
       - #72123 (Stabilize process_set_argv0 feature for Unix)
       - #72235 (Clean up E0590 explanation)
       - #72345 (Clean up E0593 explanation)
       - #72376 ([self-profling] Record the cgu name when doing codegen for a module)
       - #72399 (Add fast-path optimization for Ipv4Addr::fmt)
       - #72435 (rustllvm: Fix warnings about unused function parameters)
      
      Failed merges:
      
      r? @ghost
      215f2d32
    • E
      Allow rust-highfive to label issues it creates. · dc4b9fd8
      Elinvynia 提交于
      Replace sets with lists.
      dc4b9fd8
    • R
      Rollup merge of #72435 - petrochenkov:cratetypesopt, r=Mark-Simulacrum · e7503ca7
      Ralf Jung 提交于
      rustllvm: Fix warnings about unused function parameters
      
      And then perform corresponding cleanups on Rust side.
      
      Fixes https://github.com/rust-lang/rust/issues/72427
      e7503ca7
    • R
      Rollup merge of #72399 - Lucretiel:ipv4-display-fast, r=kennytm · 37587af8
      Ralf Jung 提交于
      Add fast-path optimization for Ipv4Addr::fmt
      
      Don't use an intermediary buffer when writing an IPv4 address without any specific alignment options
      37587af8
    • R
      Rollup merge of #72376 - wesleywiser:record_cgu_name, r=Mark-Simulacrum · a116e7b0
      Ralf Jung 提交于
      [self-profling] Record the cgu name when doing codegen for a module
      a116e7b0
    • R
      Rollup merge of #72345 - GuillaumeGomez:cleanup-e0593, r=Dylan-DPC · f7ed13b6
      Ralf Jung 提交于
      Clean up E0593 explanation
      
      r? @Dylan-DPC
      f7ed13b6
    • R
      Rollup merge of #72235 - GuillaumeGomez:cleanup-E0590, r=Dylan-DPC · 02eb002e
      Ralf Jung 提交于
      Clean up E0590 explanation
      
      r? @Dylan-DPC
      02eb002e
    • R
      Rollup merge of #72123 - jsgf:stabilize-arg0, r=sfackler · 53d00469
      Ralf Jung 提交于
      Stabilize process_set_argv0 feature for Unix
      
      This stabilizes process_set_argv0 targeting 1.45.0. It has been
      useful in practice and seems useful as-is.
      
      The equivalent feature could be implemented for Windows, but as far as I
      know nobody has. That can be done separately.
      
      Tracking issue: #66510
      53d00469
    • R
      Rollup merge of #71829 - kper:issue71136, r=matthewjasper · 9c34481c
      Ralf Jung 提交于
      Fix suggestion to borrow in struct
      
      The corresponding issue is #71136.
      The compiler suggests that borrowing `the_foos` might solve the problem. This is obviously incorrect.
      ```
      struct Foo(u8);
      
      #[derive(Clone)]
      struct FooHolster {
          the_foos: Vec<Foo>,
      }
      ```
      
      I propose as fix to check if there is any colon in the span. However, there might a case where `my_method(B { a: 1, b : foo })` would be appropriate to show a suggestion for `&B ...`.  To fix that too, we can simply check if there is a bracket in the span. This is only possible because both spans are different.
      Issue's span: `the_foos: Vec<Foo>`
      other's span: `B { a : 1, b : foo }`
      9c34481c
    • T
      Allow using `Self::` in doc · fc0675bf
      Tymoteusz Jankowski 提交于
      fc0675bf
    • G
      Clean up E0590 explanation · 985ebf2c
      Guillaume Gomez 提交于
      985ebf2c
    • B
      Auto merge of #72460 - RalfJung:rollup-28fs06y, r=RalfJung · a9ca1ec9
      bors 提交于
      Rollup of 4 pull requests
      
      Successful merges:
      
       - #71610 (InvalidUndefBytes: Track size of undef region used)
       - #72161 (Replace fcntl-based file lock with flock)
       - #72306 (Break tokens before checking if they are 'probably equal')
       - #72325 (Always generated object code for `#![no_builtins]`)
      
      Failed merges:
      
      r? @ghost
      a9ca1ec9
    • R
      Rollup merge of #72325 - alexcrichton:ignore-linker-plugin-lto, r=nnethercote · 1119421e
      Ralf Jung 提交于
      Always generated object code for `#![no_builtins]`
      
      This commit updates the code generation for `#![no_builtins]` to always
      produce object files instead of conditionally respecting
      `-Clinker-plugin-lto` and sometimes producing bitcode. This is intended
      to address rust-lang/cargo#8239.
      
      The issue at hand here is that Cargo has tried to get "smarter" about
      codegen in whole crate graph scenarios. When LTO is enabled it attempts
      to avoid codegen on as many crates as possible, opting to pass
      `-Clinker-plugin-lto` where it can to only generate bitcode. When this
      is combined with `-Zbuild-std`, however, it means that
      `compiler-builtins` only generates LLVM bitcode instead of object files.
      Rustc's own LTO passes then explicitly skip `compiler-builtins` (because
      it wouldn't work anyway) which means that LLVM bitcode gets sent to the
      linker, which chokes most of the time.
      
      The fix in this PR is to not actually respect `-Clinker-plugin-lto` for
      `#![no_builtins]` crates. These crates, even if slurped up by the linker
      rather than rustc, will not work with LTO. They define symbols which are
      only referenced as part of codegen, so LTO's aggressive internalization
      would trivially remove the symbols only to have the linker realize later
      that the symbol is undefined. Since pure-bitcode never makes sense for
      these libraries, the `-Clinker-plugin-lto` flag is silently ignored.
      1119421e
    • R
      Rollup merge of #72306 - Aaron1011:feature/turbo-spacing, r=petrochenkov · 62d4e9ee
      Ralf Jung 提交于
      Break tokens before checking if they are 'probably equal'
      
      Fixes #68489
      Fixes #70987
      
      When checking two `TokenStreams` to see if they are 'probably equal',
      we ignore the `IsJoint` information associated with each `TokenTree`.
      However, the `IsJoint` information determines whether adjacent tokens
      will be 'glued' (if possible) when construction the `TokenStream` - e.g.
      `[Gt Gt]` can be 'glued' to `BinOp(Shr)`.
      
      Since we are ignoring the `IsJoint` information, 'glued' and 'unglued'
      tokens are equivalent for determining if two `TokenStreams` are
      'probably equal'. Therefore, we need to 'unglue' all tokens in the
      stream to avoid false negatives (which cause us to throw out the cached
      tokens, losing span information).
      62d4e9ee
    • R
      Rollup merge of #72161 - nbdd0121:master, r=cuviper · a8018e22
      Ralf Jung 提交于
      Replace fcntl-based file lock with flock
      
      WSL1 does not support `fcntl`-based lock and will always report success,
      therefore creating a race condition when multiple rustc processes are
      modifying shared data such as `search-index.js`. WSL1 does however
      support `flock`.
      
      `flock` is supported by all unix-like platforms. The only caveat is that
      Linux 2.6.11 or earlier does not support `flock` on NFS mounts, but as
      the minimum supported Linux version is 2.6.18, it is not an issue.
      
      Fixes #72157
      a8018e22
    • R
      Rollup merge of #71610 - divergentdave:InvalidUndefBytes-range, r=RalfJung · 2059112e
      Ralf Jung 提交于
      InvalidUndefBytes: Track size of undef region used
      
      This PR adds a size to `UndefinedBehaviorInfo::InvalidUndefBytes`, to keep track of how many undefined bytes in a row were accessed, and changes a few methods to pass this information through. This additional information will eventually be used in Miri to improve diagnostics for this UB error. See also rust-lang/miri#1354 for prior discussion.
      
      I expect Miri will break the next time its submodule is updated, due to this change to the `InvalidUndefBytes`. (The current commit for src/tools/miri predates rust-lang/miri#1354, and thus does not try to destructure the `InvalidUndefBytes` variant) I have a corresponding change prepared for that repository.
      
      r? @RalfJung
      2059112e
    • K
      Using `!span.from_expansion()` instead of snippets · e7761214
      Kevin Per 提交于
      e7761214
    • B
      Auto merge of #72458 - RalfJung:rollup-g1w1vws, r=RalfJung · de6060b0
      bors 提交于
      Rollup of 6 pull requests
      
      Successful merges:
      
       - #71607 (clarify interaction of pin drop guarantee and panics)
       - #72125 (remove broken link)
       - #72133 (Add target thumbv7a-uwp-windows-msvc)
       - #72304 (rustc_target: Avoid an inappropriate use of `post_link_objects`)
       - #72309 (Some renaming and minor refactoring for `NativeLibraryKind`)
       - #72438 (Enable ARM TME (Transactional Memory Extensions))
      
      Failed merges:
      
      r? @ghost
      de6060b0
    • R
      Rollup merge of #72438 - vertexclique:vcq/aarch64-tme-features, r=Amanieu · 64beaffd
      Ralf Jung 提交于
      Enable ARM TME (Transactional Memory Extensions)
      
      Enables ARM TME coming up with LLVM 10. Related ARM TME intrinsics are included by the merge of #67900.
      
      Enables: https://github.com/rust-lang/stdarch/pull/855
      64beaffd
    • R
      Rollup merge of #72309 - petrochenkov:linkunspec, r=matthewjasper · afbbb862
      Ralf Jung 提交于
      Some renaming and minor refactoring for `NativeLibraryKind`
      afbbb862
    • R
      Rollup merge of #72304 - petrochenkov:sgxunwind, r=nikomatsakis,jethrogb,dingelish · 0eba1522
      Ralf Jung 提交于
      rustc_target: Avoid an inappropriate use of `post_link_objects`
      
      It isn't supposed to be used for linking libraries.
      Also linking libunwind unconditionally (and not together with the `src/libunwind` crate) is suspicious.
      
      @jethrogb @VardhanThigle
      Could you verify that it works as expected?
      0eba1522
    • R
      Rollup merge of #72133 - bdbai:master, r=joshtriplett · 715f1e84
      Ralf Jung 提交于
      Add target thumbv7a-uwp-windows-msvc
      
      Add target spec for thumbv7a-uwp-windows-msvc, so that libraries written in Rust will have a chance to run on ARM-based devices with Windows 10.
      
      So far I managed to create a proof-of-concept library for Universal Windows Platform apps to consume and it worked on a Windows Phone. However, building a standalone executable seemed troublesome due to `LLVM ERROR: target does not implement codeview register mapping` stuff (see also https://github.com/rust-lang/rust/issues/52659#issuecomment-408233322 ).
      
      Steps to test:
      1. Clone and build this version
      ```sh
      git clone https://github.com/bdbai/rust.git
      cd rust
      python x.py build -i --target thumbv7a-uwp-windows-msvc --stage 1 src/libstd
      rustup toolchain link arm-uwp-stage1 .\build\x86_64-pc-windows-msvc\stage1\
      ```
      2. Create a new library crate
      ```sh
      cargo new --lib arm-uwp-test
      cd arm-uwp-test
      ```
      3. Change `crate-type` in `Cargo.toml` to `staticlib`
      ```toml
      [lib]
      crate-type=["staticlib"]
      ```
      4. Replace the following code in `src/lib.rs`
      ```rust
      #[no_mangle]
      pub extern "system" fn call_rust() -> i32 {
          2333
      }
      ```
      5. Build the crate
      ```sh
      cargo +arm-uwp-stage1 build -v --target thumbv7a-uwp-windows-msvc
      ```
      6. `arm-uwp-test.lib` should appear in `target\thumbv7a-uwp-windows-msvc\debug`
      
      To consume this library:
      1. Make sure Visual Studio 2017 and Windows 10 SDK (10.0.17134 or above) are installed
      2. Create a new Blank App (C++/WinRT) in Visual Studio 2017 (Visual Studio 2019 cannot deploy UWP apps to Windows Phone)
      3. Go to Property Pages, and then Linker->Input->Additional Dependencies, add `arm-uwp-test.lib` produced just now
      4. Manually declare function prototypes in `MainPage.h`
      ```c++
      extern "C" {
          int call_rust();
      }
      ```
      5. Replace the `ClickHandler` part in `MainPage.cpp`
      ```c++
      myButton().Content(box_value(std::to_wstring(call_rust())));
      ```
      6. Build and deploy this app to an ARM device running Windows 10. The app should run and show `2333` when the button is clicked.
      715f1e84
    • R
      Rollup merge of #72125 - tshepang:broken-link, r=nikomatsakis · ee0c7d48
      Ralf Jung 提交于
      remove broken link
      
      Not sure why this is broken @Marwes
      ee0c7d48
    • R
      Rollup merge of #71607 - RalfJung:pin-drop-panic, r=nikomatsakis · a819f428
      Ralf Jung 提交于
      clarify interaction of pin drop guarantee and panics
      
      Cc https://github.com/rust-lang/unsafe-code-guidelines/issues/232
      @Diggsey would this have helped?
      a819f428
    • B
      Auto merge of #72000 - cuviper:dist-llvm, r=Mark-Simulacrum · c60b675e
      bors 提交于
      Move the target libLLVM to llvm-tools-preview
      
      For running the compiler, we usually only need LLVM from `$sysroot/lib`,
      which rustup will make available with `LD_LIBRARY_PATH`. We've also been
      shipping LLVM in the `$target/lib` directory, which bloats the download
      and installed size. The only times we do need the latter are for the
      RPATH of `llvm-tools-preview` binaries, and for linking `rustc-dev`
      libraries. We'll move it to the `llvm-tools-preview` component directly,
      and `rustc-dev` will have an implicit dependency on it.
      
      Here are the dist sizes that I got before and after this change:
      
          llvm-tools-1.45.0-dev-x86_64-unknown-linux-gnu.tar.gz     1.3M   24M
          llvm-tools-1.45.0-dev-x86_64-unknown-linux-gnu.tar.xz     748K   17M
          rustc-1.45.0-dev-x86_64-unknown-linux-gnu.tar.gz          83M    61M
          rustc-1.45.0-dev-x86_64-unknown-linux-gnu.tar.xz          56M    41M
      
      The installed size should reduce by exactly one `libLLVM.so` (~70-80M),
      unless you also install `llvm-tools`, and then it should be identical.
      
      Resolves #70838.
      c60b675e
    • D
      Add flag to open docs: x.py doc --open · 6a3aae8a
      David Tolnay 提交于
      Tested with:
      
             # opens doc/index.html
          x.py doc --stage 0 --open
          x.py doc --stage 0 --open src/doc
      
             # opens doc/book/index.html
          x.py doc --stage 0 --open src/doc/book
      
             # opens doc/std/index.html
          x.py doc --stage 0 --open src/libstd
      
             # opens doc/proc_macro/index.html
          x.py doc --stage 0 --open src/libproc_macro
      
             # opens both
          x.py doc --stage 0 --open src/libstd src/libproc_macro
      6a3aae8a
    • B
      Auto merge of #71956 - ecstatic-morse:remove-requires-storage-analysis, r=tmandry · 458a3e76
      bors 提交于
      Clean up logic around live locals in generator analysis
      
      Resolves #69902. Requires #71893.
      
      I've found it difficult to make changes in the logic around live locals in `generator/transform.rs`. It uses a custom dataflow analysis, `MaybeRequiresStorage`, that AFAICT computes whether a local is either initialized or borrowed. That analysis is using `before` effects, which we should try to avoid if possible because they are harder to reason about than ones only using the unprefixed effects. @pnkfelix has suggested removing "before" effects entirely to simplify the dataflow framework, which I might pursue someday.
      
      This PR replaces `MaybeRequiresStorage` with a combination of the existing `MaybeBorrowedLocals` and a new `MaybeInitializedLocals`. `MaybeInitializedLocals` is just `MaybeInitializedPlaces` with a coarser resolution: it works on whole locals instead of move paths. As a result, I was able to simplify the logic in `compute_storage_conflicts` and `locals_live_across_suspend_points`.
      
      This is not exactly equivalent to the old logic; some generators are now smaller than before. I believe this was because the old logic was too conservative, but I'm not as familiar with the constraints as the original implementers were, so I could be wrong. For example, I don't see a reason the size of the `mixed_sizes` future couldn't be 5K. It went from 7K to 6K in this PR.
      
      r? @jonas-schievink @tmandry
      458a3e76
    • B
      Auto merge of #72433 - RalfJung:rollup-srft8nx, r=RalfJung · d9417b38
      bors 提交于
      Rollup of 7 pull requests
      
      Successful merges:
      
       - #72055 (Intern predicates)
       - #72149 (Don't `type_of` on trait assoc ty without default)
       - #72347 (Make intra-link resolve links for both trait and impl items)
       - #72350 (Improve documentation of `slice::from_raw_parts`)
       - #72382 (Show default values for debug-assertions & debug-assertions-std)
       - #72421 (Fix anchor display when hovering impl)
       - #72425 (fix discriminant_value sign extension)
      
      Failed merges:
      
      r? @ghost
      d9417b38
    • M
      Enable ARM TME (Transactional Memory Extensions) · 4a10f6cd
      Mahmut Bulut 提交于
      4a10f6cd
    • S
      93abdd75
    • R
      Rollup merge of #72425 - RalfJung:discr-sign-ext, r=nikomatsakis · 74b5c502
      Ralf Jung 提交于
      fix discriminant_value sign extension
      
      Fixes a regression introduced in https://github.com/rust-lang/rust/pull/70705
      r? @nikomatsakis Cc @lcnr @oli-obk
      74b5c502
    • R
      Rollup merge of #72421 - GuillaumeGomez:fix-impl-hover-anchor, r=kinnison · fc729d0c
      Ralf Jung 提交于
      Fix anchor display when hovering impl
      
      A little gif for the fixed behaviour:
      
      ![hover-anchor](https://user-images.githubusercontent.com/3050060/82549808-cfdf4080-9b5d-11ea-9495-2b1d90b2a791.gif)
      
      r? @kinnison
      fc729d0c
    • R
      Rollup merge of #72382 - tmiasko:config-toml-debug-assertions, r=nikomatsakis · 503a2fde
      Ralf Jung 提交于
      Show default values for debug-assertions & debug-assertions-std
      503a2fde
    • R
      Rollup merge of #72350 - danielhenrymantilla:doc_warn_against_adjacent_slice_concat, r=RalfJung · 261505a0
      Ralf Jung 提交于
      Improve documentation of `slice::from_raw_parts`
      
      This is to provide a more explicit statement against a code pattern that
      many people end up coming with, since the reason of it being unsound
      comes from the badly known single-allocation validity rule.
      
      Providing that very pattern as a counter-example could help mitigate that.
      
      See also: https://internals.rust-lang.org/t/pre-rfc-add-join-seq-method-to-slices-and-strs/11936/13
      
      r? @RalfJung
      261505a0