1. 09 10月, 2020 1 次提交
  2. 08 10月, 2020 16 次提交
    • B
      Auto merge of #77678 - jyn514:tracing, r=Mark-Simulacrum · ccea5704
      bors 提交于
      Upgrade to tracing-subscriber 0.2.13
      
      The primary motivation is to get the changes from
      https://github.com/tokio-rs/tracing/pull/990. Example output:
      
      ```
      $ RUSTDOC_LOG=debug rustdoc +rustc2
      warning: some trace filter directives would enable traces that are disabled statically
       | `debug` would enable the DEBUG level for all targets
       = note: the static max level is `info`
       = help: to enable DEBUG logging, remove the `max_level_info` feature
      ```
      
      r? `@Mark-Simulacrum`
      cc `@hawkw` 
      ccea5704
    • B
      Auto merge of #77581 - ecstatic-morse:dataflow-dump-mir-graphviz, r=davidtwco · 38284898
      bors 提交于
      Use `pretty::create_dump_file` for dumping dataflow results
      
      The old code wasn't incorporating promoteds into the path, meaning other `dot` files could get clobbered. Use the MIR dump infrastructure to generate paths so that this doesn't occur in the future.
      38284898
    • B
      Auto merge of #77682 - Mark-Simulacrum:bump-stage0, r=pietroalbini · f1dab244
      bors 提交于
      Bump to 1.48 bootstrap compiler
      
      r? `@pietroalbini` (but anyone can feel free to review)
      f1dab244
    • B
      Auto merge of #77644 - GuillaumeGomez:fix-tooltip-text-display, r=jyn514 · 15656998
      bors 提交于
      Fix tooltip text display
      
      Currently, when we hover the icon, the text doesn't show up:
      
      ![Screenshot from 2020-10-07 11-30-44](https://user-images.githubusercontent.com/3050060/95313768-cc402200-0890-11eb-95a4-a1ae8e38aee1.png)
      
      The bug was spotted by `@Nemo157`
      
      r? `@jyn514`
      15656998
    • B
      Auto merge of #77631 - jyn514:helpful-changelog, r=RalfJung · 9c07010b
      bors 提交于
      Make src/bootstrap/CHANGELOG.md more helpful
      
      Addresses https://github.com/rust-lang/rust/commit/fe6fc555acd51bd7ba8755d9fbc7060feb67be25#r42949241.
      
      r? `@RalfJung`
      cc `@Mark-Simulacrum`
      9c07010b
    • B
      Auto merge of #77683 - jyn514:git-hook, r=Mark-Simulacrum · cc662cd4
      bors 提交于
      Unset GIT_DIR in pre-commit hook
      
      Works around https://github.com/rust-lang/rust/issues/77620. This won't help any other hooks you write manually, but hopefully people won't feel the need to do that now there's an 'official' one.
      
      r? `@Mark-Simulacrum`
      cc `@caass`
      cc662cd4
    • B
      Auto merge of #75470 - estebank:bare-type-expr, r=davidtwco · d9985fc1
      bors 提交于
      Detect blocks that could be struct expr bodies
      
      This approach lives exclusively in the parser, so struct expr bodies
      that are syntactically correct on their own but are otherwise incorrect
      will still emit confusing errors, like in the following case:
      
      ```rust
      fn foo() -> Foo {
          bar: Vec::new()
      }
      ```
      
      ```
      error[E0425]: cannot find value `bar` in this scope
       --> src/file.rs:5:5
        |
      5 |     bar: Vec::new()
        |     ^^^ expecting a type here because of type ascription
      
      error[E0214]: parenthesized type parameters may only be used with a `Fn` trait
       --> src/file.rs:5:15
        |
      5 |     bar: Vec::new()
        |               ^^^^^ only `Fn` traits may use parentheses
      
      error[E0107]: wrong number of type arguments: expected 1, found 0
       --> src/file.rs:5:10
        |
      5 |     bar: Vec::new()
        |          ^^^^^^^^^^ expected 1 type argument
        ```
      
      If that field had a trailing comma, that would be a parse error and it
      would trigger the new, more targetted, error:
      
      ```
      error: struct literal body without path
       --> file.rs:4:17
        |
      4 |   fn foo() -> Foo {
        |  _________________^
      5 | |     bar: Vec::new(),
      6 | | }
        | |_^
        |
      help: you might have forgotten to add the struct literal inside the block
        |
      4 | fn foo() -> Foo { Path {
      5 |     bar: Vec::new(),
      6 | } }
        |
      ```
      
      Partially address last remaining part of #34255.
      d9985fc1
    • M
      Bump to 1.48 bootstrap compiler · d8c035ab
      Mark Rousskov 提交于
      d8c035ab
    • J
      f4989494
    • B
      Auto merge of #77597 - simonvandel:uninhabited-hashset, r=jonas-schievink · e055f87c
      bors 提交于
      perf: UninhabitedEnumBranching avoid n^2
      
      Avoid n² complexity. This showed up in a profile for match-stress-enum that has 8192 variants
      
      I have only profiled locally against `match-stress-enum`, so we should have it perf tested to make sure it does not regress other crates.
      e055f87c
    • J
      Upgrade to tracing 0.2.13 · 8b22d079
      Joshua Nelson 提交于
      The primary motivation is to get the changes from
      https://github.com/tokio-rs/tracing/pull/990. Example output:
      
      ```
      $ RUSTDOC_LOG=debug rustdoc +rustc2
      warning: some trace filter directives would enable traces that are disabled statically
       | `debug` would enable the DEBUG level for all targets
       = note: the static max level is `info`
       = help: to enable DEBUG logging, remove the `max_level_info` feature
      ```
      
      - Remove useless test
      
        This was testing for an ICE when passing `RUST_LOG=rustc_middle`.  I
        noticed it because it started giving the tracing warning (because tests
        are not run with debug-logging enabled). Since this bug seems unlikely
        to re-occur, I just removed it altogether.
      8b22d079
    • B
      Auto merge of #76985 - hbina:clone_check, r=estebank · 91a79fb2
      bors 提交于
      Prevent stack overflow in deeply nested types.
      
      Related issue #75577 (?)
      
      Unfortunately, I am unable to test whether this actually solves the problem because apparently, 12GB RAM + 2GB swap is not enough to compile the (admittedly toy) source file.
      91a79fb2
    • E
      Detect blocks that could be struct expr bodies · e5f83bcd
      Esteban Küber 提交于
      This approach lives exclusively in the parser, so struct expr bodies
      that are syntactically correct on their own but are otherwise incorrect
      will still emit confusing errors, like in the following case:
      
      ```rust
      fn foo() -> Foo {
          bar: Vec::new()
      }
      ```
      
      ```
      error[E0425]: cannot find value `bar` in this scope
       --> src/file.rs:5:5
        |
      5 |     bar: Vec::new()
        |     ^^^ expecting a type here because of type ascription
      
      error[E0214]: parenthesized type parameters may only be used with a `Fn` trait
       --> src/file.rs:5:15
        |
      5 |     bar: Vec::new()
        |               ^^^^^ only `Fn` traits may use parentheses
      
      error[E0107]: wrong number of type arguments: expected 1, found 0
       --> src/file.rs:5:10
        |
      5 |     bar: Vec::new()
        |          ^^^^^^^^^^ expected 1 type argument
        ```
      
      If that field had a trailing comma, that would be a parse error and it
      would trigger the new, more targetted, error:
      
      ```
      error: struct literal body without path
       --> file.rs:4:17
        |
      4 |   fn foo() -> Foo {
        |  _________________^
      5 | |     bar: Vec::new(),
      6 | | }
        | |_^
        |
      help: you might have forgotten to add the struct literal inside the block
        |
      4 | fn foo() -> Foo { Path {
      5 |     bar: Vec::new(),
      6 | } }
        |
      ```
      
      Partially address last part of #34255.
      e5f83bcd
    • S
      perf: UninhabitedEnumBranching void n^2 · e231c47a
      Simon Vandel Sillesen 提交于
      Avoid n² complexity. This showed up in a profile for match-stress-enum that has 8192 variants
      e231c47a
    • B
      Auto merge of #77464 - ecstatic-morse:const-fn-impl-trait, r=oli-obk · 4437b4b1
      bors 提交于
      Give `impl Trait` in a `const fn` its own feature gate
      
      ...previously it was gated under `#![feature(const_fn)]`.
      
      I think we actually want to do this in all const-contexts? If so, this should be `#![feature(const_impl_trait)]` instead. I don't think there's any way to make use of `impl Trait` within a `const` initializer.
      
      cc #77463
      
      r? `@oli-obk`
      4437b4b1
    • B
      Auto merge of #77617 - AnthonyMikh:slice_windows_no_bounds_checking, r=lcnr · 28928c75
      bors 提交于
      Eliminate bounds checking in slice::Windows
      
      This is how `<core::slice::Windows as Iterator>::next` looks right now:
      
      ```rust
      fn next(&mut self) -> Option<&'a [T]> {
          if self.size > self.v.len() {
              None
          } else {
              let ret = Some(&self.v[..self.size]);
              self.v = &self.v[1..];
              ret
          }
      }
      ```
      
      The line with `self.v = &self.v[1..];` relies on assumption that `self.v` is definitely not empty at this point. Else branch is taken when `self.size <= self.v.len()`, so `self.v` can be empty if `self.size` is zero. In practice, since `Windows` is never created directly but rather trough `[T]::windows` which panics when `size` is zero, `self.size` is never zero. However, the compiler doesn't know about this check, so it keeps the code which checks bounds and panics.
      
      Using `NonZeroUsize` lets the compiler know about this invariant and reliably eliminate bounds checking without `unsafe` on `-O2`. Here is assembly of `Windows<'a, u32>::next` before and after this change ([goldbolt](https://godbolt.org/z/xrefzx)):
      
      <details>
      <summary>Before</summary>
      
      ```
      example::next:
              push    rax
              mov     rcx, qword ptr [rdi + 8]
              mov     rdx, qword ptr [rdi + 16]
              cmp     rdx, rcx
              jbe     .LBB0_2
              xor     eax, eax
              pop     rcx
              ret
      .LBB0_2:
              test    rcx, rcx
              je      .LBB0_5
              mov     rax, qword ptr [rdi]
              mov     rsi, rax
              add     rsi, 4
              add     rcx, -1
              mov     qword ptr [rdi], rsi
              mov     qword ptr [rdi + 8], rcx
              pop     rcx
              ret
      .LBB0_5:
              lea     rdx, [rip + .L__unnamed_1]
              mov     edi, 1
              xor     esi, esi
              call    qword ptr [rip + core::slice::slice_index_order_fail@GOTPCREL]
              ud2
      
      .L__unnamed_2:
              .ascii  "./example.rs"
      
      .L__unnamed_1:
              .quad   .L__unnamed_2
              .asciz  "\f\000\000\000\000\000\000\000\016\000\000\000\027\000\000"
      ```
      
      </details>
      
      <details>
      <summary>After</summary>
      
      ```
      example::next:
              mov     rcx, qword ptr [rdi + 8]
              mov     rdx, qword ptr [rdi + 16]
              cmp     rdx, rcx
              jbe     .LBB0_2
              xor     eax, eax
              ret
      .LBB0_2:
              mov     rax, qword ptr [rdi]
              lea     rsi, [rax + 4]
              add     rcx, -1
              mov     qword ptr [rdi], rsi
              mov     qword ptr [rdi + 8], rcx
              ret
      ```
      
      </details>
      
      Note the lack of call to `core::slice::slice_index_order_fail` in second snippet.
      
      #### Possible reasons _not_ to merge this PR:
      
      * this changes the error message on panic in `[T]::windows`. However, AFAIK this messages are not covered by backwards compatibility policy.
      28928c75
  3. 07 10月, 2020 23 次提交