1. 04 2月, 2018 7 次提交
    • K
      Rollup merge of #47896 -... · 349115ef
      kennytm 提交于
      Rollup merge of #47896 - zackmdavis:and_the_case_of_the_necessary_unnecessary_parens, r=nikomatsakis
      
      decline to lint technically-unnecessary parens in function or method arguments inside of nested macros
      
      In #46980 ("in which the unused-parens lint..." (14982db2)), the
      unused-parens lint was made to check function and method arguments,
      which it previously did not (seemingly due to oversight rather than
      willful design). However, in #47775 and discussion thereon,
      user–developers of Geal/nom and graphql-rust/juniper reported that the
      lint was seemingly erroneously triggering on certain complex macros in
      those projects. While this doesn't seem like a bug in the lint in the
      particular strict sense that the expanded code would, in fact, contain
      unncecessary parentheses, it also doesn't seem like the sort of thing
      macro authors should have to think about: the spirit of the
      unused-parens lint is to prevent needless clutter in code, not to give
      macro authors extra heartache in the handling of token trees.
      
      We propose the expediency of declining to lint unused parentheses in
      function or method args inside of nested expansions: we believe that
      this should eliminate the petty, troublesome lint warnings reported
      in the issue, without forgoing the benefits of the lint in simpler
      macros.
      
      It seemed like too much duplicated code for the `Call` and `MethodCall`
      match arms to duplicate the nested-macro check in addition to each
      having their own `for` loop, so this occasioned a slight refactor so
      that the function and method cases could share code—hopefully the
      overall intent is at least no less clear to the gentle reader.
      
      This is concerning #47775.
      349115ef
    • K
      Rollup merge of #47877 - spastorino:lifetime-bounds-in-copy, r=nikomatsakis · f3dc7560
      kennytm 提交于
      Do not ignore lifetime bounds in Copy impls
      
      cc #29149
      
      r? @nikomatsakis
      f3dc7560
    • K
      Rollup merge of #47862 - GuillaumeGomez:const-evaluation-ice, r=eddyb · 68698637
      kennytm 提交于
      Fix const evaluation ICE in rustdoc
      
      Fixes #47860.
      
      r? @EddyB
      68698637
    • B
      Auto merge of #47991 - nrc:update, r=alexcrichton · 3986539d
      bors 提交于
      Update RLS and Rustfmt
      
      r? @alexcrichton
      3986539d
    • B
      Auto merge of #47915 - eddyb:layout-of, r=nikomatsakis · 9af374ab
      bors 提交于
      rustc: prefer ParamEnvAnd and LayoutCx over tuples for LayoutOf.
      
      This PR provides `tcx.layout_of(param_env.and(ty))` as the idiomatic replacement for the existing `(tcx, param_env).layout_of(ty)` and removes fragile (coherence-wise) layout-related tuple impls.
      
      r? @nikomatsakis
      9af374ab
    • N
      Update RLS and Rustfmt · cec82c1b
      Nick Cameron 提交于
      cec82c1b
    • B
      Auto merge of #47845 - Zoxc:gen-fixes, r=nikomatsakis · 3d292b79
      bors 提交于
      Generator bugfixes
      
      r? @nikomatsakis
      3d292b79
  2. 03 2月, 2018 6 次提交
    • B
      Auto merge of #46254 - Dylan-DPC:ellided-lifetime, r=nikomatsakis · aa0a5a86
      bors 提交于
      elided lifetime
      
      Closes #45992
      
      Hey
      Having a problem with my config so decided to make a WIP PR nevertheless. Will add some more tests.
      aa0a5a86
    • B
      Auto merge of #47962 - kennytm:rollup, r=kennytm · 8d04b8fd
      bors 提交于
      Rollup of 10 pull requests
      
      - Successful merges: #46156, #47829, #47842, #47898, #47914, #47916, #47919, #47942, #47951, #47973
      - Failed merges: #47753
      8d04b8fd
    • G
      Fix const evaluation ICE in rustdoc · 6b35d813
      Guillaume Gomez 提交于
      6b35d813
    • K
      Rollup merge of #47973 - perlun:patch-1, r=dtolnay · 3a0a423d
      kennytm 提交于
      copy_nonoverlapping example: Fixed typo
      
      The comment referred to a variable using an incorrect name. (it has probably been renamed since the comment was written, or the comment was copied elsewhere - I noted the example in libcore has the `tmp` name for the temporary variable.)
      3a0a423d
    • B
      Auto merge of #47791 - estebank:mismatched-trait-impl, r=nikomatsakis · 6c15dffc
      bors 提交于
      Tweak presentation on lifetime trait mismatch
      
       - On trait/impl method discrepancy, add label pointing at trait signature.
       - Point only at method definition when referring to named lifetimes on lifetime mismatch.
       - When the sub and sup expectations are the same, tweak the output to avoid repeated spans.
      
      Fix #30790, CC #18759.
      6c15dffc
    • P
      copy_nonoverlapping example: Fixed typo · 321e429b
      Per Lundberg 提交于
      The comment referred to a variable using an incorrect name. (it has probably been renamed since the comment was written, or the comment was copied elsewhere - I noted the example in libcore has the `tmp` name for the temporary variable.)
      321e429b
  3. 02 2月, 2018 17 次提交
    • K
      Rollup merge of #47951 - GuillaumeGomez:sidebar-hover, r=QuietMisdreavus Fix... · 8d1586df
      kennytm 提交于
      Rollup merge of #47951 - GuillaumeGomez:sidebar-hover, r=QuietMisdreavus Fix ugly hover in sidebar In the sidebar, the elements under `Structs`, `Enums`... have an ugly hover if they're not selected. This fixes it. r? @QuietMisdreavus
      8d1586df
    • K
      Rollup merge of #47942 - estebank:macro-spans, r=nikomatsakis Minimize weird... · 9d995d28
      kennytm 提交于
      Rollup merge of #47942 - estebank:macro-spans, r=nikomatsakis Minimize weird spans involving macro context Sometimes the parser attempts to synthesize spans from within a macro context with the span for the captured argument, leading to non-sensical spans with very bad output. Given that an incorrect span is worse than a partially incomplete span, when detecting this situation return only one of the spans without merging them. Fix #32072, #47778. CC #23480.
      9d995d28
    • K
      Rollup merge of #47919 - varkor:to_degrees-precision, r=rkruppe Use constant... · 7c6380cd
      kennytm 提交于
      Rollup merge of #47919 - varkor:to_degrees-precision, r=rkruppe Use constant for 180/π in to_degrees The current `f32|f64.to_degrees` implementation uses a division to calculate `180/π`, which causes a loss of precision. Using a constant is still not perfect (implementing a maximally-precise algorithm would come with a high performance cost), but improves precision with a minimal change. As per the discussion in #29944, this fixes #29944 (the costs of improving the precision further would not outweigh the gains).
      7c6380cd
    • K
      Rollup merge of #47916 - vmx:patch-2, r=kennytm Fix lang items box example... · 5edeff31
      kennytm 提交于
      Rollup merge of #47916 - vmx:patch-2, r=kennytm Fix lang items box example code The `exchange_free` lang item is gone in favour of `box_free` [1]. Some warnings are also fixed by this commit. [1]: https://github.com/rust-lang/rust/commit/ca115dd083a1fe1d2b4892c5e50e49eb83ff1f3
      5edeff31
    • K
      Rollup merge of #47914 - etaoins:improve-char-escape-in-lexer-msg,... · b4b73a1d
      kennytm 提交于
      Rollup merge of #47914 - etaoins:improve-char-escape-in-lexer-msg, r=petrochenkov Improve char escaping in lexer messages Currently ', " and \ are escaped as \', \" and \\ respectively. This leads to confusing messages such as `error: unknown start of token: \\` when encountering a single backslash. Fix by emitting printable ASCII characters directly. This will still escape \r, \n, \t and Unicode characters. Fixes #47902
      b4b73a1d
    • K
      Rollup merge of #47898 - Aaron1011:static-ref-nll, r=nikomatsakis Fix ICE when... · 2e3a8f51
      kennytm 提交于
      Rollup merge of #47898 - Aaron1011:static-ref-nll, r=nikomatsakis Fix ICE when assigning references to a static mut with NLL is_unsafe_place only filters out statics in the rhs, not the lhs. Since it's possible to reach that 'Place::Static', we handle statics the same way as we do locals. Fixes #47789
      2e3a8f51
    • K
      Rollup merge of #47842 - Manishearth:dead-code, r=nagisa Remove dead code The... · a6719446
      kennytm 提交于
      Rollup merge of #47842 - Manishearth:dead-code, r=nagisa Remove dead code The Clone impl makes the lint ignore the type.
      a6719446
    • K
      Rollup merge of #47829 - estebank:break-in-for, r=cramertj Suggest removing... · 0f36b2cf
      kennytm 提交于
      Rollup merge of #47829 - estebank:break-in-for, r=cramertj Suggest removing value from `break` when invalid When attempting to use `break` with a value in a type of loop where it'd be invalid (any non-`loop`), suggest using `break` on its own. Close #34359.
      0f36b2cf
    • K
      Rollup merge of #46156 - SimonSapin:patch-14, r=withoutboats · 3600bfb3
      kennytm 提交于
      Document the size of bool
      3600bfb3
    • B
      Auto merge of #47465 - estebank:include-space-after-mut, r=nikomatsakis · 616b66dc
      bors 提交于
      Include space in suggestion `mut` in bindings
      
      Fix #46614.
      616b66dc
    • M
      Remove dead code · c7850139
      Manish Goregaokar 提交于
      c7850139
    • B
      Auto merge of #47102 - Diggsey:wasm-syscall, r=alexcrichton · 6741e416
      bors 提交于
      Implement extensible syscall interface for wasm
      
      Currently it's possible to run tests with the native wasm target, but it's not possible to tell whether they pass or to capture the output, because libstd throws away stdout, stderr and the exit code. While advanced libstd features should probably require more specific targets (eg. wasm-unknown-web) I think even the unknown target should at least support basic I/O.
      
      Any solution is constrained by these factors:
      - It must not be javascript specific
      - There must not be too strong coupling between libstd and the host environment (because it's an "unknown" target)
      - WebAssembly does not allow "optional" imports - all imports *must* be resolved.
      - WebAssembly does not support calling the host environment through any channel *other* than imports.
      
      The best solution I could find to these constraints was to give libstd a single required import, and implement a syscall-style interface through that import. Each syscall is designed such that a no-op implementation gives the most reasonable fallback behaviour. This means that the following import table would be perfectly valid:
      ```javascript
      imports.env = { rust_wasm_syscall: function(index, data) {} }
      ```
      
      Currently I have implemented these system calls:
      - Read from stdin
      - Write to stdout/stderr
      - Set the exit code
      - Get command line arguments
      - Get environment variable
      - Set environment variable
      - Get time
      
      It need not be extended beyond this set if being able to run tests for this target is the only goal.
      
      edit:
      As part of this PR I had to make a further change. Previously, the rust entry point would be automatically called when the webassembly module was instantiated. This was problematic because from the javascript side it was impossible to call exported functions, access program memory or get a reference to the instance.
      
      To solve this, ~I changed the default behaviour to not automatically call the entry point, and added a crate-level attribute to regain the old behaviour. (`#![wasm_auto_run]`)~ I disabled this behaviour when building tests.
      6741e416
    • G
      Fix ugly hover in sidebar · 8b8d0440
      Guillaume Gomez 提交于
      8b8d0440
    • D
      add ellided lifetime · accd997b
      dpc 提交于
      accd997b
    • E
      Change offset to `0` · df412ce2
      Esteban Küber 提交于
      df412ce2
    • E
      Minimize weird spans involving macro context · aaec6083
      Esteban Küber 提交于
      Sometimes the parser attempts to synthesize spans from within a macro
      context with the span for the captured argument, leading to non-sensical
      spans with very bad output. Given that an incorrect span is worse than
      a partially incomplete span, when detecting this situation return only
      one of the spans without mergin them.
      aaec6083
    • V
      Use constant for 180/π in to_degrees · e34c31bf
      varkor 提交于
      The current `f32|f64.to_degrees` implementation uses a division to calculate 180/π, which causes a loss of precision. Using a constant is still not perfect (implementing a maximally-precise algorithm would come with a high performance cost), but improves precision with a minimal change.
      e34c31bf
  4. 01 2月, 2018 10 次提交
    • B
      Auto merge of #47738 - nikomatsakis:issue-47139-master, r=arielb1 · 56733bc9
      bors 提交于
      remove intercrate ambiguity hints
      
      The scheme was causing overflows during coherence checking (e.g. #47139). This is sort of a temporary fix; the proper fix I think involves reworking trait selection in deeper ways.
      
      cc @sgrif -- this *should* fix diesel
      
      cc @qnighy -- I'd like to discuss you with alternative techniques for achieving the same end. =) Actually, it might be good to put some energy into refactoring traits first.
      
      r? @EddyB
      56733bc9
    • B
      Auto merge of #47540 - Manishearth:suggestion, r=nrc · 26792f06
      bors 提交于
      Add approximate suggestions for rustfix
      
      This adds `span_approximate_suggestion()` that lets you emit a
      suggestion marked as "non-machine applicable" in the JSON output. UI
      users see no difference. This is for when rustc and clippy wish to
       emit suggestions which will make sense to the reader (e.g. they may
      have placeholders like `<type>`) but are not source-applicable, so that
      rustfix/etc can ignore these.
      
      fixes #39254
      26792f06
    • V
      Fix lang items box example code · cf78ff39
      Volker Mische 提交于
      The `exchange_free` lang item is gone in favour of `box_free` [1].
      
      Some warnings are also fixed by this commit.
      
      [1]: https://github.com/rust-lang/rust/commit/ca115dd083a1fe1d2b4892c5e50e49eb83ff1f3
      cf78ff39
    • E
    • R
      Improve char escaping in lexer messages · b9441f24
      Ryan Cumming 提交于
      Currently ', " and \ are escaped as \', \" and \\ respectively. This
      leads to confusing messages such as `error: unknown start of token: \\`
      when encountering a single backslash.
      
      Fix by emitting printable ASCII characters directly. This will still
      escape \r, \n, \t and Unicode characters.
      
      Fixes #47902
      b9441f24
    • B
      Auto merge of #47900 - kennytm:rollup, r=kennytm · 8ccab7ee
      bors 提交于
      Rollup of 16 pull requests
      
      - Successful merges: #47838, #47840, #47844, #47874, #47875, #47876, #47884, #47886, #47889, #47890, #47891, #47795, #47677, #47893, #47895, #47552
      - Failed merges:
      8ccab7ee
    • K
      Rollup merge of #47552 - oberien:stepby-nth, r=dtolnay · af95302d
      kennytm 提交于
      Specialize StepBy::nth
      
      This allows optimizations of implementations of the inner iterator's `.nth` method.
      af95302d
    • K
      Rollup merge of #47895 - varkor:non-utf-stdin, r=estebank · 86eb7259
      kennytm 提交于
      Fix ICE when reading non-UTF-8 input from stdin
      
      Fixes #22387.
      86eb7259
    • K
      Rollup merge of #47893 - alexcrichton:move-codegen-backends, r=alexcrichton · 61972e73
      kennytm 提交于
      rustc: Move location of `codegen-backends` dir
      
      Right now this directory is located under:
      
      ```
      $sysroot/lib/rustlib/$target/lib/codegen-backends
      ```
      
      but after seeing what we do in a few other places it seems that a more
      appropriate location would be:
      
      ```
      $sysroot/lib/rustlib/$target/codegen-backends
      ```
      
      so this commit moves it!
      61972e73
    • K
      Rollup merge of #47677 - etaoins:avoid-underflow-in-rennder-source-line, r=estebank · 68135d19
      kennytm 提交于
      Avoid underflow in render_source_line
      
      While testing rust-lang/rust#47655 I was able to make the compiler panic when it's compiled with debug assertions:
      
      ```shell
      > rustc /dev/null --crate-type proc-macro
      
      error: internal compiler error: unexpected panic
      
      note: the compiler unexpectedly panicked. this is a bug.
      
      note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
      
      note: rustc 1.25.0-dev running on x86_64-apple-darwin
      
      note: run with `RUST_BACKTRACE=1` for a backtrace
      
      thread 'rustc' panicked at 'attempt to subtract with overflow', librustc_errors/emitter.rs:287:49
      ```
      
      Without debug assertions the following warning is emitted:
      
      ```shell
      > rustc /dev/null --crate-type proc-macro
      
      warning: unused variable: `registrar`
       --> /dev/null:0:1
        |
        |
        = note: #[warn(unused_variables)] on by default
        = note: to avoid this warning, consider using `_registrar` instead
      ```
      
      The panic is due to the unused variable warning being spanned to `/dev/null:0:1`. When `render_source_line` subtracts 1 from the line number to look up the source line it panics due to underflow. Without debug assertions this would wrap and cause us to return a blank string instead.
      
      Fix by explicitly testing for 0 and exiting early. I'm unsure how to automatically test this now that rust-lang/rust#46655 has been approved.
      68135d19