1. 13 12月, 2020 3 次提交
  2. 12 12月, 2020 10 次提交
    • B
      Auto merge of #79370 - jyn514:tidy-error, r=GuillaumeGomez · 4c5c4aa0
      bors 提交于
      Don't abort rustdoc tests if `tidy` isn't installed
      
      Follow-up to https://github.com/rust-lang/rust/pull/78752.
      
      Before:
      
      ```
      Check compiletest suite=rustdoc mode=rustdoc (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
      
      running 396 tests
      ..................................................2020-11-23T12:12:37.735649Z ERROR compiletest::runtest: fatal error, panic: "failed to run tidy - is it installed? - No such file or directory (os error 2)"
      F................................................. 100/396
      .................................................................................................... 200/396
      .................................................................................................... 300/396
      ...............................i...............2020-11-23T12:15:00.271271Z ERROR compiletest::runtest: fatal error, panic: "failed to run tidy - is it installed? - No such file or directory (os error 2)"
      F................................................
      ```
      
      After:
      
      ```
      Check compiletest suite=rustdoc mode=rustdoc (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
      
      running 4 tests
      .FFF
      failures:
      
      ---- [rustdoc] rustdoc/fn-pointer-arg-name.rs stdout ----
      
      error: htmldocck failed!
      status: exit code: 1
      command: "/usr/bin/python" "/home/joshua/rustc/src/etc/htmldocck.py" "/home/joshua/rustc/build/x86_64-unknown-linux-gnu/test/rustdoc/fn-pointer-arg-name" "/home/joshua/rustc/src/test/rustdoc/fn-pointer-arg-name.rs"
      stdout:
      ------------------------------------------
      
      ------------------------------------------
      stderr:
      ------------------------------------------
      4: `@has` check failed
      	`XPATH PATTERN` did not match
      	// `@has` - '//*[`@class="rust` fn"]' 'pub fn f(callback: fn(len: usize, foo: u32))'
      
      Encountered 1 errors
      
      ------------------------------------------
      
      info: generating a diff against nightly rustdoc
      failed to run tidy - is it installed? - Permission denied (os error 13)
      failed to run tidy - is it installed? - Permission denied (os error 13)
       # a diff without running `tidy`
      ```
      
      r? `@GuillaumeGomez`
      4c5c4aa0
    • J
      Ignore .css files in the diff · f9b97a8e
      Joshua Nelson 提交于
      These are always static and never autogenerated, so the diffs aren't
      useful.
      f9b97a8e
    • J
      804b72af
    • J
      Don't abort rustdoc tests if `tidy` isn't installed · 409382dd
      Joshua Nelson 提交于
      Before:
      
      ```
      Check compiletest suite=rustdoc mode=rustdoc (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
      
      running 396 tests
      ..................................................2020-11-23T12:12:37.735649Z ERROR compiletest::runtest: fatal error, panic: "failed to run tidy - is it installed? - No such file or directory (os error 2)"
      F................................................. 100/396
      .................................................................................................... 200/396
      .................................................................................................... 300/396
      ...............................i...............2020-11-23T12:15:00.271271Z ERROR compiletest::runtest: fatal error, panic: "failed to run tidy - is it installed? - No such file or directory (os error 2)"
      F................................................
      ```
      
      After:
      
      ```
      Check compiletest suite=rustdoc mode=rustdoc (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
      
      running 4 tests
      .FFF
      failures:
      
      ---- [rustdoc] rustdoc/fn-pointer-arg-name.rs stdout ----
      
      error: htmldocck failed!
      status: exit code: 1
      command: "/usr/bin/python" "/home/joshua/rustc/src/etc/htmldocck.py" "/home/joshua/rustc/build/x86_64-unknown-linux-gnu/test/rustdoc/fn-pointer-arg-name" "/home/joshua/rustc/src/test/rustdoc/fn-pointer-arg-name.rs"
      stdout:
      ------------------------------------------
      
      ------------------------------------------
      stderr:
      ------------------------------------------
      4: @has check failed
      	`XPATH PATTERN` did not match
      	// @has - '//*[@class="rust fn"]' 'pub fn f(callback: fn(len: usize, foo: u32))'
      
      Encountered 1 errors
      
      ------------------------------------------
      
      info: generating a diff against nightly rustdoc
      failed to run tidy - is it installed? - Permission denied (os error 13)
      failed to run tidy - is it installed? - Permission denied (os error 13)
       # a diff without running `tidy`
      ```
      409382dd
    • B
      Auto merge of #79169 - LeSeulArtichaut:ty-lib, r=nikomatsakis · 3f2088aa
      bors 提交于
      Create `rustc_type_ir`
      
      Decided to start small 😄
      
      This PR creates a `rustc_type_ir` crate as part of the WG-Traits plan to create a shared type library.
      ~~There already exists a `rustc_ty` crate, so I named the new crate `rustc_ty_library`. However I think it would make sense to rename the current `rustc_ty` to something else (e.g. `rustc_ty_passes`) to free the name for this new crate.~~
      
      r? `@jackh726`
      3f2088aa
    • B
      Auto merge of #79937 - RalfJung:miri, r=RalfJung · c3ed6681
      bors 提交于
      update Miri
      
      Fixes https://github.com/rust-lang/rust/issues/79897
      Cc `@rust-lang/miri` r? `@ghost`
      c3ed6681
    • B
      Auto merge of #79931 - RalfJung:no-redundant-storage-live, r=oli-obk · 602899cd
      bors 提交于
      make redundant StorageLive UB
      
      The interesting behavior of StorageLive in loops (https://github.com/rust-lang/rust/issues/42371) has been fixed, so we can now finally make it a hard error to mark a local as live that is already live. :)
      
      r? `@oli-obk`
      Fixes https://github.com/rust-lang/rust/issues/42371
      602899cd
    • B
      Auto merge of #79553 - sexxi-goose:mir_min_cap_writeback, r=nikomatsakis · 5bd9b603
      bors 提交于
      Capture precise paths in THIR and MIR
      
      This PR allows THIR and MIR to use the result of the new capture analysis to actually capture precise paths
      
      To achieve we:
      - Writeback min capture results to TypeckResults
      - Move handling upvars to PlaceBuilder in mir_build
      - Lower precise paths in THIR build by reading min_captures
      - Search for ancestors in min_capture when trying to build a MIR place which starts off of an upvar
      
      Closes: https://github.com/rust-lang/project-rfc-2229/issues/10
      
      Partly implements: rust-lang/project-rfc-2229#18
      
      Work that remains (not in this PR):
      - [ ] [Known bugs when feature gate is enabled](https://github.com/rust-lang/project-rfc-2229/projects/1?card_filter_query=label%3Abug)
      - [ ] Use min_capure_map for
        - [ ] Liveness analysis
        - [ ] rustc_mir/interpret/validity.rs
        - [ ] regionck
      - [ ] rust-lang/project-rfc-2229#8
      - [ ] remove closure_captures and upvar_capture_map
      
      r? `@ghost`
      5bd9b603
    • B
      Auto merge of #79349 - Nemo157:issue-79201, r=jyn514 · 9eb3a7ce
      bors 提交于
      Apply `doc(cfg)` from parent items while collecting trait impls
      
      Because trait impls bypass the standard `clean` hierarchy they do not participate in the `propagate_doc_cfg` pass, so instead we need to pre-collect all possible `doc(cfg)` attributes that will apply to them when cleaning.
      
      fixes #79201
      9eb3a7ce
    • R
      update Miri · 17230b40
      Ralf Jung 提交于
      17230b40
  3. 11 12月, 2020 27 次提交
    • B
      Auto merge of #79925 - camelid:flatten-docs, r=scottmcm · 2225ee1b
      bors 提交于
      Improve wording of `flatten()` docs
      2225ee1b
    • B
      Auto merge of #79910 - RalfJung:abort-msg, r=oli-obk · a9f7d19a
      bors 提交于
      CTFE: tweak abort-on-uninhabited message
      
      Having an "aborted execution:" makes it more consistent with the `Abort` terminator saying "the program aborted execution". Right now, at least one of the two errors will look weird in Miri.
      
      r? `@oli-obk`
      a9f7d19a
    • R
      make redundant StorageLive UB · 78deacc2
      Ralf Jung 提交于
      78deacc2
    • B
      Auto merge of #79915 - Aaron1011:fix/fix-reuse-def-path-hash, r=petrochenkov · 19eb1c4c
      bors 提交于
      Use `def_path_hash_to_def_id` when re-using a `RawDefId`
      
      Fixes #79890
      
      Previously, we just copied a `RawDefId` from the 'old' map to the 'new'
      map. However, the `RawDefId` for a given `DefPathHash` may be different
      in the current compilation session. Using `def_path_hash_to_def_id`
      ensures that the `RawDefId` we use is valid in the current session.
      19eb1c4c
    • A
      Test cases for RFC 2229 · 01df5634
      Aman Arora 提交于
      01df5634
    • B
      Auto merge of #79893 - RalfJung:forget-windows, r=oli-obk · a2e29d67
      bors 提交于
      Windows TLS: ManuallyDrop instead of mem::forget
      
      The Windows TLS implementation still used `mem::forget` instead of `ManuallyDrop`, leading to the usual problem of "using" the `Box` when it should not be used any more.
      a2e29d67
    • B
      Auto merge of #79927 - tmandry:rollup-pwn4b1v, r=tmandry · 65d053ab
      bors 提交于
      Rollup of 11 pull requests
      
      Successful merges:
      
       - #77027 (Improve documentation for `std::{f32,f64}::mul_add`)
       - #79375 (Make the kernel_copy tests more robust/concurrent.)
       - #79639 (Add long explanation for E0212)
       - #79698 (Add tracking issue template for library features.)
       - #79809 (Dogfood `str_split_once()`)
       - #79851 (Clarify the 'default is only allowed on...' error)
       - #79858 (Update const-fn doc in unstable-book)
       - #79860 (Clarify that String::split_at takes a byte index.)
       - #79871 (Fix small typo in `wrapping_shl` documentation)
       - #79896 (Make search results tab and help button focusable with keyboard)
       - #79917 (Use Symbol for inline asm register class names)
      
      Failed merges:
      
      r? `@ghost`
      `@rustbot` modify labels: rollup
      65d053ab
    • T
      Rollup merge of #79917 - sivadeilra:asm_symbols, r=petrochenkov · 0327b5da
      Tyler Mandry 提交于
      Use Symbol for inline asm register class names
      
      This takes care of one "FIXME":
      // FIXME: use direct symbol comparison for register class names
      
      Instead of using string literals, this uses Symbol for register
      class names.
      
      This is part of work I am doing to improve how Symbol interning works.
      0327b5da
    • T
      Rollup merge of #79896 - GuillaumeGomez:more-elements-focus, r=Manishearth · 3a46a6b9
      Tyler Mandry 提交于
      Make search results tab and help button focusable with keyboard
      
      Fixes https://github.com/rust-lang/rust/issues/79859.
      
      I replaced the element with `button` tag, which allows to focus them (and "click" on them using "enter") using only the keyboard.
      
      cc ``@sersorrel``
      
      r? ``@Manishearth``
      3a46a6b9
    • T
      Rollup merge of #79871 - Pratyush:patch-1, r=joshtriplett · c94345e3
      Tyler Mandry 提交于
      Fix small typo in `wrapping_shl` documentation
      
      Fixes a small typo in the documentation.
      c94345e3
    • T
      Rollup merge of #79860 - rust-lang:frewsxcv-patch-2, r=jyn514 · c0cc9100
      Tyler Mandry 提交于
      Clarify that String::split_at takes a byte index.
      
      To someone skimming through the `String` docs and only reads the first line, the person could interpret "index" to be "char index". Later on in the docs it clarifies, but by adding "byte" it removes that ambiguity.
      c0cc9100
    • T
      Rollup merge of #79858 - sasurau4:doc/update-unstable-book-const-fn, r=oli-obk · 8709ac81
      Tyler Mandry 提交于
      Update const-fn doc in unstable-book
      
      Fix #79691
      
      I couldn't find suitable examples. It seems that `const_fn` feature-gate used only following place. https://github.com/rust-lang/rust/blob/810324d1f31eb8d75e8f0044df720652986ef133/compiler/rustc_ast_passes/src/feature_gate.rs#L560-L562
      
      And example like following emits [E0379](https://doc.rust-lang.org/error-index.html#E0379).
      
      ```rust
      #![feature(const_fn)]
      
      trait Foo {
          const fn bar() -> Self;
      }
      ```
      
      Any other suitable example exists, please let me know.
      8709ac81
    • T
      Rollup merge of #79851 - camelid:better-error-for-default-fn, r=davidtwco · dc905734
      Tyler Mandry 提交于
      Clarify the 'default is only allowed on...' error
      
      Code like
      
          impl Foo {
              default fn foo() {}
          }
      
      will trigger the error
      
          error: `default` is only allowed on items in `impl` definitions
           --> src/lib.rs:5:5
            |
          5 |     default fn foo() {}
            |     -------^^^^^^^^^
            |     |
            |     `default` because of this
      
      but that's very confusing! I *did* put it on an item in an impl!
      
      So this commit changes the message to
      
          error: `default` is only allowed on items in trait impls
           --> src/lib.rs:5:5
            |
          5 |     default fn foo() {}
            |     -------^^^^^^^^^
            |     |
            |     `default` because of this
      dc905734
    • T
      Rollup merge of #79809 - Eric-Arellano:split-once, r=matklad · 17ec4b82
      Tyler Mandry 提交于
      Dogfood `str_split_once()`
      
      Part of https://github.com/rust-lang/rust/issues/74773.
      
      Beyond increased clarity, this fixes some instances of a common confusion with how `splitn(2)` behaves: the first element will always be `Some()`, regardless of the delimiter, and even if the value is empty.
      
      Given this code:
      
      ```rust
      fn main() {
          let val = "...";
          let mut iter = val.splitn(2, '=');
          println!("Input: {:?}, first: {:?}, second: {:?}", val, iter.next(), iter.next());
      }
      ```
      
      We get:
      
      ```
      Input: "no_delimiter", first: Some("no_delimiter"), second: None
      Input: "k=v", first: Some("k"), second: Some("v")
      Input: "=", first: Some(""), second: Some("")
      ```
      
      Using `str_split_once()` makes more clear what happens when the delimiter is not found.
      17ec4b82
    • T
      Rollup merge of #79698 - m-ou-se:libs-tracking-issue-template, r=KodrAus · 8b9a59cb
      Tyler Mandry 提交于
      Add tracking issue template for library features.
      
      This adds a issue template for a library tracking issue.
      
      There's already a template for tracking issues, but it's mostly geared towards compiler/language features. A separate template makes it a bit easier to make sure it matches with the process we use for library changes.
      
      Main differences:
      - Added a note about how small library features can be added without RFC, and removed the parts that assume there's an RFC.
      - Merged the 'Steps' and 'History' sections: Library features are often small enough that there's no multiple steps planned ahead of time.
      - Removed the section about avoiding large discussions and opening separate issues for problems with the feature. Library features are usually focussed enough that the discussion about a feature is best kept together in the tracking issue.
      - Removed links to the rustc-dev-guide, which are specific to changes in the compiler and language.
      8b9a59cb
    • T
      Rollup merge of #79639 - sasurau4:feature/add-long-explanation-E0212, r=GuillaumeGomez · f3a3fc90
      Tyler Mandry 提交于
      Add long explanation for E0212
      
      Helps with #61137
      f3a3fc90
    • T
      Rollup merge of #79375 - vext01:kernel-copy-temps, r=bjorn3 · a8c19e1b
      Tyler Mandry 提交于
      Make the kernel_copy tests more robust/concurrent.
      
      These tests write to the same filenames in /tmp and in some cases these files don't get cleaned up properly. This caused issues for us when different users run the tests on the same system, e.g.:
      
      ```
      ---- sys::unix::kernel_copy::tests::bench_file_to_file_copy stdout ----
      thread 'sys::unix::kernel_copy::tests::bench_file_to_file_copy' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 13, kind: PermissionDenied, message: "Permission denied" }', library/std/src/sys/unix/kernel_copy/tests.rs:71:10
      ---- sys::unix::kernel_copy::tests::bench_file_to_socket_copy stdout ----
      thread 'sys::unix::kernel_copy::tests::bench_file_to_socket_copy' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 13, kind: PermissionDenied, message: "Permission denied" }', library/std/src/sys/unix/kernel_copy/tests.rs💯10
      ```
      
      Use `std::sys_common::io__test::tmpdir()` to solve this.
      
      CC ``@the8472.``
      a8c19e1b
    • T
      Rollup merge of #77027 - termhn:mul_add_doc_change, r=m-ou-se · 1b4ffe47
      Tyler Mandry 提交于
      Improve documentation for `std::{f32,f64}::mul_add`
      
      Makes it more clear that performance improvement is not guaranteed when using FMA, even when the target architecture supports it natively.
      1b4ffe47
    • C
      Improve wording of `flatten()` docs · 97cd55e9
      Camelid 提交于
      97cd55e9
    • B
      Auto merge of #79656 - jnqnfe:ordering, r=sfackler · 0c9ef564
      bors 提交于
      Add some core::cmp::Ordering helpers
      
      ...to allow easier equal-to-or-greater-than and less-than-or-equal-to
      comparisons.
      
      Prior to Rust 1.42 a greater-than-or-equal-to comparison might be written
      either as a match block, or a traditional conditional check like this:
      
      ```rust
      if cmp == Ordering::Equal || cmp == Ordering::Greater {
          // Do something
      }
      ```
      
      Which requires two instances of `cmp`. Don't forget that while `cmp` here
      is very short, it could be something much longer in real use cases.
      
      From Rust 1.42 a nicer alternative is possible:
      
      ```rust
      if matches!(cmp, Ordering::Equal | Ordering::Greater) {
          // Do something
      }
      ```
      
      The commit adds another alternative which may be even better in some cases:
      
      ```rust
      if cmp.is_equal_or_greater() {
          // Do something
      }
      ```
      
      The earlier examples could be cleaner than they are if the variants of
      `Ordering` are imported such that `Equal`, `Greater` and `Less` can be
      referred to directly, but not everyone will want to do that.
      
      The new solution can shorten lines, help avoid logic mistakes, and avoids
      having to import `Ordering` / `Ordering::*`.
      0c9ef564
    • B
      Auto merge of #77801 - fusion-engineering-forks:pin-mutex, r=Mark-Simulacrum · 8cef65fd
      bors 提交于
      Enforce no-move rule of ReentrantMutex using Pin and fix UB in stdio
      
      A `sys_common::ReentrantMutex` may not be moved after initializing it with `.init()`. This was not enforced, but only stated as a requirement in the comments on the unsafe functions. This change enforces this no-moving rule using `Pin`, by changing `&self` to a `Pin` in the `init()` and `lock()` functions.
      
      This uncovered a bug I introduced in #77154: stdio.rs (the only user of ReentrantMutex) called `init()` on its ReentrantMutexes while constructing them in the intializer of `SyncOnceCell::get_or_init`, which would move them afterwards. Interestingly, the ReentrantMutex unit tests already had the same bug, so this invalid usage has been tested on all (CI-tested) platforms for a long time. Apparently this doesn't break badly on any of the major platforms, but it does break the rules.\*
      
      To be able to keep using SyncOnceCell, this adds a `SyncOnceCell::get_or_init_pin` function, which makes it possible to work with pinned values inside a (pinned) SyncOnceCell. Whether this function should be public or not and what its exact behaviour and interface should be if it would be public is something I'd like to leave for a separate issue or PR. In this PR, this function is internal-only and marked with `pub(crate)`.
      
      \* Note: That bug is now included in 1.48, while this patch can only make it to ~~1.49~~ 1.50. We should consider the implications of 1.48 shipping with a wrong usage of `pthread_mutex_t` / `CRITICAL_SECTION` / .. which technically invokes UB according to their specification. The risk is very low, considering the objects are not 'used' (locked) before the move, and the ReentrantMutex unit tests have verified this works fine in practice.
      
      Edit: This has been backported and included in 1.48. And soon 1.49 too.
      
      ---
      
      In future changes, I want to push this usage of Pin further inside `sys` instead of only `sys_common`, and apply it to all 'unmovable' objects there (`Mutex`, `Condvar`, `RwLock`). Also, while `sys_common`'s mutexes and condvars are already taken care of by #77147 and #77648, its `RwLock` should still be made movable or get pinned.
      8cef65fd
    • M
      Add tracking issue template for library features. · f7306b1b
      Mara Bos 提交于
      f7306b1b
    • A
      Use Symbol for inline asm register class names · 40ed0f68
      Arlie Davis 提交于
      This takes care of one "FIXME":
      // FIXME: use direct symbol comparison for register class names
      
      Instead of using string literals, this uses Symbol for register
      class names.
      40ed0f68
    • A
      Use `def_path_hash_to_def_id` when re-using a `RawDefId` · 3918b829
      Aaron Hill 提交于
      Fixes #79890
      
      Previously, we just copied a `RawDefId` from the 'old' map to the 'new'
      map. However, the `RawDefId` for a given `DefPathHash` may be different
      in the current compilation session. Using `def_path_hash_to_def_id`
      ensures that the `RawDefId` we use is valid in the current session.
      3918b829
    • L
      Add some core::cmp::Ordering helpers · 169c59ff
      Lyndon Brown 提交于
      ...to allow easier greater-than-or-equal-to and less-than-or-equal-to
      comparisons, and variant checking without needing to import the enum,
      similar to `Option::is_none()` / `Option::is_some()`, in situations where
      you are dealing with an `Ordering` value. (Simple `PartialOrd` / `Ord`
      based evaluation may not be suitable for all situations).
      
      Prior to Rust 1.42 a greater-than-or-equal-to comparison might be written
      either as a match block, or a traditional conditional check like this:
      
      ```rust
      if cmp == Ordering::Equal || cmp == Ordering::Greater {
          // Do something
      }
      ```
      
      Which requires two instances of `cmp`. Don't forget that while `cmp` here
      is very short, it could be something much longer in real use cases.
      
      From Rust 1.42 a nicer alternative is possible:
      
      ```rust
      if matches!(cmp, Ordering::Equal | Ordering::Greater) {
          // Do something
      }
      ```
      
      The commit adds another alternative which may be even better in some cases:
      
      ```rust
      if cmp.is_ge() {
          // Do something
      }
      ```
      
      The earlier examples could be cleaner than they are if the variants of
      `Ordering` are imported such that `Equal`, `Greater` and `Less` can be
      referred to directly, but not everyone will want to do that.
      
      The new solution can shorten lines, help avoid logic mistakes, and avoids
      having to import `Ordering` / `Ordering::*`.
      169c59ff
    • R
      re-bless tests · d8ee8e76
      Ralf Jung 提交于
      d8ee8e76
    • R
      CTFE: tweak abort-on-uninhabited message · 2443f642
      Ralf Jung 提交于
      2443f642