1. 12 6月, 2022 7 次提交
  2. 09 6月, 2022 3 次提交
  3. 08 6月, 2022 3 次提交
  4. 07 6月, 2022 18 次提交
    • B
      Auto merge of #97825 - Dylan-DPC:rollup-ya51k1k, r=Dylan-DPC · 7fe2c4b0
      bors 提交于
      Rollup of 5 pull requests
      
      Successful merges:
      
       - #97058 (Various refactors to the incr comp workproduct handling)
       - #97301 (Allow unstable items to be re-exported unstably without requiring the feature be enabled)
       - #97738 (Fix ICEs from zsts within unsized types with non-zero offsets)
       - #97771 (Remove SIGIO reference on Haiku)
       - #97808 (Add some unstable target features for the wasm target codegen)
      
      Failed merges:
      
      r? `@ghost`
      `@rustbot` modify labels: rollup
      7fe2c4b0
    • D
      Rollup merge of #97808 - alexcrichton:wasm-features, r=petrochenkov · 95266530
      Dylan DPC 提交于
      Add some unstable target features for the wasm target codegen
      
      I was experimenting with cross-language LTO for the wasm target recently
      between Rust and C and found that C was injecting the `+mutable-globals`
      flag on all functions. When specifying the corresponding
      `-Ctarget-feature=+mutable-globals` feature to Rust it prints a warning
      about an unknown feature. I've added the `mutable-globals` feature plus
      another few I know of to the list of known features for wasm targets.
      These features all continue to be unstable to source code as they were
      before.
      95266530
    • D
      Rollup merge of #97771 - rtzoeller:haiku_no_sigio, r=kennytm · f32a4f06
      Dylan DPC 提交于
      Remove SIGIO reference on Haiku
      
      Haiku doesn't define SIGIO. The nix crate already employs this workaround:
      https://github.com/nix-rust/nix/blob/5dedbc7850448ae3922ab0a833f3eb971bf7e25f/src/sys/signal.rs#L92-L94
      f32a4f06
    • D
      Rollup merge of #97738 - Kixiron:zst-panic, r=eddyb · 62c260de
      Dylan DPC 提交于
      Fix ICEs from zsts within unsized types with non-zero offsets
      
      - Fixes #97732
      - Fixes ICEs while compiling `alloc` with `-Z randomize-layout`
      
      r? ``@EddyB``
      62c260de
    • D
      Rollup merge of #97301 - semicoleon:unstable-reexport, r=petrochenkov · 2035b50d
      Dylan DPC 提交于
      Allow unstable items to be re-exported unstably without requiring the feature be enabled
      
      Closes #94972
      
      The diagnostic may need some work still, and I haven't added a test yet
      2035b50d
    • D
      Rollup merge of #97058 - bjorn3:multi_artifact_work_products, r=nagisa · ab1027ad
      Dylan DPC 提交于
      Various refactors to the incr comp workproduct handling
      
      This is the result of me looking into adding support for having multiple object files for a single codegen unit to incr comp. This is necessary to support inline assembly in cg_clif without requiring partial linking which is not supported on Windows and seems to fail on macOS for some reason. Cg_clif uses an external assembler to handle inline asm and thus produces one object file with regular functions and one object file containing compiled inline asm for each codegen unit which uses inline asm. Current incr comp can't handle this. This PR doesn't yet add support for this, but it makes it easier to do so.
      ab1027ad
    • B
      Auto merge of #97512 - scottmcm:add-coldcc, r=nagisa,lcnr · 91cacb3f
      bors 提交于
      Add support for emitting functions with `coldcc` to LLVM
      
      The eventual goal is to try using this for things like the internal panicking stuff, to see whether it helps.
      91cacb3f
    • B
      Auto merge of #95565 - jackh726:remove-borrowck-mode, r=nikomatsakis · bb55bd44
      bors 提交于
      Remove migrate borrowck mode
      
      Closes #58781
      Closes #43234
      
      # Stabilization proposal
      
      This PR proposes the stabilization of `#![feature(nll)]` and the removal of `-Z borrowck`. Current borrow checking behavior of item bodies is currently done by first infering regions *lexically* and reporting any errors during HIR type checking. If there *are* any errors, then MIR borrowck (NLL) never occurs. If there *aren't* any errors, then MIR borrowck happens and any errors there would be reported. This PR removes the lexical region check of item bodies entirely and only uses MIR borrowck. Because MIR borrowck could never *not* be run for a compiled program, this should not break any programs. It does, however, change diagnostics significantly and allows a slightly larger set of programs to compile.
      
      Tracking issue: #43234
      RFC: https://github.com/rust-lang/rfcs/blob/master/text/2094-nll.md
      Version: 1.63 (2022-06-30 => beta, 2022-08-11 => stable).
      
      ## Motivation
      
      Over time, the Rust borrow checker has become "smarter" and thus allowed more programs to compile. There have been three different implementations: AST borrowck, MIR borrowck, and polonius (well, in progress). Additionally, there is the "lexical region resolver", which (roughly) solves the constraints generated through HIR typeck. It is not a full borrow checker, but does emit some errors.
      
      The AST borrowck was the original implementation of the borrow checker and was part of the initially stabilized Rust 1.0. In mid 2017, work began to implement the current MIR borrow checker and that effort ompleted by the end of 2017, for the most part. During 2018, efforts were made to migrate away from the AST borrow checker to the MIR borrow checker - eventually culminating into "migrate" mode - where HIR typeck with lexical region resolving following by MIR borrow checking - being active by default in the 2018 edition.
      
      In early 2019, migrate mode was turned on by default in the 2015 edition as well, but with MIR borrowck errors emitted as warnings. By late 2019, these warnings were upgraded to full errors. This was followed by the complete removal of the AST borrow checker.
      
      In the period since, various errors emitted by the MIR borrow checker have been improved to the point that they are mostly the same or better than those emitted by the lexical region resolver.
      
      While there do remain some degradations in errors (tracked under the [NLL-diagnostics tag](https://github.com/rust-lang/rust/issues?q=is%3Aopen+is%3Aissue+label%3ANLL-diagnostics), those are sufficiently small and rare enough that increased flexibility of MIR borrow check-only is now a worthwhile tradeoff.
      
      ## What is stabilized
      
      As said previously, this does not fundamentally change the landscape of accepted programs. However, there are a [few](https://github.com/rust-lang/rust/issues?q=is%3Aopen+is%3Aissue+label%3ANLL-fixed-by-NLL) cases where programs can compile under `feature(nll)`, but not otherwise.
      
      There are two notable patterns that are "fixed" by this stabilization. First, the `scoped_threads` feature, which is a continutation of a pre-1.0 API, can sometimes emit a [weird lifetime error](https://github.com/rust-lang/rust/issues/95527) without NLL. Second, actually seen in the standard library. In the `Extend` impl for `HashMap`, there is an implied bound of `K: 'a` that is available with NLL on but not without - this is utilized in the impl.
      
      As mentioned before, there are a large number of diagnostic differences. Most of them are better, but some are worse. None are serious or happen often enough to need to block this PR. The biggest change is the loss of error code for a number of lifetime errors in favor of more general "lifetime may not live long enough" error. While this may *seem* bad, the former error codes were just attempts to somewhat-arbitrarily bin together lifetime errors of the same type; however, on paper, they end up being roughly the same with roughly the same kinds of solutions.
      
      ## What isn't stabilized
      
      This PR does not completely remove the lexical region resolver. In the future, it may be possible to remove that (while still keeping HIR typeck) or to remove it together with HIR typeck.
      
      ## Tests
      
      Many test outputs get updated by this PR. However, there are number of tests specifically geared towards NLL under `src/test/ui/nll`
      
      ## History
      
      * On 2017-07-14, [tracking issue opened](https://github.com/rust-lang/rust/issues/43234)
      * On 2017-07-20, [initial empty MIR pass added](https://github.com/rust-lang/rust/pull/43271)
      * On 2017-08-29, [RFC opened](https://github.com/rust-lang/rfcs/pull/2094)
      * On 2017-11-16, [Integrate MIR type-checker with NLL](https://github.com/rust-lang/rust/pull/45825)
      * On 2017-12-20, [NLL feature complete](https://github.com/rust-lang/rust/pull/46862)
      * On 2018-07-07, [Don't run AST borrowck on mir mode](https://github.com/rust-lang/rust/pull/52083)
      * On 2018-07-27, [Add migrate mode](https://github.com/rust-lang/rust/pull/52681)
      * On 2019-04-22, [Enable migrate mode on 2015 edition](https://github.com/rust-lang/rust/pull/59114)
      * On 2019-08-26, [Don't downgrade errors on 2015 edition](https://github.com/rust-lang/rust/pull/64221)
      * On 2019-08-27, [Remove AST borrowck](https://github.com/rust-lang/rust/pull/64790)
      bb55bd44
    • B
      Auto merge of #97801 - RalfJung:miri, r=RalfJung · 9f7e997c
      bors 提交于
      update Miri
      
      Fixes https://github.com/rust-lang/rust/issues/97745
      r? `@ghost` Cc `@rust-lang/miri`
      Cc `@InfRandomness`
      9f7e997c
    • B
      Auto merge of #97809 - matthiaskrgr:rollup-ajyvjd3, r=matthiaskrgr · 54aa8a78
      bors 提交于
      Rollup of 3 pull requests
      
      Successful merges:
      
       - #97700 (Add note to documentation of HashSet::intersection)
       - #97792 (More eslint checks)
       - #97794 (Fix typo in redundant_pattern_match.rs)
      
      Failed merges:
      
      r? `@ghost`
      `@rustbot` modify labels: rollup
      54aa8a78
    • M
      Rollup merge of #97794 - eltociear:patch-13, r=matthiaskrgr · fece76d7
      Matthias Krüger 提交于
      Fix typo in redundant_pattern_match.rs
      
      alway -> always
      fece76d7
    • M
      Rollup merge of #97792 - GuillaumeGomez:eslint-checks, r=Dylan-DPC · 6be8b9cd
      Matthias Krüger 提交于
      More eslint checks
      
      Here is the list of newly added eslint checks:
      
       * [no-confusing-arrow](https://eslint.org/docs/rules/no-confusing-arrow)
       * [no-div-regex](https://eslint.org/docs/rules/no-div-regex)
       * [no-floating-decimal](https://eslint.org/docs/rules/no-floating-decimal)
       * [no-implicit-globals](https://eslint.org/docs/rules/no-implicit-globals)
       * [no-implied-eval](https://eslint.org/docs/rules/no-implied-eval)
       * [no-label-var](https://eslint.org/docs/rules/no-label-var)
      
      Since you already reviewed the previous ones:
      
      r? `@Dylan-DPC`
      6be8b9cd
    • M
      Rollup merge of #97700 - nzrq:patch-1, r=dtolnay · c4bfd106
      Matthias Krüger 提交于
      Add note to documentation of HashSet::intersection
      
      The functionality of the `std::collections::HashSet::intersection(...)` method was slightly surprising to me so I wanted to take a sec to contribute to the documentation for this method.
      
      I've added a `Note:` section if that is appropriate.
      c4bfd106
    • A
      Add some unstable target features for the wasm target codegen · ff370017
      Alex Crichton 提交于
      I was experimenting with cross-language LTO for the wasm target recently
      between Rust and C and found that C was injecting the `+mutable-globals`
      flag on all functions. When specifying the corresponding
      `-Ctarget-feature=+mutable-globals` feature to Rust it prints a warning
      about an unknown feature. I've added the `mutable-globals` feature plus
      another few I know of to the list of known features for wasm targets.
      These features all continue to be unstable to source code as they were
      before.
      ff370017
    • N
      Apply suggestions from code review · 7d114c77
      nzrq 提交于
      Co-authored-by: NDavid Tolnay <dtolnay@gmail.com>
      7d114c77
    • B
      Auto merge of #97730 - flip1995:clippyup, r=Manishearth · 50b00252
      bors 提交于
      Update Clippy
      
      r? `@Manishearth`
      
      This includes a bit bigger `Cargo.lock` update.
      50b00252
    • R
      update Miri · 2e4e3409
      Ralf Jung 提交于
      2e4e3409
    • B
      Auto merge of #97795 - Dylan-DPC:rollup-dxilagr, r=Dylan-DPC · 357bc279
      bors 提交于
      Rollup of 5 pull requests
      
      Successful merges:
      
       - #97312 (Compute lifetimes in scope at diagnostic time)
       - #97495 (Add E0788 for improper #[no_coverage] usage)
       - #97579 (Avoid creating `SmallVec`s in `global_llvm_features`)
       - #97767 (interpret: do not claim UB until we looked more into variadic functions)
       - #97787 (E0432: rust 2018 -> rust 2018 or later    in --explain message)
      
      Failed merges:
      
      r? `@ghost`
      `@rustbot` modify labels: rollup
      357bc279
  5. 06 6月, 2022 9 次提交
    • C
      Update src/test/ui/unsized/issue-97732.rs · 10336cf1
      Chase Wilson 提交于
      Co-authored-by: NEduard-Mihai Burtescu <edy.burt@gmail.com>
      10336cf1
    • B
      Auto merge of #97684 - RalfJung:better-provenance-control, r=oli-obk · 9d20fd10
      bors 提交于
      interpret: better control over whether we read data with provenance
      
      The resolution in https://github.com/rust-lang/unsafe-code-guidelines/issues/286 seems to be that when we load data at integer type, we implicitly strip provenance. So let's implement that in Miri at least for scalar loads. This makes use of the fact that `Scalar` layouts distinguish pointer-sized integers and pointers -- so I was expecting some wild bugs where layouts set this incorrectly, but so far that does not seem to happen.
      
      This does not entirely implement the solution to https://github.com/rust-lang/unsafe-code-guidelines/issues/286; we still do the wrong thing for integers in larger types: we will `copy_op` them and then do validation, and validation will complain about the provenance. To fix that we need mutating validation; validation needs to strip the provenance rather than complaining about it. This is a larger undertaking (but will also help resolve https://github.com/rust-lang/miri/issues/845 since we can reset padding to `Uninit`).
      
      The reason this is useful is that we can now implement `addr` as a `transmute` from a pointer to an integer, and actually get the desired behavior of stripping provenance without exposing it!
      9d20fd10
    • B
      Make saved_file field of WorkProduct non-optional · e16c3b4a
      bjorn3 提交于
      A WorkProduct without a saved file is useless
      e16c3b4a
    • B
      Factor Option out of copy_cgu_workproduct_to_incr_comp_cache_dir call · 906b8515
      bjorn3 提交于
      This improves clarity of the code a bit
      906b8515
    • D
      Rollup merge of #97787 - matthiaskrgr:e0432_explain, r=Dylan-DPC · 99afe260
      Dylan DPC 提交于
      E0432: rust 2018 -> rust 2018 or later    in --explain message
      99afe260
    • D
      Rollup merge of #97767 - RalfJung:variadic, r=davidtwco · 85617f1c
      Dylan DPC 提交于
      interpret: do not claim UB until we looked more into variadic functions
      
      I am not actually sure if this is UB, and anyway for FFI shims, Miri currently does not attempt to distinguish between arguments passed via variadics vs directly. So let's be consistent.
      (Programs that ran into this error will anyway immediately fall through to the "unsupported" message on the next line.)
      85617f1c
    • D
      Rollup merge of #97579 - SparrowLii:target_features, r=nagisa · 6da214c1
      Dylan DPC 提交于
      Avoid creating `SmallVec`s in `global_llvm_features`
      
      This PR made a simple optimization to avoid creating extra `SmallVec`s by adjusting the use of iterator statements.
      Also, given the very small size of `tied_target_features`, there is no need to insert each feature into the FxHashMap.
      6da214c1
    • D
      Rollup merge of #97495 - clarfonthey:e0788-no-coverage, r=nagisa · cb787bea
      Dylan DPC 提交于
      Add E0788 for improper #[no_coverage] usage
      
      Essentially, this adds proper checking for the attribute (tracking issue #84605) and throws errors when it's put in obviously-wrong places, like on struct or const definitions. Most of the code is taken directly from the checks for the `#[inline]` attribute, since it's very similar.
      
      Right now, the code only checks at the function level, but it seems reasonable to allow adding `#[no_coverage]` to individual blocks or expressions, so, for now those just throw `unused_attributes` warnings. Similarly, since there was a lot of desire to eventually allow recursive definitions as well on modules and impl blocks, these also throw `unused_attributes` instead of an error.
      
      I'm not sure if anything has to be done since this error is technically for an unstable feature, but since an error for using unstable features will show up anyway, I think it's okay.
      
      This is the first big piece needed for stabilising this attribute, although I personally would like to explore renaming it to `#[coverage(never)]` on a separate PR, which I will offer soon. There's a lot of discussion still to be had about that, which is why it will be kept separate.
      
      I don't think much is needed besides adding this simple check and a UI test, but let me know if there's something else that should be added to make this happen.
      cb787bea
    • D
      Rollup merge of #97312 - cjgillot:no-path-in-scope, r=compiler-errors · a736acc8
      Dylan DPC 提交于
      Compute lifetimes in scope at diagnostic time
      
      The set of available lifetimes is currently computed during lifetime resolution on HIR.  It is only used for one diagnostic.
      
      In this PR, HIR lifetime resolution just reports whether elided lifetimes are well-defined at the place of use.  The diagnostic code is responsible for building a list of lifetime names if elision is not allowed.
      
      This will allow to remove lifetime resolution on HIR eventually.
      a736acc8