1. 22 5月, 2020 15 次提交
    • 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 #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
    • 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
    • R
      Rollup merge of #72347 - xliiv:72340-impl-for-default, r=GuillaumeGomez · 3d5f130a
      Ralf Jung 提交于
      Make intra-link resolve links for both trait and impl items
      
      Closes #72340
      3d5f130a
    • R
      Rollup merge of #72149 - estebank:icemation, r=eddyb · dc65fd4f
      Ralf Jung 提交于
      Don't `type_of` on trait assoc ty without default
      
      Fix #72076.
      dc65fd4f
    • R
      Rollup merge of #72055 - lcnr:predicate-kind, r=nikomatsakis · 22438fc2
      Ralf Jung 提交于
      Intern predicates
      
      Implements the first step of https://github.com/rust-lang/compiler-team/issues/285
      
      Renames `ty::Predicate` to `ty::PredicateKind`, which is now interned.
      To ease the transition, `ty::Predicate` is now a struct containing a reference
      to `ty::PredicateKind`.
      
      r? @ghost
      22438fc2
    • B
      Auto merge of #71930 - Nadrieril:exhaustiveness-remove-tyerr, r=varkor · 9310e3bd
      bors 提交于
      De-abuse TyKind::Error in exhaustiveness checking
      
      Replaces https://github.com/rust-lang/rust/pull/71074. Context: https://github.com/rust-lang/rust/issues/70866.
      
      In order to remove the use of `TyKind::Error`, I had to make sure we skip over those fields whose inhabitedness should not be observed. This is potentially error-prone however, since we must be careful not to mix filtered and unfiltered lists of patterns. I managed to hide away most of the filtering behind a new `Fields` struct, that I used everywhere relevant. I quite like the result; I think the twin concepts of `Constructor` and `Fields` make a good mental model.
      
      As usual, I tried to separate commits that shuffle code around from commits that require more thought to review.
      
      cc @varkor @Centril
      9310e3bd
    • R
      Typo · 67e07558
      Ralf Jung 提交于
      67e07558
    • D
      Improve documentation of `slice::from_raw_parts` · a81e9a78
      Daniel Henry-Mantilla 提交于
      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.
      Co-authored-by: NRalf Jung <post@ralfj.de>
      a81e9a78
  2. 21 5月, 2020 19 次提交
  3. 20 5月, 2020 6 次提交