- 07 6月, 2022 13 次提交
-
-
由 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
-
由 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.
-
由 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)
-
由 bors 提交于
update Miri Fixes https://github.com/rust-lang/rust/issues/97745 r? `@ghost` Cc `@rust-lang/miri` Cc `@InfRandomness`
-
由 Matthias Krüger 提交于
Fix typo in redundant_pattern_match.rs alway -> always
-
由 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`
-
由 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.
-
由 nzrq 提交于
Co-authored-by: NDavid Tolnay <dtolnay@gmail.com>
-
由 bors 提交于
Update Clippy r? `@Manishearth` This includes a bit bigger `Cargo.lock` update.
-
由 Ralf Jung 提交于
-
由 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
- 06 6月, 2022 27 次提交
-
-
由 Chase Wilson 提交于
Co-authored-by: NEduard-Mihai Burtescu <edy.burt@gmail.com>
-
由 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!
-
由 bjorn3 提交于
A WorkProduct without a saved file is useless
-
由 bjorn3 提交于
This improves clarity of the code a bit
-
由 Dylan DPC 提交于
E0432: rust 2018 -> rust 2018 or later in --explain message
-
由 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.)
-
由 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.
-
由 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.
-
由 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.
-
由 bjorn3 提交于
-
由 bjorn3 提交于
It returns the previous work product or panics if there is none. This rename makes the purpose of this method clearer.
-
由 bjorn3 提交于
This is a tiny optimization
-
由 Ikko Ashimine 提交于
alway -> always
-
由 Guillaume Gomez 提交于
-
由 Guillaume Gomez 提交于
-
由 Guillaume Gomez 提交于
-
由 Guillaume Gomez 提交于
-
由 Guillaume Gomez 提交于
-
由 Guillaume Gomez 提交于
-
由 bors 提交于
Report unsafe for overriding link sections I'm not too sure about the lint wording here, but I couldn't think of anything better.
-
由 SparrowLii 提交于
-
由 Matthias Krüger 提交于
-
由 Philipp Krones 提交于
-
由 bors 提交于
Rollup of 7 pull requests Successful merges: - #90905 (Add empty impl blocks if they have documentation) - #97683 (Fail gracefully when encountering an HRTB in APIT. ) - #97721 (Do `suggest_await_before_try` with infer variables in self, and clean up binders) - #97752 (typo: `-Zcodegen-backend=llvm -Cpasses=list` should work now) - #97759 (Suggest adding `{}` for `'label: non_block_expr`) - #97764 (use strict provenance APIs) - #97765 (Restore a test that was intended to test `as` cast to ptr) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
-
由 Matthias Krüger 提交于
Restore a test that was intended to test `as` cast to ptr This test was changed in https://github.com/rust-lang/rust/pull/61864, but the original bug https://github.com/rust-lang/rust/issues/46365 was about casts so I doubt the changed test still even tests what this was intended to test. Let's restore the original test.
-
由 Matthias Krüger 提交于
use strict provenance APIs The stdlib was adjusted to avoid bare int2ptr casts, but recently some casts of that sort have sneaked back in. Let's fix that. :)
-
由 Matthias Krüger 提交于
Suggest adding `{}` for `'label: non_block_expr` Adds suggestions like this: ```text help: consider enclosing expression in a block | 3 | 'l {0}; | + + ``` inspired by https://github.com/rust-lang/rust/issues/48594#issuecomment-1146744400 r? ``@compiler-errors``
-