Rollup of 8 pull requests
Successful merges:
- #67233 (Add PartialEq and Eq to Cursor)
- #67466 (Require const stability attributes on intrinsics to be able to use them in constant contexts)
- #67507 (Remove mem::uninitalized from tests)
- #67527 (Results show too much)
- #67536 (Move `{hir::lowering -> hir}::is_range_literal`)
- #67538 (Improve diagnostics for invalid assignment)
- #67546 (Fix ICE in mir interpretation)
- #67559 (Document that calling Drop, even after it panics, is UB)
Failed merges:
r? @ghost
Improve diagnostics for invalid assignment
- Improve wording and span information for invalid assignment diagnostics.
- Link to https://github.com/rust-lang/rfcs/issues/372 when it appears the user is trying a destructuring assignment.
- Make the equality constraint in `where` clauses error consistent with the invalid assignment error.
Move `{hir::lowering -> hir}::is_range_literal`
The function is never used inside lowering, but only ever in external crates.
By moving it, we facilitate lowering as its own crate.
Best read commit-by-commit.
r? @Mark-Simulacrum
Results show too much
Fixes#67461.
To reproduce the current issue: search anything, then once the results appears, press escape. They should disappear then re-appear right away. This is because blurring an element triggers the "change" event.
r? @kinnison
Remove mem::uninitalized from tests
This purges uses of uninitialized where possible from test cases. Some
are merely moved over to the equally bad pattern of
MaybeUninit::uninit().assume_init() but with an annotation that this is
"the best we can do".
Fixes#62397
This purges uses of uninitialized where possible from test cases. Some
are merely moved over to the equally bad pattern of
MaybeUninit::uninit().assume_init() but with an annotation that this is
"the best we can do".
Format the world
This PR modifies the formatting infrastructure a bit in the first commit (to enable the forgotten 2018 edition), as well as removes most directories from the ignore list in rustfmt.toml. It then follows that up with the second commit which runs `x.py fmt` and formats the entire repository.
We continue to not format the test directory (`src/test`) because of interactions with pretty printing and, in part, because re-blessing all of those files is somewhat harder to review, so is best suited for a follow up PR in my opinion.
Utilize rust-lang/rust commit hashes in toolstate
When moving the script out of CI configuration and into a proper script
we lost track of the current directory changing (and as such the
parameters of the script needing to be different now).
Document why Any is not an unsafe trait
The added documentation is not public (i.e., not in a doc comment) but that seems appropriate for this sort of low-level detail.
Fixes#62303
Rustdoc mutability removal
Fixes#67470.
As discussed in another PR, the `clean::Mutability` type in rustdoc is useless. So let's remove it!
r? @Centril
Add simpler entry points to const eval for common usages.
I found the `tcx.const_eval` API to be complex/awkward to work with, because of the inherent complexity from all of the different situations it is called from. Though it mainly used in one of the following ways:
- Evaluates the value of a constant without any substitutions, e.g. evaluating a static, discriminant, etc.
- Evaluates the value of a resolved instance of a constant. this happens when evaluating unevaluated constants or normalising trait constants.
- Evaluates a promoted constant.
This PR adds three new functions `const_eval_mono`, `const_eval_resolve`, and `const_eval_promoted` to `TyCtxt`, which each cater to one of the three ways `tcx.const_eval`
is normally used.
When moving the script out of CI configuration and into a proper script
we lost track of the current directory changing (and as such the
parameters of the script needing to be different now).
Enable incremental rustfmt adoption
Enables an incremental rollout of rustfmt usage within the compiler via a granular ignore configuration and automated enforcement. The decision to format the repository was approved in https://github.com/rust-lang/compiler-team/issues/80#issuecomment-491324079.
This PR includes:
* an `[ignore]` section to `rustfmt.toml` including most of the repository
* `./x.py` downloads rustfmt from a specific nightly (we do not pin to beta or stable as we need unstable features)
* an `./x.py fmt [--check]` command which runs cargo-fmt
* `./x.py fmt --check` runs during the same test step as `src/tools/tidy`, on master, but not on beta or stable as we don't want to depend on nightly rustfmt there.
* a commit to format `src/librustc_fs_util` as an initial target and to ensure enforcement is working from the start
Allocate HIR on an arena 1/4
This PR is the first in a series of 4, aiming at allocating the HIR on an arena, as a memory optimisation.
1. This first PR lays the groundwork and migrates some low-hanging fruits.
2. The second PR will migrate `hir::Expr`, `hir::Pat` and related.
3. The third PR will migrate `hir::Ty` and related.
4. The final PR will be dedicated to eventual cleanups.
In order to make the transition as gradual as possible, some lowering routines receive `Box`-allocated data and move it into the arena. This is a bit wasteful, but hopefully temporary.
Nonetheless, special care should be taken to avoid double arena allocations.
Work mentored by @Zoxc.