1. 12 6月, 2020 27 次提交
    • D
      Rollup merge of #73225 - tmandry:issue-73050, r=oli-obk · 6f9d4535
      Dylan DPC 提交于
      Allow inference regions when relating consts
      
      As first noticed by @EddyB, `super_relate_consts` doesn't need to check for inference vars since `eval` does it already (and handles lifetimes correctly by erasing them).
      
      Fixes #73050
      
      r? @oli-obk
      6f9d4535
    • D
      Rollup merge of #73178 - petrochenkov:explint, r=varkor · 657a41fe
      Dylan DPC 提交于
      expand: More precise locations for expansion-time lints
      
      First commit: a macro expansion doesn't have a `NodeId` associated with it, but it has a parent `DefId` which we can use for linting.
      The observable effect is that lints associated with macro expansions can now be `allow`ed at finer-grained level than whole crate.
      
      Second commit: each macro definition has a `NodeId` which we can use for linting, unless that macro definition was decoded from other crate.
      657a41fe
    • D
      Rollup merge of #72906 - lzutao:migrate-numeric-assoc-consts, r=dtolnay · c06799e4
      Dylan DPC 提交于
      Migrate to numeric associated consts
      
      The deprecation PR is #72885
      
      cc #68490
      cc rust-lang/rfcs#2700
      c06799e4
    • B
      Auto merge of #73266 - ehuss:update-cargo, r=ehuss · 59493917
      bors 提交于
      Update cargo
      
      2 commits in 1ec223effbbbf9fddd3453cdcae3a96a967608eb..79c769c3d7b4c2cf6a93781575b7f592ef974255
      2020-06-09 20:03:14 +0000 to 2020-06-11 22:13:37 +0000
      - Fix failure with missing readme. (rust-lang/cargo#8353)
      - Some LTO fixes. (rust-lang/cargo#8349)
      59493917
    • E
      Update cargo · 826ea22b
      Eric Huss 提交于
      826ea22b
    • B
      Auto merge of #69478 - avr-rust:avr-support-upstream, r=jonas-schievink · e91bf6c8
      bors 提交于
      Enable AVR as a Tier 3 target upstream
      
      Tracking issue: #44052.
      
      Things intentionally left out of the initial upstream:
      
      * The `target_cpu` flag
      
      I have made the cleanup suggestions by @jplatte and @jplatte in https://github.com/avr-rust/rust/commit/043550d9db0582add42e5837f636f61acb26b915.
      
      Anybody feel free to give the branch a test and see how it fares, or make suggestions on the code patch itself.
      e91bf6c8
    • B
      Auto merge of #73259 - Dylan-DPC:rollup-m6nw1n0, r=Dylan-DPC · 14027f3e
      bors 提交于
      Rollup of 7 pull requests
      
      Successful merges:
      
       - #73033 (Fix #[thread_local] statics as asm! sym operands)
       - #73036 (std: Enable atomic.fence emission on wasm32)
       - #73163 (Add long error explanation for E0724)
       - #73187 (Remove missed `cfg(bootstrap)`)
       - #73195 (Provide suggestion to convert numeric op LHS rather than unwrapping RHS)
       - #73247 (Add various Zulip notifications for prioritization)
       - #73254 (Add comment about LocalDefId -> DefId)
      
      Failed merges:
      
      r? @ghost
      14027f3e
    • D
      Rollup merge of #73254 - jyn514:local-def-id-comment, r=lcnr · 85a48d07
      Dylan DPC 提交于
      Add comment about LocalDefId -> DefId
      
      Now there are instructions on how to convert back and forth on both
      structs, not just one.
      
      See also https://github.com/rust-lang/rust/pull/73076
      
      r? @lcnr
      85a48d07
    • D
      Rollup merge of #73247 - LeSeulArtichaut:patch-1, r=spastorino · ce99f37f
      Dylan DPC 提交于
      Add various Zulip notifications for prioritization
      
      Adapts `triagebot.toml` for rust-lang/triagebot#616 and adds various Zulip notifications for the Prioritization WG workflow.
      We should also add indications about the procedure for handling those events, cc @rust-lang/wg-prioritization.
      
      r? @spastorino
      This should be merged as soon as possible after rust-lang/triagebot#616 is merged, cc @Mark-Simulacrum
      ce99f37f
    • D
      Rollup merge of #73195 - ayazhafiz:i/73145, r=estebank · 7bdf7d09
      Dylan DPC 提交于
      Provide suggestion to convert numeric op LHS rather than unwrapping RHS
      
      Given a code
      
      ```rust
      fn foo(x: u8, y: u32) -> bool {
          x > y
      }
      fn main() {}
      ```
      
      it could be more helpful to provide a suggestion to do "u32::from(x)"
      rather than "y.try_into().unwrap()", since the latter may panic.
      
      We do this by passing the LHS of a binary expression up the stack into
      the coercion checker.
      
      Closes #73145
      7bdf7d09
    • D
      Rollup merge of #73187 - mati865:bootstrap-cleanup, r=Mark-Simulacrum · 838d25b5
      Dylan DPC 提交于
      Remove missed `cfg(bootstrap)`
      838d25b5
    • D
      Rollup merge of #73163 - ayushmishra2005:61137-add-long-error-code-e0724, r=davidtwco · 6baf8678
      Dylan DPC 提交于
      Add long error explanation for E0724
      
      Add long explanation for the E0724 error code
      Part of #61137
      6baf8678
    • D
      Rollup merge of #73036 - alexcrichton:update-wasm-fence, r=Mark-Simulacrum · 3b41e547
      Dylan DPC 提交于
      std: Enable atomic.fence emission on wasm32
      
      This commit removes the `#[cfg]` guards in `atomic::fence` on wasm
      targets. Since these guards were originally added the upstream wasm
      specification for threads gained an `atomic.fence` instruction, so LLVM
      no longer panics on these intrinsics.
      
      Although there aren't a ton of tests in-repo for this right now I've
      tested locally and all of these fences generate `atomic.fence`
      instructions in wasm.
      
      Closes #65687
      Closes #72997
      3b41e547
    • D
      Rollup merge of #73033 - Amanieu:asm-tls, r=oli-obk · 2e424762
      Dylan DPC 提交于
      Fix #[thread_local] statics as asm! sym operands
      
      The `asm!` RFC specifies that `#[thread_local]` statics may be used as `sym` operands for inline assembly.
      
      This also fixes a regression in the handling of `#[thread_local]` during monomorphization which caused link-time errors with multiple codegen units, most likely introduced by #71192.
      
      r? @oli-obk
      2e424762
    • J
      Add comment about LocalDefId -> DefId · 1d8da944
      Joshua Nelson 提交于
      Now there are instructions on how to convert back and forth on both
      structs, not just one.
      1d8da944
    • B
      Auto merge of #73246 - Dylan-DPC:rollup-xnm531f, r=Dylan-DPC · a37c32e2
      bors 提交于
      Rollup of 7 pull requests
      
      Successful merges:
      
       - #72180 (remove extra space from crate-level doctest names)
       - #73012 (Show `SyntaxContext` in formatted `Span` debug output)
       - #73097 (Try_run must only be used if toolstate is populated)
       - #73169 (Handle assembler warnings properly)
       - #73182 (Track span of function in method calls, and use this in #[track_caller])
       - #73207 (Clean up E0648 explanation)
       - #73230 (Suggest including unused asm arguments in a comment to avoid error)
      
      Failed merges:
      
      r? @ghost
      a37c32e2
    • A
      Add long error explanation for E0724 · 68b4c03d
      Ayush Kumar Mishra 提交于
      Minor refactoring
      
      Minor refactoring
      
      Update src/librustc_error_codes/error_codes/E0724.md
      Co-authored-by: NDavid Wood <Q0KPU0H1YOEPHRY1R2SN5B5RL@david.davidtw.co>
      
      Update src/librustc_error_codes/error_codes/E0724.md
      Co-authored-by: NDavid Wood <Q0KPU0H1YOEPHRY1R2SN5B5RL@david.davidtw.co>
      
      Update src/librustc_error_codes/error_codes/E0724.md
      Co-authored-by: NDavid Wood <Q0KPU0H1YOEPHRY1R2SN5B5RL@david.davidtw.co>
      
      Minor refactoring
      68b4c03d
    • L
      3a8f6c09
    • D
      Rollup merge of #73230 - Amanieu:asm-unused2, r=petrochenkov · 8650df5d
      Dylan DPC 提交于
      Suggest including unused asm arguments in a comment to avoid error
      
      We require all arguments to an `asm!` to be used in the template string, just like format strings. However in some cases (e.g. `black_box`) it may be desirable to have `asm!` arguments that are not used in the template string.
      
      Currently this is a hard error rather than a lint since `#[allow]` does not work on macros (#63221), so this PR suggests using the unused arguments in an asm comment as a workaround.
      
      r? @petrochenkov
      8650df5d
    • D
      Rollup merge of #73207 - GuillaumeGomez:cleanup-e0648, r=Dylan-DPC · 6b418b30
      Dylan DPC 提交于
      Clean up E0648 explanation
      
      r? @Dylan-DPC
      6b418b30
    • D
      Rollup merge of #73182 - Aaron1011:feature/call-fn-span, r=matthewjasper · 84b91450
      Dylan DPC 提交于
      Track span of function in method calls, and use this in #[track_caller]
      
      Fixes #69977
      
      When we parse a chain of method calls like `foo.a().b().c()`, each
      `MethodCallExpr` gets assigned a span that starts at the beginning of
      the call chain (`foo`). While this is useful for diagnostics, it means
      that `Location::caller` will return the same location for every call
      in a call chain.
      
      This PR makes us separately record the span of the function name and
      arguments for a method call (e.g. `b()` in `foo.a().b().c()`). This
      `Span` is passed through HIR lowering and MIR building to
      `TerminatorKind::Call`, where it is used in preference to
      `Terminator.source_info.span` when determining `Location::caller`.
      
      This new span is also useful for diagnostics where we want to emphasize
      a particular method call - for an example, see
      https://github.com/rust-lang/rust/pull/72389#discussion_r436035990
      84b91450
    • D
      Rollup merge of #73169 - Amanieu:asm-warnings, r=petrochenkov · b3411159
      Dylan DPC 提交于
      Handle assembler warnings properly
      
      Previously all inline asm diagnostics were treated as errors, but LLVM sometimes emits warnings and notes as well.
      
      Fixes #73160
      
      r? @petrochenkov
      b3411159
    • D
      Rollup merge of #73097 - Mark-Simulacrum:clippy-fail, r=oli-obk · 8d620999
      Dylan DPC 提交于
      Try_run must only be used if toolstate is populated
      
      Clippy's tests were failing the build, but that failure was ignored in favor of checking toolstate. This is the correct behavior for toolstate-checked tools, but Clippy no longer updates its toolstate status as it should always build.
      
      The previous PR of this kind didn't catch this as I expected x.py failures to always lead to a non-successful build in CI, but that's not the case specifically for tool testing.
      8d620999
    • D
      Rollup merge of #73012 - Aaron1011:feature/span-debug-ctxt, r=matthewjasper · 80fce369
      Dylan DPC 提交于
      Show `SyntaxContext` in formatted `Span` debug output
      
      This is only really useful in debug messages, so I've switched to
      calling `span_to_string` in any place that causes a `Span` to end up in
      user-visible output.
      80fce369
    • D
      Rollup merge of #72180 - euclio:rustdoc-test-extra-space, r=Dylan-DPC · f23f6acb
      Dylan DPC 提交于
      remove extra space from crate-level doctest names
      
      Before:
      
      ```
      running 2 tests
      test src/test/rustdoc-ui/doctest-output.rs - foo::bar (line 11) ... ok
      test src/test/rustdoc-ui/doctest-output.rs -  (line 5) ... ok
      
      test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
      ```
      
      After:
      
      ```
      running 2 tests
      test src/test/rustdoc-ui/doctest-output.rs - foo::bar (line 11) ... ok
      test src/test/rustdoc-ui/doctest-output.rs - (line 5) ... ok
      
      test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
      ```
      f23f6acb
    • A
    • A
      Provide suggestion to convert numeric op LHS rather than unwrapping RHS · e243f623
      Ayaz Hafiz 提交于
      Given a code
      
      ```rust
      fn foo(x: u8, y: u32) -> bool {
          x > y
      }
      fn main() {}
      ```
      
      it could be more helpful to provide a suggestion to do "u32::from(x)"
      rather than "y.try_into().unwrap()", since the latter may panic.
      
      We do this by passing the LHS of a binary expression up the stack into
      the coercion checker.
      
      Closes #73145
      e243f623
  2. 11 6月, 2020 13 次提交
    • B
      Auto merge of #73235 - Dylan-DPC:rollup-zp8oxhg, r=Dylan-DPC · 50c0192c
      bors 提交于
      Rollup of 11 pull requests
      
      Successful merges:
      
       - #72380 (Fix `is_const_context`, update `check_for_cast`)
       - #72941 (Ensure stack when building MIR for matches)
       - #72976 (Clean up E0642 explanation)
       - #73080 (doc/rustdoc: Fix incorrect external_doc feature flag)
       - #73155 (save_analysis: better handle paths and functions signature)
       - #73164 (Add new E0762 error code)
       - #73172 (Fix more clippy warnings)
       - #73181 (Automatically prioritize unsoundness issues)
       - #73183 (Support proc macros in intra doc link resolution)
       - #73208 (Fix doctest template)
       - #73219 (x.py: with --json-output, forward cargo's JSON)
      
      Failed merges:
      
      r? @ghost
      50c0192c
    • D
      Rollup merge of #73219 - RalfJung:cargo-json, r=Mark-Simulacrum · ba0a8d2e
      Dylan DPC 提交于
      x.py: with --json-output, forward cargo's JSON
      
      Fixes https://github.com/rust-lang/rust/issues/73209
      
      r? @Mark-Simulacrum
      ba0a8d2e
    • D
      Rollup merge of #73208 - qm3ster:patch-1, r=Amanieu · 822bb9a1
      Dylan DPC 提交于
      Fix doctest template
      
      `saturating_add` example was not parameterized, but passed because the `u8` would saturate successfully
      822bb9a1
    • D
      Rollup merge of #73183 - Manishearth:intra-doc-macro, r=GuillaumeGomez · d9cf7a17
      Dylan DPC 提交于
      Support proc macros in intra doc link resolution
      
      The feature was written pre-proc macro resolution, so it only supported the wacky MBE resolution rules. This adds support for proc macros as well.
      
      cc @GuillaumeGomez
      
      Fixes #73173
      d9cf7a17
    • D
      Rollup merge of #73181 - LeSeulArtichaut:patch-1, r=spastorino · 6cc757e6
      Dylan DPC 提交于
      Automatically prioritize unsoundness issues
      
      r? @spastorino cc @Mark-Simulacrum @rust-lang/wg-prioritization
      6cc757e6
    • D
      Rollup merge of #73172 - matthiaskrgr:cl9ppy, r=Dylan-DPC · 2ac1598d
      Dylan DPC 提交于
      Fix more clippy warnings
      
      Fixes more of:
      
      clippy::unused_unit
      clippy::op_ref
      clippy::useless_format
      clippy::needless_return
      clippy::useless_conversion
      clippy::bind_instead_of_map
      clippy::into_iter_on_ref
      clippy::redundant_clone
      clippy::nonminimal_bool
      clippy::redundant_closure
      clippy::option_as_ref_deref
      clippy::len_zero
      clippy::iter_cloned_collect
      clippy::filter_next
      
      r? @Dylan-DPC
      2ac1598d
    • D
      Rollup merge of #73164 - GuillaumeGomez:add-e0761, r=petrochenkov · 70c14c2d
      Dylan DPC 提交于
      Add new E0762 error code
      70c14c2d
    • D
      Rollup merge of #73155 - marmeladema:save-analysis-various-fixes, r=Xanewok · b4af8740
      Dylan DPC 提交于
      save_analysis: better handle paths and functions signature
      
      This should improve slightly some possible regressions due to hir rework.
      
      r? @Xanewok
      b4af8740
    • D
      Rollup merge of #73080 - ertos-rs:sean.wilson/devel/external_doc-ref-fix, r=ollie27 · 12e5a69f
      Dylan DPC 提交于
      doc/rustdoc: Fix incorrect external_doc feature flag
      12e5a69f
    • D
      Rollup merge of #72976 - GuillaumeGomez:cleanup-e0642, r=Dylan-DPC · f4661e27
      Dylan DPC 提交于
      Clean up E0642 explanation
      
      r? @Dylan-DPC
      f4661e27
    • D
      Rollup merge of #72941 - nagisa:ensure-stack-for-match, r=oli-obk · adc92bec
      Dylan DPC 提交于
      Ensure stack when building MIR for matches
      
      In particular matching on complex types such as strings will cause
      deep recursion to happen.
      
      Fixes #72933
      
      r? @matthewjasper @oli-obk
      adc92bec
    • D
      Rollup merge of #72380 - lcnr:const_context, r=estebank · 298467ee
      Dylan DPC 提交于
      Fix `is_const_context`, update `check_for_cast`
      
      A better version of #71477
      
      Adds `fn enclosing_body_owner` and uses it in `is_const_context`.
      `is_const_context` now uses the same mechanism as `mir_const_qualif` as it was previously incorrect.
      Renames `is_const_context` to `is_inside_const_context`.
      
      I also updated `check_for_cast` in the second commit, so r? @estebank
      
      (I removed one lvl of indentation, so it might be easier to review by hiding whitespace changes)
      298467ee
    • B
      Auto merge of #71896 - spastorino:existential-assoc-types-variance, r=nikomatsakis · 3ddf4805
      bors 提交于
      Relate existential associated types with variance Invariant
      
      Fixes #71550 #72315
      
      r? @nikomatsakis
      
      The test case reported in that issue now errors with the following message ...
      
      ```
      error[E0495]: cannot infer an appropriate lifetime for lifetime parameter 'a in function call due to conflicting requirements
        --> /tmp/test.rs:25:5
         |
      25 |     bad(&Bar(PhantomData), x)
         |     ^^^^^^^^^^^^^^^^^^^^^^^^^
         |
      note: first, the lifetime cannot outlive the lifetime `'a` as defined on the function body at 24:11...
        --> /tmp/test.rs:24:11
         |
      24 | fn extend<'a, T>(x: &'a T) -> &'static T {
         |           ^^
      note: ...so that reference does not outlive borrowed content
        --> /tmp/test.rs:25:28
         |
      25 |     bad(&Bar(PhantomData), x)
         |                            ^
         = note: but, the lifetime must be valid for the static lifetime...
      note: ...so that the types are compatible
        --> /tmp/test.rs:25:9
         |
      25 |     bad(&Bar(PhantomData), x)
         |         ^^^^^^^^^^^^^^^^^
         = note: expected  `&'static T`
                    found  `&T`
      
      error: aborting due to previous error
      
      For more information about this error, try `rustc --explain E0495`.
      ```
      
      I could also add that test case if we want to have a weaponized one too.
      3ddf4805