- 08 6月, 2022 3 次提交
-
-
由 Michael Goulet 提交于
-
由 bors 提交于
Rollup of 5 pull requests Successful merges: - #95948 (Improve the safety docs for `CStr`) - #97325 (Fix precise field capture of univariant enums) - #97817 (
⬆ rust-analyzer) - #97821 (Remove confusing sentence from `Mutex` docs) - #97826 (Add more information for rustdoc-gui tests) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
-
- 07 6月, 2022 29 次提交
-
-
由 Dylan DPC 提交于
Add more information for rustdoc-gui tests It was missing `--no-sandbox` in the `--help` message and the README was a bit outdated. cc `@jsha` (I recall you asking some questions about passing arguments to the rustdoc gui tester so here it). r? `@notriddle`
-
由 Dylan DPC 提交于
Remove confusing sentence from `Mutex` docs The docs were saying something about "statically initializing" the mutex, and it's not clear what this means. Remove that part to avoid confusion.
-
由 Dylan DPC 提交于
Fix precise field capture of univariant enums When constructing a MIR from a THIR field expression, introduce an additional downcast projection before accessing a field of an enum. When rebasing a place builder on top of a captured place, account for the fact that a single HIR enum field projection corresponds to two MIR projection elements: a downcast element and a field element. Fixes #95271. Fixes #96299. Fixes #96512. Fixes #97378. r? ``@nikomatsakis`` ``@arora-aman``
-
由 Dylan DPC 提交于
Improve the safety docs for `CStr` Namely, the two functions `from_ptr` and `from_bytes_with_nul_unchecked`. Before, these functions didn't state the requirements clearly enough, and I was not immediately able to find them like for other functions. This doesn't change the content of the docs, but simply rewords them for clarity. note: I'm not entirely sure about the '`ptr` must be valid for reads of `u8`.', there might be room for improvement for this (and maybe for the other docs as well
😄 ) -
由 Nilstrieb 提交于
Namely, the two functions `from_ptr` and `from_bytes_with_nul_unchecked`. Before, this functions didn't state the requirements clearly enough, and I was not immediately able to find them like for other functions. This doesn't change the content of the docs, but simply rewords them for clarity.
-
由 Dylan DPC 提交于
Co-authored-by: NWeiyi Wang <wwylele@gmail.com>
-
由 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
-
由 Guillaume Gomez 提交于
-
由 Guillaume Gomez 提交于
-
由 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.
-
由 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
-
由 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 提交于
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.
-
由 Nilstrieb 提交于
The docs were saying something about "statically initializing" the mutex, and it's not clear what this means. Remove that part to avoid confusion.
-
由 Laurențiu Nicola 提交于
-
由 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.
-
由 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.
-
由 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 8 次提交
-
-
由 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.
-