| Age | Commit message (Collapse) | Author | Lines |
|
Add fast path for match checking
This adds a fast path that would reduce the complexity to linear on matches consisting of only variant patterns (i.e. enum matches). (Also see: #7462) Unfortunately, I was too lazy to add a similar fast path for constants (mostly for integer matches), ideally that could be added another day.
TBH, I'm not confident with the performance claims due to the fact that enums tends to be small and FxHashMap could add a lot of overhead.
r? `@Mark-Simulacrum`
needs perf
|
|
Cache `eval_to_allocation_raw` on disk
https://github.com/rust-lang/rust/pull/74949#issuecomment-695833161 regressed the performance on these queries, this PR gets the perf back.
|
|
|
|
Preserve doc-comments when generating queries
Closes https://github.com/rust-lang/rust/issues/76812
|
|
const_evaluatable_checked: extend predicate collection
We now walk the hir instead of using `ty` so that we get better spans here, While I am still not completely sure if that's
what we want in the end, it does seem a lot closer to the final goal than the previous version.
We also look into type aliases (and use a `TypeVisitor` here), about which I am not completely sure, but we will see how well this works.
We also look into fn decls, so the following should work now.
```rust
fn test<T>() -> [u8; std::mem::size_of::<T>()] {
[0; std::mem::size_of::<T>()]
}
```
Additionally, we visit the optional trait and self type of impls.
r? `@oli-obk`
|
|
Move MiniSet to data_structures
remove the need for T to be copy from MiniSet as was done for MiniMap
MiniMap and MiniSet was added by https://github.com/rust-lang/rust/pull/72412
think that this can be used in https://github.com/rust-lang/rust/pull/68828
|
|
|
|
|
|
|
|
|
|
|
|
Fix underflow when calculating the number of no-op jumps folded
When removing unwinds to no-op blocks and folding jumps to no-op blocks,
remove the unwind target first. Otherwise we cannot determine if target
has been already folded or not.
Previous implementation incorrectly assumed that all resume targets had
been folded already, occasionally resulting in an underflow:
```
remove_noop_landing_pads: removed 18446744073709551613 jumps and 3 landing pads
```
|
|
Rollup of 9 pull requests
Successful merges:
- #76898 (Record `tcx.def_span` instead of `item.span` in crate metadata)
- #76939 (emit errors during AbstractConst building)
- #76965 (Add cfg(target_has_atomic_equal_alignment) and use it for Atomic::from_mut.)
- #76993 (Changing the alloc() to accept &self instead of &mut self)
- #76994 (fix small typo in docs and comments)
- #77017 (Add missing examples on Vec iter types)
- #77042 (Improve documentation for ToSocketAddrs)
- #77047 (Miri: more informative deallocation error messages)
- #77055 (Add #[track_caller] to more panicking Cell functions)
Failed merges:
r? `@ghost`
|
|
MIR pass to remove unneeded drops on types not needing drop
This is heavily dependent on MIR inlining running to actually see the drop statement.
Do we want to special case replacing a call to std::mem::drop with a goto aswell?
|
|
Miri: more informative deallocation error messages
Make sure we show the affected AllocId.
r? @oli-obk
|
|
fix small typo in docs and comments
Fixed `the the` to `the`, as far as I found.
|
|
Add cfg(target_has_atomic_equal_alignment) and use it for Atomic::from_mut.
Fixes some platform-specific problems with #74532 by using the actual alignment of the types instead of hardcoding a few `target_arch`s.
r? @RalfJung
|
|
emit errors during AbstractConst building
There changes are currently still untested, so I don't expect this to pass CI :laughing:
It seems to me like this is the direction we want to go in, though we didn't have too much of a discussion about this.
r? @oli-obk
|
|
Record `tcx.def_span` instead of `item.span` in crate metadata
This was missed in PR #75465. As a result, a few places have been using
the full body span of functions, instead of just the header span.
|
|
SimplifyComparisonIntegral: fix miscompilation
Fixes #76432
Only insert StorageDeads if we actually removed one.
Fixes an issue where we added StorageDead to a place with no StorageLive
r? `@oli-obk`
|
|
remove the need for T to be copy from MiniSet as was done for MiniMap
|
|
Remove `qualify_min_const_fn`
~~Blocked on #76807 (the first six commits).~~
With this PR, all checks in `qualify_min_const_fn` are replicated in `check_consts`, and the former is no longer invoked. My goal was to have as few changes to test output as possible, since making sweeping changes to the code *while* doing big batches of diagnostics updates turned out to be a headache. To this end, there's a few `HACK`s in `check_consts` to achieve parity with `qualify_min_const_fn`.
The new system that replaces `is_min_const_fn` is referred to as "const-stability" My end goal for the const-stability rules is this:
* Const-stability is only applicable to functions defined in `staged_api` crates.
* All functions not marked `rustc_const_unstable` are considered "const-stable".
- NB. This is currently not implemented. `#[unstable]` functions are also const-unstable. This causes problems when searching for feature gates.
- All "const-unstable" functions have an associated feature gate
* const-stable functions can only call other const-stable functions
- `allow_internal_unstable` can be used to circumvent this.
* All const-stable functions are subject to some additional checks (the ones that were unique to `qualify_min_const_fn`)
The plan is to remove each `HACK` individually in subsequent PRs. That way, changes to error message output can be reviewed in isolation.
|
|
cache types during normalization
partially fixes #75992
reduces the following test from 14 to 3 seconds locally.
cc `@Mark-Simulacrum` would it make sense to add that test to `perf`?
```rust
#![recursion_limit="2048"]
#![type_length_limit="112457564"]
pub async fn h0(v: &String, x: &u64) { println!("{} {}", v, x) }
pub async fn h1(v: &String, x: &u64) { h0(v, x).await }
pub async fn h2(v: &String, x: &u64) { h1(v, x).await }
pub async fn h3(v: &String, x: &u64) { h2(v, x).await }
pub async fn h4(v: &String, x: &u64) { h3(v, x).await }
pub async fn h5(v: &String, x: &u64) { h4(v, x).await }
pub async fn h6(v: &String, x: &u64) { h5(v, x).await }
pub async fn h7(v: &String, x: &u64) { h6(v, x).await }
pub async fn h8(v: &String, x: &u64) { h7(v, x).await }
pub async fn h9(v: &String, x: &u64) { h8(v, x).await }
pub async fn h10(v: &String, x: &u64) { h9(v, x).await }
pub async fn h11(v: &String, x: &u64) { h10(v, x).await }
pub async fn h12(v: &String, x: &u64) { h11(v, x).await }
pub async fn h13(v: &String, x: &u64) { h12(v, x).await }
pub async fn h14(v: &String, x: &u64) { h13(v, x).await }
pub async fn h15(v: &String, x: &u64) { h14(v, x).await }
pub async fn h16(v: &String, x: &u64) { h15(v, x).await }
pub async fn h17(v: &String, x: &u64) { h16(v, x).await }
pub async fn h18(v: &String, x: &u64) { h17(v, x).await }
pub async fn h19(v: &String, x: &u64) { h18(v, x).await }
macro_rules! async_recursive {
(29, $inner:expr) => { async { async_recursive!(28, $inner) }.await };
(28, $inner:expr) => { async { async_recursive!(27, $inner) }.await };
(27, $inner:expr) => { async { async_recursive!(26, $inner) }.await };
(26, $inner:expr) => { async { async_recursive!(25, $inner) }.await };
(25, $inner:expr) => { async { async_recursive!(24, $inner) }.await };
(24, $inner:expr) => { async { async_recursive!(23, $inner) }.await };
(23, $inner:expr) => { async { async_recursive!(22, $inner) }.await };
(22, $inner:expr) => { async { async_recursive!(21, $inner) }.await };
(21, $inner:expr) => { async { async_recursive!(20, $inner) }.await };
(20, $inner:expr) => { async { async_recursive!(19, $inner) }.await };
(19, $inner:expr) => { async { async_recursive!(18, $inner) }.await };
(18, $inner:expr) => { async { async_recursive!(17, $inner) }.await };
(17, $inner:expr) => { async { async_recursive!(16, $inner) }.await };
(16, $inner:expr) => { async { async_recursive!(15, $inner) }.await };
(15, $inner:expr) => { async { async_recursive!(14, $inner) }.await };
(14, $inner:expr) => { async { async_recursive!(13, $inner) }.await };
(13, $inner:expr) => { async { async_recursive!(12, $inner) }.await };
(12, $inner:expr) => { async { async_recursive!(11, $inner) }.await };
(11, $inner:expr) => { async { async_recursive!(10, $inner) }.await };
(10, $inner:expr) => { async { async_recursive!(9, $inner) }.await };
(9, $inner:expr) => { async { async_recursive!(8, $inner) }.await };
(8, $inner:expr) => { async { async_recursive!(7, $inner) }.await };
(7, $inner:expr) => { async { async_recursive!(6, $inner) }.await };
(6, $inner:expr) => { async { async_recursive!(5, $inner) }.await };
(5, $inner:expr) => { async { async_recursive!(4, $inner) }.await };
(4, $inner:expr) => { async { async_recursive!(3, $inner) }.await };
(3, $inner:expr) => { async { async_recursive!(2, $inner) }.await };
(2, $inner:expr) => { async { async_recursive!(1, $inner) }.await };
(1, $inner:expr) => { async { async_recursive!(0, $inner) }.await };
(0, $inner:expr) => { async { h19(&String::from("owo"), &0).await; $inner }.await };
}
async fn f() {
async_recursive!(14, println!("hello"));
}
fn main() {
let _ = f();
}
```
r? `@eddyb` requires a perf run.
|
|
|
|
|
|
|
|
Co-authored-by: Andreas Jonson <andjo403@users.noreply.github.com>
|
|
This is heavily dependent on MIR inlining running to actually see the drop statement
|
|
|
|
|
|
|
|
|
|
|
|
|
|
This is a hack for parity with `qualify_min_const_fn`, which only
emitted a single error.
|
|
|
|
|
|
|
|
Split rustc_typeck::check into separate files
Contributing to #60302.
|
|
|
|
|
|
lint missing docs for extern items
fixes #76991
|
|
Reduce boilerplate for BytePos and CharPos
Reduces boilerplate code for BytePos and CharPos by using a macro to implement shared traits.
|
|
extend `Ty` and `TyCtxt` lints to self types
blocked on #76891
r? @ecstatic-morse cc @Aaron1011
|
|
use if let instead of single match arm expressions
use if let instead of single match arm expressions to compact code and reduce nesting (clippy::single_match)
|
|
Use const-checking to forbid use of unstable features in const-stable functions
First step towards #76618.
Currently this code isn't ever hit because `qualify_min_const_fn` runs first and catches pretty much everything. One exception is `const_precise_live_drops`, which does not use the newly added code since it runs as part of a separate pass.
Also contains some unrelated refactoring, which is split into separate commits.
r? @oli-obk
|
|
do not ICE on bound variables, return `TooGeneric` instead
fixes #73260, fixes #74634, fixes #76595
r? @nikomatsakis
|
|
Add explanation for E0756
r? @pickfire
|
|
Don't use `zip` to compare iterators during pretty-print hack
If the right-hand iterator has exactly one more element than the
left-hand iterator, then both iterators will be fully consumed, but
the extra element will never be compared.
Split out from https://github.com/rust-lang/rust/pull/76130
|
|
Fixing the performance regression of #76244
Issue https://github.com/rust-lang/rust/issues/74865 suggested that removing the `def_id` field from `ParamEnv` would improve performance. PR https://github.com/rust-lang/rust/pull/76244 implemented this change.
Generally, [results](https://perf.rust-lang.org/compare.html?start=80fc9b0ecb29050d45b17c64af004200afd3cfc2&end=5ef250dd2ad618ee339f165e9b711a1b4746887d) were as expected: an instruction count decrease of about a percent. The instruction count for the unicode crates increased by about 3%, which `@nnethercote` speculated to be caused by a quirk of inlining or codegen. As the results were generally positive, and for chalk integration, this was also a step in the right direction, the PR was r+'d regardless.
However, [wall-time performance results](https://perf.rust-lang.org/compare.html?start=a055c5a1bd95e029e9b31891db63b6dc8258b472&end=7402a394471a6738a40fea7d4f1891666e5a80c5&stat=task-clock) show a much larger performance degradation: 25%, as [mentioned](https://github.com/rust-lang/rust/pull/76244#issuecomment-694459840) by `@Mark-Simulacrum.`
This PR, for now, reverts #76244 and attempts to find out, which change caused the regression.
|